diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2010-11-18 15:27:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-18 18:00:46 -0500 |
commit | 2b35f4d9cab365d37c7b34ce51e1c1144c312d05 (patch) | |
tree | 8c7edaadd7d469565b7c834fafebe506fef30851 /scripts | |
parent | 2811036a19624168ff9342bb85421dbbb1d2ac0d (diff) |
kernel-doc: escape xml for structs
scripts/kernel-doc was leaving unescaped '<', '>', and '&' in
generated xml output for structs. This causes xml parser errors.
Convert these characters to "<", ">", and "&" as needed
to prevent errors.
Most of the conversion was already done; complete it just before
output.
Documentation/DocBook/device-drivers.xml:41883: parser error : StartTag: invalid element name
#define INPUT_KEYMAP_BY_INDEX (1 << 0)
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel-doc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index cdb6dc1f6458..39580a5dc5df 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -5,7 +5,7 @@ use strict; | |||
5 | ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## | 5 | ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## |
6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## | 6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## |
7 | ## Copyright (C) 2001 Simon Huggins ## | 7 | ## Copyright (C) 2001 Simon Huggins ## |
8 | ## Copyright (C) 2005-2009 Randy Dunlap ## | 8 | ## Copyright (C) 2005-2010 Randy Dunlap ## |
9 | ## ## | 9 | ## ## |
10 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## | 10 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## |
11 | ## Copyright (c) 2000 MontaVista Software, Inc. ## | 11 | ## Copyright (c) 2000 MontaVista Software, Inc. ## |
@@ -453,7 +453,7 @@ sub output_highlight { | |||
453 | if ($output_mode eq "html" || $output_mode eq "xml") { | 453 | if ($output_mode eq "html" || $output_mode eq "xml") { |
454 | $contents = local_unescape($contents); | 454 | $contents = local_unescape($contents); |
455 | # convert data read & converted thru xml_escape() into &xyz; format: | 455 | # convert data read & converted thru xml_escape() into &xyz; format: |
456 | $contents =~ s/\\\\\\/&/g; | 456 | $contents =~ s/\\\\\\/\&/g; |
457 | } | 457 | } |
458 | # print STDERR "contents b4:$contents\n"; | 458 | # print STDERR "contents b4:$contents\n"; |
459 | eval $dohighlight; | 459 | eval $dohighlight; |
@@ -770,7 +770,11 @@ sub output_struct_xml(%) { | |||
770 | print $args{'type'} . " " . $args{'struct'} . " {\n"; | 770 | print $args{'type'} . " " . $args{'struct'} . " {\n"; |
771 | foreach $parameter (@{$args{'parameterlist'}}) { | 771 | foreach $parameter (@{$args{'parameterlist'}}) { |
772 | if ($parameter =~ /^#/) { | 772 | if ($parameter =~ /^#/) { |
773 | print "$parameter\n"; | 773 | my $prm = $parameter; |
774 | # convert data read & converted thru xml_escape() into &xyz; format: | ||
775 | # This allows us to have #define macros interspersed in a struct. | ||
776 | $prm =~ s/\\\\\\/\&/g; | ||
777 | print "$prm\n"; | ||
774 | next; | 778 | next; |
775 | } | 779 | } |
776 | 780 | ||
@@ -1701,6 +1705,8 @@ sub push_parameter($$$) { | |||
1701 | } | 1705 | } |
1702 | } | 1706 | } |
1703 | 1707 | ||
1708 | $param = xml_escape($param); | ||
1709 | |||
1704 | # strip spaces from $param so that it is one continous string | 1710 | # strip spaces from $param so that it is one continous string |
1705 | # on @parameterlist; | 1711 | # on @parameterlist; |
1706 | # this fixes a problem where check_sections() cannot find | 1712 | # this fixes a problem where check_sections() cannot find |