From c0f12961b11ab4f8ec839c911dd5d4dff03a7092 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 12 Aug 2012 09:51:18 -0400 Subject: Implement "sectlink" macro. --- (limited to 'scripts') 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\""); } -- cgit v0.9.1