From 92be45d1be3633533971a8a6a292876d7d4b3cd3 Mon Sep 17 00:00:00 2001 From: Russ Rowan Date: Sun, 8 Jan 2006 12:56:15 -0500 Subject: [PATCH 1/2] Don't remove all blank lines. Just the first of a comment block. --- doc/tools/code2doc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/tools/code2doc b/doc/tools/code2doc index f5865b338..ff22bb7fc 100755 --- a/doc/tools/code2doc +++ b/doc/tools/code2doc @@ -8,7 +8,7 @@ print "Usage: $0 [FILE]\n\tParses [FILE], outputing the result to [FILE].out.\n" my ($input) = @ARGV; my ($output) = $input . '.out'; -my ($found, $start); +my ($found, $start, $first); print "CopyleftŠ 2006, Russ Rowan (See `COPYING')\n" and exit if $input eq '-v'; open FILEIN, "<$input" or print "File `$input' was not found.\n" and exit; open FILEOUT, ">$output" or print "Cannot open $output for writing.\n" and exit; @@ -17,10 +17,11 @@ while () { if ($found) { - next if $_ =~ /^\s+\*\s$/; + if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\*// if not $first; } if ($_ =~ /^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; } $_ =~ s/^(\s*)\s\*\s/$1/; $found = 'sorta' if $_ =~ s/\s*\*\/$//; + $first = undef; } elsif ($_ =~ /^\s*\/\*\*\s(.*)/) { @@ -29,6 +30,7 @@ while () if ($_ =~ s/\s*\*\/$//) { $found = 'sorta'; } else { $found = $.; } my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; } $_ = "$_\n$dash\n"; + $first = 1; } elsif ($_ =~ /\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s*\*\/$/) { From 33f373fbd53f53c69dd21dfd40773d8b43f00463 Mon Sep 17 00:00:00 2001 From: Russ Rowan Date: Sun, 8 Jan 2006 13:05:11 -0500 Subject: [PATCH 2/2] Get rid of extraneous spaces left in the output. I have no idea if asciidoc is sensitive enough to fail on these. --- doc/tools/code2doc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/tools/code2doc b/doc/tools/code2doc index ff22bb7fc..e572441d9 100755 --- a/doc/tools/code2doc +++ b/doc/tools/code2doc @@ -17,7 +17,7 @@ while () { if ($found) { - if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\*// if not $first; } + if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\s\*// if not $first; } if ($_ =~ /^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; } $_ =~ s/^(\s*)\s\*\s/$1/; $found = 'sorta' if $_ =~ s/\s*\*\/$//; @@ -32,9 +32,9 @@ while () $_ = "$_\n$dash\n"; $first = 1; } - elsif ($_ =~ /\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s*\*\/$/) + elsif ($_ =~ /\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s+\*\/$/) { - $_ =~ s/\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s*\*\/$/id[$1]::\n $2/; + $_ =~ s/\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s+\*\/$/id[$1]::\n $2/; $found = 'sorta'; } next if not $found; $found = undef if $found eq 'sorta';