#10 RFE: define package::[] macro
Closed Opened by ignatenkobrain.

Wiki had very nice thing, if you specify {{package|binutils}} it would be transformed to: :package: binutils

It should be possible to do same using antora. I think this should be an example: https://github.com/couchbase/docs-site/blob/master/lib/man-inline-macro.js


Sure, why not. @ignatenkobrain are you willing to send a PR to https://pagure.io/fedora-docs/docs-fp-o/ ?

  1. I'm not proficient in JS, so I can't =(
  2. I don't think docs-fp-o repo is right one because it would work for subprojects only if you build whole docs.fp.o and not some submodule. I think right way for this would be to have some shared git repo which would contain some useful stuff like this macro and also UI theme.

As I understand it, you want to use a macro as a shorthand for a link to a package. If that is correct, then the syntax extension I recommend is an inline macro. The macro would follow the pattern package:<name>[] where <name> is the name of the package. For example, to link to the binutils package, the syntax would be package:binutils[].

The extension processor would be responsible for replacing the macro with a link node in the AST. The extension would provide a default base URL. It could also look for an override URL specified using a document attribute if you need that flexibility.

The extension processor belongs in the playbook repository. That is, the repository that contains the playbook file that tells Antora what to build.

I've submitted a PR that introduces this extension to the playbook / builder repository.

https://pagure.io/fedora-docs/docs-fp-o/pull-request/93

I suppose you could add this extension to the template as well. If it gets shared in enough places, you might think about publishing it as a node module. But since it's such a simple extension, that might be overkill atm.

@mojavelinux nice, thanks a lot!

Metadata Update from @asamalik:
- Issue status updated to: Closed (was: Open)

Metadata