summaryrefslogtreecommitdiffstats
path: root/scripts/MarkdownBook/Book.pm
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-08-12 08:54:21 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-08-12 08:54:21 (EDT)
commit7d4d4cb4a21d4865efd30dfcfc93eb14d08da654 (patch)
tree6d6c501b49d39ad2066419cb6a1e0d48a5f3629d /scripts/MarkdownBook/Book.pm
parent14388d68632fc2566d3590e8d1d3fdf44d9895f3 (diff)
Add links to ToC.
Diffstat (limited to 'scripts/MarkdownBook/Book.pm')
-rw-r--r--scripts/MarkdownBook/Book.pm10
1 files changed, 8 insertions, 2 deletions
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 .= ']';
}
}