diff options
author | Daniel Santos <daniel.santos@pobox.com> | 2012-10-04 20:15:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-05 14:05:13 -0400 |
commit | e314ba3130940cb58b533b20969a6ee9b12435ed (patch) | |
tree | 36c158c32f0d108616c8ae6a943ef78d4e6245c8 /scripts/kernel-doc | |
parent | 654784284430bf2739985914b65e09c7c35a7273 (diff) |
kernel-doc: bugfix - empty line in Example section
If you have a section named "Example" that contains an empty line,
attempting to generate htmldocs give you the error:
/path/Documentation/DocBook/kernel-api.xml:3455: parser error : Opening and ending tag mismatch: programlisting line 3449 and para
</para><para>
^
/path/Documentation/DocBook/kernel-api.xml:3473: parser error : Opening and ending tag mismatch: para line 3467 and programlisting
</programlisting></informalexample>
^
/path/Documentation/DocBook/kernel-api.xml:3678: parser error : Opening and ending tag mismatch: programlisting line 3672 and para
</para><para>
^
/path/Documentation/DocBook/kernel-api.xml:3701: parser error : Opening and ending tag mismatch: para line 3690 and programlisting
</programlisting></informalexample>
^
unable to parse
/path/Documentation/DocBook/kernel-api.xml
Essentially, the script attempts to close a <programlisting> with a
closing tag for a <para> block. This patch corrects the problem by
simply not outputting anything extra when we're dumping pre-formatted
text, since the empty line will be rendered correctly anyway.
Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-x | scripts/kernel-doc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 2dea5f81baef..c7109ca40ba4 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -230,6 +230,7 @@ my $dohighlight = ""; | |||
230 | 230 | ||
231 | my $verbose = 0; | 231 | my $verbose = 0; |
232 | my $output_mode = "man"; | 232 | my $output_mode = "man"; |
233 | my $output_preformatted = 0; | ||
233 | my $no_doc_sections = 0; | 234 | my $no_doc_sections = 0; |
234 | my %highlights = %highlights_man; | 235 | my %highlights = %highlights_man; |
235 | my $blankline = $blankline_man; | 236 | my $blankline = $blankline_man; |
@@ -460,7 +461,9 @@ sub output_highlight { | |||
460 | 461 | ||
461 | foreach $line (split "\n", $contents) { | 462 | foreach $line (split "\n", $contents) { |
462 | if ($line eq ""){ | 463 | if ($line eq ""){ |
463 | print $lineprefix, local_unescape($blankline); | 464 | if (! $output_preformatted) { |
465 | print $lineprefix, local_unescape($blankline); | ||
466 | } | ||
464 | } else { | 467 | } else { |
465 | $line =~ s/\\\\\\/\&/g; | 468 | $line =~ s/\\\\\\/\&/g; |
466 | if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { | 469 | if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { |
@@ -643,10 +646,12 @@ sub output_section_xml(%) { | |||
643 | print "<title>$section</title>\n"; | 646 | print "<title>$section</title>\n"; |
644 | if ($section =~ m/EXAMPLE/i) { | 647 | if ($section =~ m/EXAMPLE/i) { |
645 | print "<informalexample><programlisting>\n"; | 648 | print "<informalexample><programlisting>\n"; |
649 | $output_preformatted = 1; | ||
646 | } else { | 650 | } else { |
647 | print "<para>\n"; | 651 | print "<para>\n"; |
648 | } | 652 | } |
649 | output_highlight($args{'sections'}{$section}); | 653 | output_highlight($args{'sections'}{$section}); |
654 | $output_preformatted = 0; | ||
650 | if ($section =~ m/EXAMPLE/i) { | 655 | if ($section =~ m/EXAMPLE/i) { |
651 | print "</programlisting></informalexample>\n"; | 656 | print "</programlisting></informalexample>\n"; |
652 | } else { | 657 | } else { |
@@ -949,10 +954,12 @@ sub output_blockhead_xml(%) { | |||
949 | } | 954 | } |
950 | if ($section =~ m/EXAMPLE/i) { | 955 | if ($section =~ m/EXAMPLE/i) { |
951 | print "<example><para>\n"; | 956 | print "<example><para>\n"; |
957 | $output_preformatted = 1; | ||
952 | } else { | 958 | } else { |
953 | print "<para>\n"; | 959 | print "<para>\n"; |
954 | } | 960 | } |
955 | output_highlight($args{'sections'}{$section}); | 961 | output_highlight($args{'sections'}{$section}); |
962 | $output_preformatted = 0; | ||
956 | if ($section =~ m/EXAMPLE/i) { | 963 | if ($section =~ m/EXAMPLE/i) { |
957 | print "</para></example>\n"; | 964 | print "</para></example>\n"; |
958 | } else { | 965 | } else { |
@@ -1028,10 +1035,12 @@ sub output_function_gnome { | |||
1028 | print "<simplesect>\n <title>$section</title>\n"; | 1035 | print "<simplesect>\n <title>$section</title>\n"; |
1029 | if ($section =~ m/EXAMPLE/i) { | 1036 | if ($section =~ m/EXAMPLE/i) { |
1030 | print "<example><programlisting>\n"; | 1037 | print "<example><programlisting>\n"; |
1038 | $output_preformatted = 1; | ||
1031 | } else { | 1039 | } else { |
1032 | } | 1040 | } |
1033 | print "<para>\n"; | 1041 | print "<para>\n"; |
1034 | output_highlight($args{'sections'}{$section}); | 1042 | output_highlight($args{'sections'}{$section}); |
1043 | $output_preformatted = 0; | ||
1035 | print "</para>\n"; | 1044 | print "</para>\n"; |
1036 | if ($section =~ m/EXAMPLE/i) { | 1045 | if ($section =~ m/EXAMPLE/i) { |
1037 | print "</programlisting></example>\n"; | 1046 | print "</programlisting></example>\n"; |