File tree 3 files changed +30
-4
lines changed
3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ sub postprocess_synopsis {
382
382
383
383
sub reformat_syntax {
384
384
# commands to be ignored:
385
- if (m / ^\. (?:PD|hy|ad|\s |$ )/ ) {
385
+ if (m / ^\. (?:PD|hy|ad|ft|fi| \s |$ )/ ) {
386
386
$_ = ' ' ;
387
387
return
388
388
}
@@ -703,13 +703,16 @@ sub read_version {
703
703
nextline() if (section_title && $is_synopsis );
704
704
705
705
706
- do {
706
+ do {{
707
+ PARSELINE:
708
+
707
709
if ($in_rawblock ) {
708
- if (m / ^\. (?:fi|cx)/ ) {
710
+ if (m / ^\. (?:fi|SH| cx)/ ) {
709
711
# code block ends
710
712
$in_rawblock = 0;
711
713
print " </code></pre>\n " if $code_formatting ;
712
714
print " \n " if m / ^\. cx/ ;
715
+ redo if m / ^\. SH/ ; # .nf sections can be ended with .SH, but we still need to print the new section title too
713
716
} elsif ($code_formatting ) {
714
717
# inside code block with limited html formatting
715
718
if ($in_rawblock == 2) {
@@ -768,7 +771,7 @@ sub read_version {
768
771
print
769
772
}
770
773
771
- } while (nextline(1));
774
+ }} while (nextline(1));
772
775
773
776
774
777
# Paste section which haven't matched anything yet:
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ . $( dirname " $0 " ) /init.sh
3
+
4
+ # .nf code blocks may be ended with a new section title (.SH).
5
+
6
+ output=" $( conv code.roff) "
7
+
8
+ expectedFragment=
9
+ expectedFragment=" ${expectedFragment} ^# Unterminated\b.*"
10
+ expectedFragment=" ${expectedFragment} ^ +my\b.*"
11
+ expectedFragment=" ${expectedFragment} ^ +code\b.*"
12
+ expectedFragment=" ${expectedFragment} ^# Terminator*"
13
+
14
+ assertRegex " $output " " /$expectedFragment /ms"
15
+
16
+
17
+ success
Original file line number Diff line number Diff line change @@ -34,3 +34,9 @@ cm-output1
34
34
cm-output2 \\" not a comment
35
35
.cx
36
36
text 1
37
+ .SH UNTERMINATED
38
+ .nf
39
+ my
40
+ code
41
+ .SH TERMINATOR
42
+ ttt
You can’t perform that action at this time.
0 commit comments