From eabcf83deedd6524c57fd5468d9354c27aa7369c Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Thu, 26 Apr 2012 16:33:26 +0530 Subject: [PATCH] (minor) add titles to rendered HTML docs --- doc/mkdoc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/mkdoc b/doc/mkdoc index bce1013..72470d3 100755 --- a/doc/mkdoc +++ b/doc/mkdoc @@ -38,9 +38,10 @@ sub main { chomp(@ARGV = `find . -name "*.mkd" | cut -c3-`) if not @ARGV; @ARGV = grep { /./ } @ARGV; my @save = @ARGV; - my $css = join("", ); + my $css_block = join("", ); my %ct; # chapter tocs + my %title; my $mf = ''; my $fh; @@ -49,6 +50,7 @@ sub main { my $b = $1; if (/^(#+) (?:#(\S+) )?(.*)/) { + $title{$b} ||= $3; if ( length($1) == 1 ) { $ct{$b} .= "\n"; $ct{$b} .= " * [$3][$b]\n"; @@ -80,6 +82,9 @@ sub main { $mkd =~ /^(?:.*\/)?([^\/]+)\.mkd$/; my $b = $1; + my $css = $css_block; + $css =~ s/%TITLE/$title{$b} || $b/e; + open($fh, ">", "../html/$b.html") and print $fh $css and close $fh; @@ -95,7 +100,9 @@ sub main { __DATA__ - + +

master TOC