Skip to content

Commit 029eff9

Browse files
jnavilagitster
authored andcommitted
doc: update the guidelines to reflect the current formatting rules
Signed-off-by: Jean-Noël Avila <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 974cdca commit 029eff9

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

Documentation/CodingGuidelines

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -738,78 +738,80 @@ Markup:
738738
_<new-branch-name>_
739739
_<template-directory>_
740740

741-
A placeholder is not enclosed in backticks, as it is not a literal.
742-
743741
When needed, use a distinctive identifier for placeholders, usually
744742
made of a qualification and a type:
745743
_<git-dir>_
746744
_<key-id>_
747745

748-
When literal and placeholders are mixed, each markup is applied for
749-
each sub-entity. If they are stuck, a special markup, called
750-
unconstrained formatting is required.
751-
Unconstrained formating for placeholders is __<like-this>__
752-
Unconstrained formatting for literal formatting is ++like this++
753-
`--jobs` _<n>_
754-
++--sort=++__<key>__
755-
__<directory>__++/.git++
756-
++remote.++__<name>__++.mirror++
746+
Git's Asciidoc processor has been tailored to treat backticked text
747+
as complex synopsis. When literal and placeholders are mixed, you can
748+
use the backtick notation which will take care of correctly typesetting
749+
the content.
750+
`--jobs <n>`
751+
`--sort=<key>`
752+
`<directory>/.git`
753+
`remote.<name>.mirror`
754+
`ssh://[<user>@]<host>[:<port>]/<path-to-git-repo>`
757755

758-
caveat: ++ unconstrained format is not verbatim and may expand
759-
content. Use Asciidoc escapes inside them.
756+
As a side effect, backquoted placeholders are correctly typeset, but
757+
this style is not recommended.
760758

761759
Synopsis Syntax
762760

763-
Syntax grammar is formatted neither as literal nor as placeholder.
761+
The synopsis (a paragraph with [synopsis] attribute) is automatically
762+
formatted by the toolchain and does not need typesetting.
764763

765764
A few commented examples follow to provide reference when writing or
766765
modifying command usage strings and synopsis sections in the manual
767766
pages:
768767

769768
Possibility of multiple occurrences is indicated by three dots:
770-
_<file>_...
769+
<file>...
771770
(One or more of <file>.)
772771

773772
Optional parts are enclosed in square brackets:
774-
[_<file>_...]
773+
[<file>...]
775774
(Zero or more of <file>.)
776775

777-
++--exec-path++[++=++__<path>__]
776+
An optional parameter needs to be typeset with unconstrained pairs
777+
[<repository>]
778+
779+
--exec-path[=<path>]
778780
(Option with an optional argument. Note that the "=" is inside the
779781
brackets.)
780782

781-
[_<patch>_...]
783+
[<patch>...]
782784
(Zero or more of <patch>. Note that the dots are inside, not
783785
outside the brackets.)
784786

785787
Multiple alternatives are indicated with vertical bars:
786-
[`-q` | `--quiet`]
787-
[`--utf8` | `--no-utf8`]
788+
[-q | --quiet]
789+
[--utf8 | --no-utf8]
788790

789791
Use spacing around "|" token(s), but not immediately after opening or
790792
before closing a [] or () pair:
791-
Do: [`-q` | `--quiet`]
792-
Don't: [`-q`|`--quiet`]
793+
Do: [-q | --quiet]
794+
Don't: [-q|--quiet]
793795

794796
Don't use spacing around "|" tokens when they're used to separate the
795797
alternate arguments of an option:
796-
Do: ++--track++[++=++(`direct`|`inherit`)]`
797-
Don't: ++--track++[++=++(`direct` | `inherit`)]
798+
Do: --track[=(direct|inherit)]
799+
Don't: --track[=(direct | inherit)]
798800

799801
Parentheses are used for grouping:
800-
[(_<rev>_ | _<range>_)...]
802+
[(<rev>|<range>)...]
801803
(Any number of either <rev> or <range>. Parens are needed to make
802804
it clear that "..." pertains to both <rev> and <range>.)
803805

804-
[(`-p` _<parent>_)...]
806+
[(-p <parent>)...]
805807
(Any number of option -p, each with one <parent> argument.)
806808

807-
`git remote set-head` _<name>_ (`-a` | `-d` | _<branch>_)
809+
git remote set-head <name> (-a|-d|<branch>)
808810
(One and only one of "-a", "-d" or "<branch>" _must_ (no square
809811
brackets) be provided.)
810812

811813
And a somewhat more contrived example:
812-
`--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]`
814+
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
813815
Here "=" is outside the brackets, because "--diff-filter=" is a
814816
valid usage. "*" has its own pair of brackets, because it can
815817
(optionally) be specified only when one or more of the letters is

0 commit comments

Comments
 (0)