source: trunk/base/doc/asciidoc.conf @ 129855

Last change on this file since 129855 was 129855, checked in by raimue@…, 5 years ago

base: avoid the trailing '#' character in links

Links to the guide previously had a trailing '#' even when no section was
given. By using different syntax in the regular expression, no named capture
group will be created for an empty string. In this case, no '#' character will
be emitted in the backend replacement.

File size: 1.7 KB
Line 
1[attributes]
2mansource=MacPorts
3#manversion is in the Makefile
4manmanual=MacPorts Manual
5guideurl=http://guide.macports.org/
6wikiurl=https://trac.macports.org/wiki/
7sourceurl=https://trac.macports.org/browser/
8
9## man: macro
10#
11# Usage: man:command[manpage-section]
12#
13# Note, {0} is the manpage section, while {target} is the command.
14#
15# Show link as: <command>(<section>); if section is defined, else just show
16# the command.
17
18# Macros for links to other documentation
19#
20# The syntax (|...) is used here instead of (...)? to avoid creating
21# a named capture group when no match occurs.
22[macros]
23(?su)[\\]?(?P<name>man):(|(?P<target>\S+))\[(?P<attrlist>.*?)\]=
24(?su)[\\]?(?P<name>guide):(|(?P<target>\S+))\[(?P<attrlist>.*?)\]=
25(?su)[\\]?(?P<name>wiki):(|(?P<target>\S+))\[(?P<attrlist>.*?)\]=
26(?su)[\\]?(?P<name>source):(|(?P<target>\S+))\[(?P<attrlist>.*?)\]=
27
28# man: and guide: for docbook
29ifdef::backend-docbook[]
30[man-inlinemacro]
31<citerefentry>
32    <refentrytitle>{target}</refentrytitle>{0?<manvolnum>{0}</manvolnum>}
33</citerefentry>
34[guide-inlinemacro]
35<ulink url="{guideurl}{target?#{target}}">{0={guideurl}{target?#{target}}}</ulink>
36[wiki-inlinemacro]
37<ulink url="{wikiurl}{target}">{0={target}}</ulink>
38[source-inlinemacro]
39<ulink url="{sourceurl}{target}">{0={target}}</ulink>
40endif::backend-docbook[]
41
42# man: and guide: for xhtml11
43ifdef::backend-xhtml11[]
44[man-inlinemacro]
45<a href="{target}{0?.{0}}.html">{target}{0?({0})}</a>
46[guide-inlinemacro]
47<a href="{guideurl}{target?#{target}}">{0={guideurl}{target?#{target}}}</a>
48[wiki-inlinemacro]
49<a href="{wikiurl}{target}">{0={target}}</a>
50[source-inlinemacro]
51<a href="{sourceurl}{target}">{0={target}}</a>
52endif::backend-xhtml11[]
53
54[paradef-default]
55cmdsynopsis-style=template="verseparagraph"
Note: See TracBrowser for help on using the repository browser.