summaryrefslogtreecommitdiff
path: root/cli/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-02-11 06:14:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-02-11 06:14:17 +0200
commitcd73ee1fe287ca77b44370760d72f7eb145f096e (patch)
tree4dbaaf0a6fbbcb22c65b0f838e03b0aa54f528e1 /cli/context.cxx
parent01314f53987e57c4fcb49fb86d3971bdb206857f (diff)
Implement links in TOC
Diffstat (limited to 'cli/context.cxx')
-rw-r--r--cli/context.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/context.cxx b/cli/context.cxx
index b923c4b..cd5d88c 100644
--- a/cli/context.cxx
+++ b/cli/context.cxx
@@ -1696,6 +1696,14 @@ format (semantics::scope& scope, string const& s, bool para)
{
char t (ph[0]);
+ if (pi.empty ())
+ {
+ cerr << "error: TOC heading '" << pv << "' has no id" << endl;
+ throw generation_failed ();
+ }
+
+ pv = "<a href=\"#" + pi + "\">" + pv + "</a>";
+
// Unwind heading levels that are deeper ("more sub") than us.
//
for (; tocs.size () != 1; tocs.pop_back ())