doc: update the guidelines to reflect the current formatting rules
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
974cdca345
commit
029eff9e34
@ -738,78 +738,80 @@ Markup:
|
|||||||
_<new-branch-name>_
|
_<new-branch-name>_
|
||||||
_<template-directory>_
|
_<template-directory>_
|
||||||
|
|
||||||
A placeholder is not enclosed in backticks, as it is not a literal.
|
|
||||||
|
|
||||||
When needed, use a distinctive identifier for placeholders, usually
|
When needed, use a distinctive identifier for placeholders, usually
|
||||||
made of a qualification and a type:
|
made of a qualification and a type:
|
||||||
_<git-dir>_
|
_<git-dir>_
|
||||||
_<key-id>_
|
_<key-id>_
|
||||||
|
|
||||||
When literal and placeholders are mixed, each markup is applied for
|
Git's Asciidoc processor has been tailored to treat backticked text
|
||||||
each sub-entity. If they are stuck, a special markup, called
|
as complex synopsis. When literal and placeholders are mixed, you can
|
||||||
unconstrained formatting is required.
|
use the backtick notation which will take care of correctly typesetting
|
||||||
Unconstrained formating for placeholders is __<like-this>__
|
the content.
|
||||||
Unconstrained formatting for literal formatting is ++like this++
|
`--jobs <n>`
|
||||||
`--jobs` _<n>_
|
`--sort=<key>`
|
||||||
++--sort=++__<key>__
|
`<directory>/.git`
|
||||||
__<directory>__++/.git++
|
`remote.<name>.mirror`
|
||||||
++remote.++__<name>__++.mirror++
|
`ssh://[<user>@]<host>[:<port>]/<path-to-git-repo>`
|
||||||
|
|
||||||
caveat: ++ unconstrained format is not verbatim and may expand
|
As a side effect, backquoted placeholders are correctly typeset, but
|
||||||
content. Use Asciidoc escapes inside them.
|
this style is not recommended.
|
||||||
|
|
||||||
Synopsis Syntax
|
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
|
A few commented examples follow to provide reference when writing or
|
||||||
modifying command usage strings and synopsis sections in the manual
|
modifying command usage strings and synopsis sections in the manual
|
||||||
pages:
|
pages:
|
||||||
|
|
||||||
Possibility of multiple occurrences is indicated by three dots:
|
Possibility of multiple occurrences is indicated by three dots:
|
||||||
_<file>_...
|
<file>...
|
||||||
(One or more of <file>.)
|
(One or more of <file>.)
|
||||||
|
|
||||||
Optional parts are enclosed in square brackets:
|
Optional parts are enclosed in square brackets:
|
||||||
[_<file>_...]
|
[<file>...]
|
||||||
(Zero or more of <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
|
(Option with an optional argument. Note that the "=" is inside the
|
||||||
brackets.)
|
brackets.)
|
||||||
|
|
||||||
[_<patch>_...]
|
[<patch>...]
|
||||||
(Zero or more of <patch>. Note that the dots are inside, not
|
(Zero or more of <patch>. Note that the dots are inside, not
|
||||||
outside the brackets.)
|
outside the brackets.)
|
||||||
|
|
||||||
Multiple alternatives are indicated with vertical bars:
|
Multiple alternatives are indicated with vertical bars:
|
||||||
[`-q` | `--quiet`]
|
[-q | --quiet]
|
||||||
[`--utf8` | `--no-utf8`]
|
[--utf8 | --no-utf8]
|
||||||
|
|
||||||
Use spacing around "|" token(s), but not immediately after opening or
|
Use spacing around "|" token(s), but not immediately after opening or
|
||||||
before closing a [] or () pair:
|
before closing a [] or () pair:
|
||||||
Do: [`-q` | `--quiet`]
|
Do: [-q | --quiet]
|
||||||
Don't: [`-q`|`--quiet`]
|
Don't: [-q|--quiet]
|
||||||
|
|
||||||
Don't use spacing around "|" tokens when they're used to separate the
|
Don't use spacing around "|" tokens when they're used to separate the
|
||||||
alternate arguments of an option:
|
alternate arguments of an option:
|
||||||
Do: ++--track++[++=++(`direct`|`inherit`)]`
|
Do: --track[=(direct|inherit)]
|
||||||
Don't: ++--track++[++=++(`direct` | `inherit`)]
|
Don't: --track[=(direct | inherit)]
|
||||||
|
|
||||||
Parentheses are used for grouping:
|
Parentheses are used for grouping:
|
||||||
[(_<rev>_ | _<range>_)...]
|
[(<rev>|<range>)...]
|
||||||
(Any number of either <rev> or <range>. Parens are needed to make
|
(Any number of either <rev> or <range>. Parens are needed to make
|
||||||
it clear that "..." pertains to both <rev> and <range>.)
|
it clear that "..." pertains to both <rev> and <range>.)
|
||||||
|
|
||||||
[(`-p` _<parent>_)...]
|
[(-p <parent>)...]
|
||||||
(Any number of option -p, each with one <parent> argument.)
|
(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
|
(One and only one of "-a", "-d" or "<branch>" _must_ (no square
|
||||||
brackets) be provided.)
|
brackets) be provided.)
|
||||||
|
|
||||||
And a somewhat more contrived example:
|
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
|
Here "=" is outside the brackets, because "--diff-filter=" is a
|
||||||
valid usage. "*" has its own pair of brackets, because it can
|
valid usage. "*" has its own pair of brackets, because it can
|
||||||
(optionally) be specified only when one or more of the letters is
|
(optionally) be specified only when one or more of the letters is
|
||||||
|
Reference in New Issue
Block a user