Skip to content

Commit c7e5e7e

Browse files
committed
doc: update the guidelines to reflect the current formatting rules
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
1 parent cbeef9c commit c7e5e7e

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
@@ -820,78 +820,80 @@ Markup:
820820
_<new-branch-name>_
821821
_<template-directory>_
822822

823-
A placeholder is not enclosed in backticks, as it is not a literal.
824-
825823
When needed, use a distinctive identifier for placeholders, usually
826824
made of a qualification and a type:
827825
_<git-dir>_
828826
_<key-id>_
829827

830-
When literal and placeholders are mixed, each markup is applied for
831-
each sub-entity. If they are stuck, a special markup, called
832-
unconstrained formatting is required.
833-
Unconstrained formating for placeholders is __<like-this>__
834-
Unconstrained formatting for literal formatting is ++like this++
835-
`--jobs` _<n>_
836-
++--sort=++__<key>__
837-
__<directory>__++/.git++
838-
++remote.++__<name>__++.mirror++
828+
Git's Asciidoc processor has been tailored to treat backticked text
829+
as complex synopsis. When literal and placeholders are mixed, you can
830+
use the backtick notation which will take care of correctly typesetting
831+
the content.
832+
`--jobs <n>`
833+
`--sort=<key>`
834+
`<directory>/.git`
835+
`remote.<name>.mirror`
836+
`ssh://[<user>@]<host>[:<port>]/<path-to-git-repo>`
839837

840-
caveat: ++ unconstrained format is not verbatim and may expand
841-
content. Use Asciidoc escapes inside them.
838+
As a side effect, backquoted placeholders are correctly typeset, but
839+
this style is not recommended.
842840

843841
Synopsis Syntax
844842

845-
Syntax grammar is formatted neither as literal nor as placeholder.
843+
The synopsis (a paragraph with [synopsis] attribute) is automatically
844+
formatted by the toolchain and does not need typesetting.
846845

847846
A few commented examples follow to provide reference when writing or
848847
modifying command usage strings and synopsis sections in the manual
849848
pages:
850849

851850
Possibility of multiple occurrences is indicated by three dots:
852-
_<file>_...
851+
<file>...
853852
(One or more of <file>.)
854853

855854
Optional parts are enclosed in square brackets:
856-
[_<file>_...]
855+
[<file>...]
857856
(Zero or more of <file>.)
858857

859-
++--exec-path++[++=++__<path>__]
858+
An optional parameter needs to be typeset with unconstrained pairs
859+
[<repository>]
860+
861+
--exec-path[=<path>]
860862
(Option with an optional argument. Note that the "=" is inside the
861863
brackets.)
862864

863-
[_<patch>_...]
865+
[<patch>...]
864866
(Zero or more of <patch>. Note that the dots are inside, not
865867
outside the brackets.)
866868

867869
Multiple alternatives are indicated with vertical bars:
868-
[`-q` | `--quiet`]
869-
[`--utf8` | `--no-utf8`]
870+
[-q | --quiet]
871+
[--utf8 | --no-utf8]
870872

871873
Use spacing around "|" token(s), but not immediately after opening or
872874
before closing a [] or () pair:
873-
Do: [`-q` | `--quiet`]
874-
Don't: [`-q`|`--quiet`]
875+
Do: [-q | --quiet]
876+
Don't: [-q|--quiet]
875877

876878
Don't use spacing around "|" tokens when they're used to separate the
877879
alternate arguments of an option:
878-
Do: ++--track++[++=++(`direct`|`inherit`)]`
879-
Don't: ++--track++[++=++(`direct` | `inherit`)]
880+
Do: --track[=(direct|inherit)]
881+
Don't: --track[=(direct | inherit)]
880882

881883
Parentheses are used for grouping:
882-
[(_<rev>_ | _<range>_)...]
884+
[(<rev>|<range>)...]
883885
(Any number of either <rev> or <range>. Parens are needed to make
884886
it clear that "..." pertains to both <rev> and <range>.)
885887

886-
[(`-p` _<parent>_)...]
888+
[(-p <parent>)...]
887889
(Any number of option -p, each with one <parent> argument.)
888890

889-
`git remote set-head` _<name>_ (`-a` | `-d` | _<branch>_)
891+
git remote set-head <name> (-a|-d|<branch>)
890892
(One and only one of "-a", "-d" or "<branch>" _must_ (no square
891893
brackets) be provided.)
892894

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

0 commit comments

Comments
 (0)