3 # Usage: linkgit:command[manpage-section]
5 # Note, {0} is the manpage section, while {target} is the command.
7 # Show Git link as: <command>(<section>); if section is defined, else just show
11 (?su)[\\]?(?P<name>linkgit):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
25 mansource=Git @GIT_VERSION@
30 underlines="__","==","--","~~","^^"
33 ifdef::backend-docbook[]
35 ifndef::doctype-book[]
38 {0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
42 <ulink url="{target}.html">{target}{0?({0})}</ulink>
46 {eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))}
48 endif::backend-docbook[]
50 ifdef::backend-docbook[]
51 ifdef::doctype-manpage[]
52 # The following two small workarounds insert a simple paragraph after screen
54 <example><title>{title}</title>
55 <literallayout class="monospaced">
57 </literallayout><simpara></simpara>
61 <formalpara{id? id="{id}"}><title>{title}</title><para>
62 {title%}<literallayout{id? id="{id}"}>
63 {title#}<literallayout>
66 {title#}</para></formalpara>
67 {title%}<simpara></simpara>
68 endif::doctype-manpage[]
69 endif::backend-docbook[]
71 ifdef::backend-xhtml11[]
73 git-relative-html-prefix=
75 <a href="{git-relative-html-prefix}{target}.html">{target}{0?({0})}</a>
78 {eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<em>\1</em>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\/_^\$]+\.?)+)',r'\1<code>\2</code>', re.sub(r'(\.\.\.?)([^\]$.])', r'<code>\1</code>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))}
80 endif::backend-xhtml11[]
82 ifdef::backend-docbook[]
83 ifdef::doctype-manpage[]
85 synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<phrase>\\0</phrase>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.]\\+\\|…\\)!\\1<literal>\\2</literal>!g;s!<[-a-zA-Z0-9.]\\+>!<emphasis>\\0</emphasis>!g'"
86 endif::doctype-manpage[]
87 endif::backend-docbook[]
89 ifdef::backend-xhtml11[]
91 synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<span>\\0</span>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.]\\+\\|…\\)!\\1<code>\\2</code>!g;s!<[-a-zA-Z0-9.]\\+>!<em>\\0</em>!g'"
92 endif::backend-xhtml11[]