summaryrefslogtreecommitdiffstats
path: root/scripts/MarkdownBook
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/MarkdownBook')
-rw-r--r--scripts/MarkdownBook/Book.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/MarkdownBook/Book.pm b/scripts/MarkdownBook/Book.pm
index 09225df..a3d9eeb 100644
--- a/scripts/MarkdownBook/Book.pm
+++ b/scripts/MarkdownBook/Book.pm
@@ -189,10 +189,14 @@ sub subst_macros
sub _do_subst_macro
{
my ($self, $macro, @args) = @_;
+ my $sec;
if ($macro eq 'toc') {
return $self->_do_gen_toc();
} elsif ($macro eq 'sectlink') {
+ die('Invalid arguments to "sectlink" macro') if @args != 1;
+ $sec = $self->{'sections_by_id'}->{$args[0]};
+ return '[ยง ' . $sec->number() . '][' . $sec->id() . ']';
} else {
die("Unrecognized macro \"$macro\"");
}