From: <no...@so...> - 2010-10-31 13:28:27
|
Update of /cvsroot/ijbswa/current/utils In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv11704/utils Modified Files: changelog2doc.pl Log Message: Add support for the new ChangeLog format. While the generated markup looks somewhat reasonable, it hasn't actually been validated yet. Index: changelog2doc.pl =================================================================== RCS file: /cvsroot/ijbswa/current/utils/changelog2doc.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- changelog2doc.pl 31 Oct 2010 13:27:03 -0000 1.5 +++ changelog2doc.pl 31 Oct 2010 13:28:19 -0000 1.6 @@ -25,29 +25,59 @@ next unless $section_reached; next if /^\s*$/; - if (/^-/) { + if (/^(\s*)-/) { + my $indentation = length($1); + if ($i > 1 and $entries[$i]{indentation} > $indentation) { + $entries[$i]{last_list_item} = 1; + } $i++; $entries[$i]{description} = ''; + $entries[$i]{indentation} = $indentation; + } + if (/:\s*$/) { + $entries[$i]{list_header} = 1; } - s@^-?\s*@@; + + s@^\s*-?\s*@@; $entries[$i]{description} .= $_; } + if ($entries[$i]{indentation} != 0) { + $entries[$i]{last_list_item} = 1; + } print "Parsed " . @entries . " entries.\n"; } sub create_listitem_markup($) { my $entry = shift; my $description = $entry->{description}; + my $markup = ''; + my $default_lws = ' '; + my $lws = $default_lws x ($entry->{indentation} ? 2 : 1); chomp $description; - $description =~ s@\n@\n @g; - return " <listitem>\n" . - " <para>\n" . - " " . $description . "\n" . - " </para>\n" . - " </listitem>\n"; + $description =~ s@\n@\n ${lws}@g; + + $markup .= $lws . "<listitem>\n" . + $lws . " <para>\n"; + + $markup .= $lws . " " . $description . "\n"; + + if (defined $entry->{list_header}) { + $markup .= $lws . " <itemizedlist>\n"; + + } else { + if (defined $entry->{last_list_item}) { + $markup .= $lws . " </para>\n"; + $markup .= $lws . "</itemizedlist>\n"; + $lws = $default_lws; + } + $markup .= $lws . " </para>\n" . + $lws . "</listitem>\n"; + } + + return $markup; } sub wrap_in_para_itemlist_markup($) { |