Skip to content

Commit 16c9380

Browse files
committed
doc: check well-formedness of delimited sections
Having an empty line before each delimited sections is not required by asciidoc, but it is a safety measure that prevents generating malformed asciidoc when generating translated documentation. When a delimited section appears just after a paragraph, the asciidoc processor checks that the length of the delimited section header is different from the length of the paragraph. If it is not, the asciidoc processor will generate a title. In the original English documentation, this is not a problem because the authors always check the output of the asciidoc processor and fix the length of the delimited section header if it turns out to be the same as the paragraph length. However, this is not the case for translations, where the authors have no way to check the length of the delimited section header or the output of the asciidoc processor. This can lead to a section title that is not intended. Indeed, this test also checks that titles are correctly formed, that is, the length of the underline is equal to the length of the title (otherwise it would not be a title but a section header). Finally, this test checks that the delimited section are terminated within the same file. Signed-off-by: Jean-Noël Avila <[email protected]>
1 parent 1e633cb commit 16c9380

13 files changed

+32
-4
lines changed

Documentation/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,17 @@ $(LINT_DOCS_FSCK_MSGIDS): ../fsck.h fsck-msgids.adoc
497497
$(call mkdir_p_parent_template)
498498
$(QUIET_GEN)$(PERL_PATH) lint-fsck-msgids.perl \
499499
../fsck.h fsck-msgids.adoc $@
500-
501500
lint-docs-fsck-msgids: $(LINT_DOCS_FSCK_MSGIDS)
502501

502+
## Lint: delimited sections
503+
LINT_DOCS_DELIMITED_SECTIONS = $(patsubst %.adoc,.build/lint-docs/delimited-sections/%.ok,$(MAN_TXT))
504+
$(LINT_DOCS_DELIMITED_SECTIONS): lint-delimited-sections.perl
505+
$(LINT_DOCS_DELIMITED_SECTIONS): .build/lint-docs/delimited-sections/%.ok: %.adoc
506+
$(call mkdir_p_parent_template)
507+
$(QUIET_LINT_DELIMSEC)$(PERL_PATH) lint-delimited-sections.perl $< >$@
508+
.PHONY: lint-docs-delimited-sections
509+
lint-docs-delimited-sections: $(LINT_DOCS_DELIMITED_SECTIONS)
510+
503511
lint-docs-manpages:
504512
$(QUIET_GEN)./lint-manpages.sh
505513

@@ -528,6 +536,7 @@ lint-docs: lint-docs-fsck-msgids
528536
lint-docs: lint-docs-gitlink
529537
lint-docs: lint-docs-man-end-blurb
530538
lint-docs: lint-docs-man-section-order
539+
lint-docs: lint-docs-delimited-sections
531540
lint-docs: lint-docs-manpages
532541
lint-docs: lint-docs-meson
533542

Documentation/RelNotes/1.6.2.4.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ exec >/var/tmp/1
3737
echo O=$(git describe maint)
3838
O=v1.6.2.3-38-g318b847
3939
git shortlog --no-merges $O..maint
40+
---

Documentation/diff-format.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ if the file was renamed on any side of history. With
103103
followed by the name of the path in the merge commit.
104104

105105
Examples for `-c` and `--cc` without `--combined-all-paths`:
106+
106107
------------------------------------------------
107108
::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c
108109
::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh

Documentation/git-commit.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ variable (see linkgit:git-config[1]).
279279
+
280280
--
281281
It is a rough equivalent for:
282+
282283
------
283284
$ git reset --soft HEAD^
284285
$ ... do something else to come up with the right tree ...

Documentation/git-fast-import.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,11 @@ Marks must be declared (via `mark`) before they can be used.
579579
580580
The special case of restarting an incremental import from the
581581
current branch value should be written as:
582+
582583
----
583584
from refs/heads/branch^0
584585
----
586+
585587
The `^0` suffix is necessary as fast-import does not permit a branch to
586588
start from itself, and the branch is created in memory before the
587589
`from` command is even read from the input. Adding `^0` will force

Documentation/git-p4.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Clone
6666
~~~~~
6767
Generally, 'git p4 clone' is used to create a new Git directory
6868
from an existing p4 repository:
69+
6970
------------
7071
$ git p4 clone //depot/path/project
7172
------------

Documentation/git-rebase.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ In addition, the following pairs of options are incompatible:
687687
* --fork-point and --root
688688
689689
BEHAVIORAL DIFFERENCES
690-
-----------------------
690+
----------------------
691691

692692
`git rebase` has two primary backends: 'apply' and 'merge'. (The 'apply'
693693
backend used to be known as the 'am' backend, but the name led to

Documentation/git-svn.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,9 +1012,11 @@ branch.
10121012

10131013
If you do merge, note the following rule: 'git svn dcommit' will
10141014
attempt to commit on top of the SVN commit named in
1015+
10151016
------------------------------------------------------------------------
10161017
git log --grep=^git-svn-id: --first-parent -1
10171018
------------------------------------------------------------------------
1019+
10181020
You 'must' therefore ensure that the most recent commit of the branch
10191021
you want to dcommit to is the 'first' parent of the merge. Chaos will
10201022
ensue otherwise, especially if the first parent is an older commit on

Documentation/gitprotocol-http.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ Extra Parameter.
318318

319319

320320
Smart Service git-upload-pack
321-
------------------------------
321+
-----------------------------
322322
This service reads from the repository pointed to by `$GIT_URL`.
323323
324324
Clients MUST first perform ref discovery with

Documentation/gitsubmodules.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gitsubmodules - Mounting one repository inside another
88
SYNOPSIS
99
--------
1010
.gitmodules, $GIT_DIR/config
11+
1112
------------------
1213
git submodule
1314
git <command> --recurse-submodules
@@ -240,7 +241,7 @@ Workflow for a third party library
240241
241242
242243
Workflow for an artificially split repo
243-
--------------------------------------
244+
---------------------------------------
244245

245246
# Enable recursion for relevant commands, such that
246247
# regular commands recurse into submodules by default

0 commit comments

Comments
 (0)