From c3f214e5f820d298129e558d64c10e8826bf84ef Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 3 Sep 2016 16:38:40 +0200 Subject: Add --omit-link-check option --- cli/context.cxx | 25 ++++++++++++++----------- cli/options.cli | 6 ++++++ cli/options.cxx | 11 +++++++++++ cli/options.hxx | 4 ++++ cli/options.ixx | 6 ++++++ 5 files changed, 41 insertions(+), 11 deletions(-) (limited to 'cli') diff --git a/cli/context.cxx b/cli/context.cxx index 6e2ac4c..1513e8a 100644 --- a/cli/context.cxx +++ b/cli/context.cxx @@ -2158,21 +2158,24 @@ end_toc () void context:: verify_id_ref () { - bool f (false); - - for (id_set_type::const_iterator i (ref_set.begin ()); - i != ref_set.end (); - ++i) + if (!options.omit_link_check ()) { - if (id_set.find (*i) == id_set.end ()) + bool f (false); + + for (id_set_type::const_iterator i (ref_set.begin ()); + i != ref_set.end (); + ++i) { - cerr << "error: no id for fragment link '#" << *i << "'" << endl; - f = true; + if (id_set.find (*i) == id_set.end ()) + { + cerr << "error: no id for fragment link '#" << *i << "'" << endl; + f = true; + } } - } - if (f) - throw generation_failed (); + if (f) + throw generation_failed (); + } id_set.clear (); ref_set.clear (); diff --git a/cli/options.cli b/cli/options.cli index a7e1cee..8b9ff5f 100644 --- a/cli/options.cli +++ b/cli/options.cli @@ -278,6 +278,12 @@ class options '\cb{h2}', etc)." }; + bool --omit-link-check + { + "Don't check that local fragment link references (\\l{#ref ...}) resolve + to ids." + }; + // Prologues. // std::vector --hxx-prologue diff --git a/cli/options.cxx b/cli/options.cxx index 823dcd4..1511b1c 100644 --- a/cli/options.cxx +++ b/cli/options.cxx @@ -610,6 +610,7 @@ options () link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), ixx_prologue_ (), @@ -743,6 +744,7 @@ options (int& argc, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), ixx_prologue_ (), @@ -879,6 +881,7 @@ options (int start, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), ixx_prologue_ (), @@ -1015,6 +1018,7 @@ options (int& argc, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), ixx_prologue_ (), @@ -1153,6 +1157,7 @@ options (int start, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), ixx_prologue_ (), @@ -1287,6 +1292,7 @@ options (::cli::scanner& s, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), ixx_prologue_ (), @@ -1475,6 +1481,9 @@ print_usage (::std::ostream& os, ::cli::usage_para p) << " 'h', and '2') to HTML heading (for example," << ::std::endl << " 'h1', 'h2', etc)." << ::std::endl; + os << "--omit-link-check Don't check that local fragment link references" << ::std::endl + << " (\\l{#ref ...}) resolve to ids." << ::std::endl; + os << "--hxx-prologue Insert at the beginning of the generated" << ::std::endl << " C++ header file." << ::std::endl; @@ -1700,6 +1709,8 @@ struct _cli_options_map_init _cli_options_map_["--html-heading-map"] = &::cli::thunk< options, std::map, &options::html_heading_map_, &options::html_heading_map_specified_ >; + _cli_options_map_["--omit-link-check"] = + &::cli::thunk< options, bool, &options::omit_link_check_ >; _cli_options_map_["--hxx-prologue"] = &::cli::thunk< options, std::vector, &options::hxx_prologue_, &options::hxx_prologue_specified_ >; diff --git a/cli/options.hxx b/cli/options.hxx index ed54bb2..f47fa3c 100644 --- a/cli/options.hxx +++ b/cli/options.hxx @@ -534,6 +534,9 @@ class options bool html_heading_map_specified () const; + const bool& + omit_link_check () const; + const std::vector& hxx_prologue () const; @@ -831,6 +834,7 @@ class options bool link_regex_trace_; std::map html_heading_map_; bool html_heading_map_specified_; + bool omit_link_check_; std::vector hxx_prologue_; bool hxx_prologue_specified_; std::vector ixx_prologue_; diff --git a/cli/options.ixx b/cli/options.ixx index 609d5a9..df89810 100644 --- a/cli/options.ixx +++ b/cli/options.ixx @@ -493,6 +493,12 @@ html_heading_map_specified () const return this->html_heading_map_specified_; } +inline const bool& options:: +omit_link_check () const +{ + return this->omit_link_check_; +} + inline const std::vector& options:: hxx_prologue () const { -- cgit v1.1