mirror of
https://github.com/git/git.git
synced 2024-12-03 23:14:23 +08:00
974cdca345
In order to follow the common manpage usage, the synopsis of the commands needs to be heavily typeset. A first try was performed with using native markup, but it turned out to make the document source almost unreadable, difficult to write and prone to mistakes with unwanted Asciidoc's role attributes. In order to both simplify the writer's task and obtain a consistant typesetting in the synopsis, a custom 'synopsis' paragraph type is created and the processor for backticked text are modified. The backends of asciidoc and asciidoctor take in charge to correctly add the required typesetting. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
80 lines
2.7 KiB
Plaintext
80 lines
2.7 KiB
Plaintext
## linkgit: macro
|
|
#
|
|
# Usage: linkgit:command[manpage-section]
|
|
#
|
|
# Note, {0} is the manpage section, while {target} is the command.
|
|
#
|
|
# Show Git link as: <command>(<section>); if section is defined, else just show
|
|
# the command.
|
|
|
|
[macros]
|
|
(?su)[\\]?(?P<name>linkgit):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
|
|
|
|
[attributes]
|
|
asterisk=*
|
|
plus=+
|
|
caret=^
|
|
startsb=[
|
|
endsb=]
|
|
backslash=\
|
|
tilde=~
|
|
apostrophe='
|
|
backtick=`
|
|
litdd=--
|
|
|
|
ifdef::backend-docbook[]
|
|
[linkgit-inlinemacro]
|
|
{0%{target}}
|
|
{0#<citerefentry>}
|
|
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
|
|
{0#</citerefentry>}
|
|
|
|
[literal-inlinemacro]
|
|
{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])))}
|
|
|
|
endif::backend-docbook[]
|
|
|
|
ifdef::backend-docbook[]
|
|
ifdef::doctype-manpage[]
|
|
# The following two small workarounds insert a simple paragraph after screen
|
|
[listingblock]
|
|
<example><title>{title}</title>
|
|
<literallayout class="monospaced">
|
|
|
|
|
</literallayout><simpara></simpara>
|
|
{title#}</example>
|
|
|
|
[verseblock]
|
|
<formalpara{id? id="{id}"}><title>{title}</title><para>
|
|
{title%}<literallayout{id? id="{id}"}>
|
|
{title#}<literallayout>
|
|
|
|
|
</literallayout>
|
|
{title#}</para></formalpara>
|
|
{title%}<simpara></simpara>
|
|
endif::doctype-manpage[]
|
|
endif::backend-docbook[]
|
|
|
|
ifdef::backend-xhtml11[]
|
|
[attributes]
|
|
git-relative-html-prefix=
|
|
[linkgit-inlinemacro]
|
|
<a href="{git-relative-html-prefix}{target}.html">{target}{0?({0})}</a>
|
|
|
|
[literal-inlinemacro]
|
|
{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])))}
|
|
|
|
endif::backend-xhtml11[]
|
|
|
|
ifdef::backend-docbook[]
|
|
ifdef::doctype-manpage[]
|
|
[paradef-default]
|
|
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'"
|
|
endif::doctype-manpage[]
|
|
endif::backend-docbook[]
|
|
|
|
ifdef::backend-xhtml11[]
|
|
[paradef-default]
|
|
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'"
|
|
endif::backend-xhtml11[]
|