[attributes]
mansource=MacPorts
#manversion is in the Makefile
manmanual=MacPorts Manual
guideurl=https://guide.macports.org/
wikiurl=https://trac.macports.org/wiki/
sourceurl=https://github.com/macports/

## man: macro
#
# Usage: man:command[manpage-section]
#
# Note, {0} is the manpage section, while {target} is the command.
#
# Show link as: <command>(<section>); if section is defined, else just show
# the command.

# Macros for links to other documentation
#
# The syntax (|...) is used here instead of (...)? to avoid creating
# a named capture group when no match occurs.
[macros]
(?su)[\\]?(?P<name>man):(?:|(?P<target>\S+))\[(?P<attrlist>.*?)\]=
(?su)[\\]?(?P<name>guide):(?:|(?P<target>\S+))\[(?P<attrlist>.*?)\]=
(?su)[\\]?(?P<name>wiki):(?:|(?P<target>\S+))\[(?P<attrlist>.*?)\]=
(?su)[\\]?(?P<name>source):(?:|(?P<target>\S+))\[(?P<attrlist>.*?)\]=

# man: and guide: for docbook
ifdef::backend-docbook[]
[man-inlinemacro]
<citerefentry>
    <refentrytitle>{target}</refentrytitle>{0?<manvolnum>{0}</manvolnum>}
</citerefentry>
[guide-inlinemacro]
<ulink url="{guideurl}{target?#{target}}">{0={guideurl}{target?#{target}}}</ulink>
[wiki-inlinemacro]
<ulink url="{wikiurl}{target=}">{0={target}}</ulink>
[source-inlinemacro]
<ulink url="{sourceurl}{target=}">{0={target}}</ulink>
endif::backend-docbook[]

# man: and guide: for xhtml11
ifdef::backend-xhtml11[]
[man-inlinemacro]
<a href="{target}{0?.{0}}.html">{target}{0?({0})}</a>
[guide-inlinemacro]
<a href="{guideurl}{target?#{target}}">{0={guideurl}{target?#{target}}}</a>
[wiki-inlinemacro]
<a href="{wikiurl}{target=}">{0={target}}</a>
[source-inlinemacro]
<a href="{sourceurl}{target=}">{0={target}}</a>
endif::backend-xhtml11[]

[paradef-default]
cmdsynopsis-style=template="verseparagraph"
