From 7d4d4cb4a21d4865efd30dfcfc93eb14d08da654 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 12 Aug 2012 08:54:21 -0400 Subject: Add links to ToC. --- diff --git a/scripts/MarkdownBook/Book.pm b/scripts/MarkdownBook/Book.pm index 3056a13..7693cb4 100644 --- a/scripts/MarkdownBook/Book.pm +++ b/scripts/MarkdownBook/Book.pm @@ -203,16 +203,22 @@ sub _do_gen_toc $toc .= "\n" if $toc ne ''; if (ref($section) =~ m/^MarkdownBook::Document/) { next if $section->type() eq 'index'; - $toc .= ' * '; + $toc .= ' * ['; $toc .= $section->id(); $toc .= ' '; $toc .= $section->title(); + $toc .= ']['; + $toc .= $section->file(); + $toc .= ']'; } elsif (ref($section) eq 'MarkdownBook::Section') { $toc .= ' ' x $section->level(); - $toc .= ($section->level() == 1 ? ' - ' : ' * '); + $toc .= ($section->level() == 1 ? ' - [' : ' * ['); $toc .= $section->number(); $toc .= ' '; $toc .= $section->title(); + $toc .= ']['; + $toc .= $section->id(); + $toc .= ']'; } } -- cgit v0.9.1