Skip to content

Commit

Permalink
doc: fix unmatched code fences in git-stripspace
Browse files Browse the repository at this point in the history
The asciidoctor renderer is more picky than classic asciidoc,
and insists that the start and end of a code fence be the
same size.

Found with this hacky perl script:

    foreach my $fn (@ARGV) {
      open(my $fh, '<', $fn);
      my ($fence, $fence_lineno, $prev);
      while (<$fh>) {
        chomp;
        if (/^----+$/) {
          if ($fence_lineno) {
            if ($_ ne $fence) {
              print "$fn:$fence_lineno:mismatched fence: ",
                    length($fence), " != ", length($_), "\n";
            }
            $fence_lineno = undef;
          }
	  # hacky check to avoid title-underlining
          elsif ($prev eq '' || $prev eq '+') {
            $fence = $_;
            $fence_lineno = $.;
          }
        }
        $prev = $_;
      }
    }

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 13, 2015
1 parent 282616c commit ad3967a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Documentation/git-stripspace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ EXAMPLES

Given the following noisy input with '$' indicating the end of a line:

--------
---------
|A brief introduction $
| $
|$
Expand All @@ -64,7 +64,7 @@ Given the following noisy input with '$' indicating the end of a line:

Use 'git stripspace' with no arguments to obtain:

--------
---------
|A brief introduction$
|$
|A new paragraph$
Expand All @@ -78,7 +78,7 @@ Use 'git stripspace' with no arguments to obtain:

Use 'git stripspace --strip-comments' to obtain:

--------
---------
|A brief introduction$
|$
|A new paragraph$
Expand Down

0 comments on commit ad3967a

Please sign in to comment.