From cd73ee1fe287ca77b44370760d72f7eb145f096e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Feb 2016 06:14:17 +0200 Subject: Implement links in TOC --- cli/context.cxx | 8 ++++++++ tests/toc/toc.html | 30 +++++++++++++++++------------- 2 files changed, 25 insertions(+), 13 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 = "" + pv + ""; + // Unwind heading levels that are deeper ("more sub") than us. // for (; tocs.size () != 1; tocs.pop_back ()) diff --git a/tests/toc/toc.html b/tests/toc/toc.html index 7da2f0c..5ff1670 100644 --- a/tests/toc/toc.html +++ b/tests/toc/toc.html @@ -1,29 +1,33 @@

Table of Contents

- - - + -
Preface +
Preface - - + +
About This Document
More Information
About This +Document
More Information
PART I
1Introduction +
PART I
1Introduction - - + +
1.1Architecture and Workflow
1.2Benefits
1.1Architecture and +Workflow
1.2Benefits
2Hello World +
2Hello World - - + - +
2.1Setup
2.2Compiling +
2.1Setup
2.2Compiling - - + +
2.2.1Compiling with GCC
2.2.2Compiling with Clang
2.2.1Compiling with +GCC
2.2.2Compiling +with Clang
2.3Conclusion
2.3Conclusion
-- cgit v1.1