From: Rich Salz Date: Fri, 21 Aug 2015 19:07:22 +0000 (-0400) Subject: simplify X-Git-Url: https://git.openssl.org/?p=openssl-web.git;a=commitdiff_plain;h=cd8935dc250abcc389ce1228fd73020346022392 simplify --- diff --git a/bin/mk-changelog b/bin/mk-changelog index 60135c9..18902d5 100755 --- a/bin/mk-changelog +++ b/bin/mk-changelog @@ -1,48 +1,34 @@ #! /usr/bin/perl -w use strict; -# Read whole input. -my $page; -{ - local $/; - $page .= ; -} - -# HTML entities. -$page =~ s|&|&|sg; -$page =~ s|<|<|sg; -$page =~ s|>|>|sg; - -# Make sub-headings. -$page =~ s|^.+?(Changes.+?\n+)|$1|s; -$page =~ s|(Changes between.+?)\n|\n

$1

\n
\n|sg;
-
-# Wrap it, and remove empty 

-$page = '
' . $page . '
'; -$page =~ s|
||g;
-
-# Make a TOC
 my $ctr = 0;
 my $toc;
 my $out;
 my $top = '  ';
-for (split /^/, $page) {
-    if ( /

/ ) { - my $name = $_; - $name =~ s|

(.*)

|$1|; - chop ($name); - $out .= '

' . $name . "$top

\n"; - $toc .= '
  • ' . $name . "
  • \n"; +my $skipping = 1; + +while ( ) { + chop; + # HTML entities. + s|&|&|sg; + s|<|<|sg; + s|>|>|sg; + if ( /^( Changes between.*)/ ) { + $out .= "
    \n" unless $skipping; + $skipping = 0; + $out .= "

    $1$top

    \n
    \n";
    +	$toc .= "  
  • $1
  • \n"; $ctr++; - } else { - $out .= $_; + } elsif ( ! $skipping ) { + $out .= $_ . "\n"; } } +$out .= "
    \n"; print "

    Table of contents

    \n"; -print "\n"; print $out; exit(0);