forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: introducing synopsis para #1766
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -820,78 +820,80 @@ Markup: | |
_<new-branch-name>_ | ||
_<template-directory>_ | ||
|
||
A placeholder is not enclosed in backticks, as it is not a literal. | ||
|
||
When needed, use a distinctive identifier for placeholders, usually | ||
made of a qualification and a type: | ||
_<git-dir>_ | ||
_<key-id>_ | ||
|
||
When literal and placeholders are mixed, each markup is applied for | ||
each sub-entity. If they are stuck, a special markup, called | ||
unconstrained formatting is required. | ||
Unconstrained formating for placeholders is __<like-this>__ | ||
Unconstrained formatting for literal formatting is ++like this++ | ||
`--jobs` _<n>_ | ||
++--sort=++__<key>__ | ||
__<directory>__++/.git++ | ||
++remote.++__<name>__++.mirror++ | ||
Git's Asciidoc processor has been tailored to treat backticked text | ||
as complex synopsis. When literal and placeholders are mixed, you can | ||
use the backtick notation which will take care of correctly typesetting | ||
the content. | ||
`--jobs <n>` | ||
`--sort=<key>` | ||
`<directory>/.git` | ||
`remote.<name>.mirror` | ||
`ssh://[<user>@]<host>[:<port>]/<path-to-git-repo>` | ||
|
||
caveat: ++ unconstrained format is not verbatim and may expand | ||
content. Use Asciidoc escapes inside them. | ||
As a side effect, backquoted placeholders are correctly typeset, but | ||
this style is not recommended. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this): "Jean-Noël Avila via GitGitGadget" <[email protected]> writes:
> From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
>
> Signed-off-by: Jean-Noël Avila <[email protected]>
> ---
> Documentation/CodingGuidelines | 34 +++++++++++++++++++---------------
> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index 1d92b2da03e8..4d59e8f89ec8 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -760,56 +760,60 @@ Markup:
>
> Synopsis Syntax
>
> - Syntax grammar is formatted neither as literal nor as placeholder.
> + The synopsis (a paragraph with [synopsis] attribute) is automatically
> + formatted by the toolchain and does not need typesetting.
How pleasant ;-)
> And a somewhat more contrived example:
> - `--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]`
> + --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
> Here "=" is outside the brackets, because "--diff-filter=" is a
> valid usage. "*" has its own pair of brackets, because it can
> (optionally) be specified only when one or more of the letters is |
||
Synopsis Syntax | ||
|
||
Syntax grammar is formatted neither as literal nor as placeholder. | ||
The synopsis (a paragraph with [synopsis] attribute) is automatically | ||
formatted by the toolchain and does not need typesetting. | ||
|
||
A few commented examples follow to provide reference when writing or | ||
modifying command usage strings and synopsis sections in the manual | ||
pages: | ||
|
||
Possibility of multiple occurrences is indicated by three dots: | ||
_<file>_... | ||
<file>... | ||
(One or more of <file>.) | ||
|
||
Optional parts are enclosed in square brackets: | ||
[_<file>_...] | ||
[<file>...] | ||
(Zero or more of <file>.) | ||
|
||
++--exec-path++[++=++__<path>__] | ||
An optional parameter needs to be typeset with unconstrained pairs | ||
[<repository>] | ||
|
||
--exec-path[=<path>] | ||
(Option with an optional argument. Note that the "=" is inside the | ||
brackets.) | ||
|
||
[_<patch>_...] | ||
[<patch>...] | ||
(Zero or more of <patch>. Note that the dots are inside, not | ||
outside the brackets.) | ||
|
||
Multiple alternatives are indicated with vertical bars: | ||
[`-q` | `--quiet`] | ||
[`--utf8` | `--no-utf8`] | ||
[-q | --quiet] | ||
[--utf8 | --no-utf8] | ||
|
||
Use spacing around "|" token(s), but not immediately after opening or | ||
before closing a [] or () pair: | ||
Do: [`-q` | `--quiet`] | ||
Don't: [`-q`|`--quiet`] | ||
Do: [-q | --quiet] | ||
Don't: [-q|--quiet] | ||
|
||
Don't use spacing around "|" tokens when they're used to separate the | ||
alternate arguments of an option: | ||
Do: ++--track++[++=++(`direct`|`inherit`)]` | ||
Don't: ++--track++[++=++(`direct` | `inherit`)] | ||
Do: --track[=(direct|inherit)] | ||
Don't: --track[=(direct | inherit)] | ||
|
||
Parentheses are used for grouping: | ||
[(_<rev>_ | _<range>_)...] | ||
[(<rev>|<range>)...] | ||
(Any number of either <rev> or <range>. Parens are needed to make | ||
it clear that "..." pertains to both <rev> and <range>.) | ||
|
||
[(`-p` _<parent>_)...] | ||
[(-p <parent>)...] | ||
(Any number of option -p, each with one <parent> argument.) | ||
|
||
`git remote set-head` _<name>_ (`-a` | `-d` | _<branch>_) | ||
git remote set-head <name> (-a|-d|<branch>) | ||
(One and only one of "-a", "-d" or "<branch>" _must_ (no square | ||
brackets) be provided.) | ||
|
||
And a somewhat more contrived example: | ||
`--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]` | ||
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]] | ||
Here "=" is outside the brackets, because "--diff-filter=" is a | ||
valid usage. "*" has its own pair of brackets, because it can | ||
(optionally) be specified only when one or more of the letters is | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,10 @@ ifdef::backend-docbook[] | |
{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[] | ||
|
@@ -56,4 +60,20 @@ ifdef::backend-xhtml11[] | |
git-relative-html-prefix= | ||
[linkgit-inlinemacro] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this): "Jean-Noël Avila via GitGitGadget" <[email protected]> writes:
> +ifdef::backend-docbook[]
> +ifdef::doctype-manpage[]
> +[paradef-default]
> +#synopsis-style=template="verseparagraph",filter="sed -E 's!<[a-z-]+>!<emphasis>\\0</emphasis>!g' -E 's!([a-z-]+)!<literal>\\1</literal>!g'"
> +synopsis-style=template="verseparagraph",filter="perl -pe 's!([\[\] |()>]|^)([=+a-zA-Z0-9-:+=]+)!\\1<literal>\\2</literal>!g;s!(<\\;[a-zA-Z0-9-.]+>\\;)!<emphasis>\\1</emphasis>!g'"
> +#synopsis-style=template="verseparagraph"
This has three candidate definitions, but two are commented out?
> +endif::doctype-manpage[]
> +endif::backend-docbook[]
> +
> +ifdef::backend-xhtml11[]
> +[paradef-default]
> +synopsis-style=template="verseparagraph",filter="perl -pe 's!([\[\] |()>]|^)([+a-zA-Z0-9-:+=]+)!\\1<code>\\2</code>!g;s!(<\\;[a-zA-z0-9-.]+>\\;)!<em>\\1</em>!g'"
> +endif::backend-xhtml11[]
With this update, do we now assume that anybody who want to format
the documentation from source must have a minimally working Perl on
their $PATH? It probably is an OK requirement to have. |
||
<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[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Eric Sunshine wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Jean-Noël Avila wrote (reply to this):