diff options
-rw-r--r-- | cli/context.cxx | 334 | ||||
-rw-r--r-- | cli/context.hxx | 1 | ||||
-rw-r--r-- | cli/generator.cxx | 59 | ||||
-rw-r--r-- | cli/latex.cxx | 372 | ||||
-rw-r--r-- | cli/latex.hxx | 14 | ||||
-rw-r--r-- | cli/options.cli | 67 | ||||
-rw-r--r-- | cli/options.cxx | 450 | ||||
-rw-r--r-- | cli/options.hxx | 129 | ||||
-rw-r--r-- | cli/options.ixx | 228 |
9 files changed, 1485 insertions, 169 deletions
diff --git a/cli/context.cxx b/cli/context.cxx index 3715efa..4d858a6 100644 --- a/cli/context.cxx +++ b/cli/context.cxx @@ -94,6 +94,42 @@ namespace "xor", "xor_eq" }; + + static string + latex_section (map<char, string> const& sm, char t) + { + string s; + typedef map<char, string> map; + map::const_iterator mi (sm.find (t)); + + if (mi == sm.end ()) + { + switch (t) + { + case '0': s = "chapter*"; break; + case '1': s = "chapter"; break; + case 'H': s = "part"; break; + case 'h': s = "section"; break; + case '2': s = "subsection"; break; + } + } + else + s = mi->second; + return s; + } + + static string& + replace_all (string& s, string const& search, string const& replace, + size_t pos = 0) + { + for (; (pos = s.find (search, pos)) != string::npos; + pos += replace.size ()) + { + s.replace (pos, search.size (), replace); + } + return s; + } + } context:: @@ -454,6 +490,11 @@ format_line (output_type ot, string& r, const char* l, size_t n) r += " "; break; } + case ot_latex: + { + r += '~'; + break; + } case ot_man: { r += "\\ "; @@ -471,6 +512,7 @@ format_line (output_type ot, string& r, const char* l, size_t n) switch (ot) { case ot_plain: + case ot_latex: { r += "--"; break; @@ -506,6 +548,14 @@ format_line (output_type ot, string& r, const char* l, size_t n) r += "<br/>"; break; } + case ot_latex: + { + if (!r.empty () && r[r.size () - 1] != '\n') + r += '\n'; + + r += "\\\\"; + break; + } case ot_man: { if (!r.empty () && r[r.size () - 1] != '\n') @@ -528,6 +578,7 @@ format_line (output_type ot, string& r, const char* l, size_t n) { case ot_plain: break; case ot_html: + case ot_latex: case ot_man: { if (i + 1 < n) // More text in this paragraph? @@ -771,6 +822,11 @@ format_line (output_type ot, string& r, const char* l, size_t n) { switch (ot) { + case ot_latex: + { + r += "\\textbackslash{}"; + break; + } case ot_man: { r += "\\e"; @@ -796,7 +852,19 @@ format_line (output_type ot, string& r, const char* l, size_t n) } case '}': { - r += '}'; + switch (ot) + { + case ot_latex: + { + r += "\\}"; + break; + } + default: + { + r += '}'; + break; + } + } break; } case '|': @@ -889,6 +957,67 @@ format_line (output_type ot, string& r, const char* l, size_t n) break; } + case ot_latex: + { + if (s & note) + { + r += "\\footnote{"; + } + else if (s & link) + { + r += '\\'; + + // It might be useful to include the man section into the regex + // somehow. + // + string t (link_section.empty () + ? link_target + : link_target + options.latex_output_suffix ()); + + bool is_internal (true); + + if ( link_target[0] == '#' ) + { + r += "hyperref["; + } + else + { + is_internal = false; + r += "href{"; + if ( link_target.compare(0, 7, "http://") != 0 && + link_target.compare(0, 8, "https://") != 0) + { + r += "run:"; + } + } + + string pt (process_link_target (t)); + + if (pt.empty ()) + { + cerr << "error: link '" << t << "' became empty" << endl; + throw generation_failed (); + } + + if ( is_internal ) + r += string (pt, 1, string::npos) + "]{"; + else + r += pt + "}{"; + } + else + { + if (s & code) + r += "\\texttt{"; + + if (s & itlc) + r += "\\emph{"; + + if (s & bold) + r += "\\textbf{"; + } + + break; + } case ot_man: { if ((s & note) != 0) @@ -931,6 +1060,43 @@ format_line (output_type ot, string& r, const char* l, size_t n) r += '.'; break; } + case '-': + { + if (ot == ot_latex && i + 1 < n && l[i + 1] == '-') + r += "-{}"; + else + r += c; + break; + } + case '^': + { + if (ot == ot_latex) + r += "\\textasciicircum{}"; + else + r += c; + break; + } + case '~': + { + if (ot == ot_latex) + r += "\\textasciitilde{}"; + else + r += c; + break; + } + case '#': + case '$': + case '%': + case '&': + case '_': + case '{': + { + if (ot == ot_latex) + r += string (1, '\\') + c; + else + r += c; + break; + } case '}': { if (!spans.empty ()) @@ -1047,6 +1213,46 @@ format_line (output_type ot, string& r, const char* l, size_t n) break; } + case ot_latex: + { + if ((s & note) != 0) + { + r += "}"; + } + else if ((s & link) != 0) + { + if (link_empty) + { + if (link_section.empty ()) + r += link_target; + else + { + r += "\\texttt{\\textbf{"; + r += link_target + "(" + link_section + ")"; + r += "}}"; + } + } + + r += "}"; + } + else + { + if (s & bold) + r += "}"; + + if (s & itlc) + r += "}"; + + if (s & code) + { + size_t cb (r.rfind("\\texttt{", string::npos, 8)); + replace_all(r, string (1, '\''), string ("\\textquotesingle{}", 18), cb); + r += "}"; + } + } + + break; + } case ot_man: { assert ((s & note) == 0); @@ -1107,6 +1313,11 @@ format_line (output_type ot, string& r, const char* l, size_t n) break; } + else if (ot == ot_latex) + { + r += "\\}"; + break; + } } // Fall through. default: @@ -1226,6 +1437,40 @@ html_margin (string& v) return os.str (); } +// The same idea except there are no margins. So we just strip "\\\\" +// +static void +latex_margin (string& v) +{ + size_t top (0), bot (0); + + const char* b (v.c_str ()); + const char* e (v.c_str () + v.size ()); + + for (; e - b >= 2 && strncmp (b, "\\\\", 2) == 0; ++top) + { + b += 2; + + if (b != e && *b == '\n') // Remove following newline, if any. + ++b; + } + + for (; e - b >= 2 && strncmp (e - 2, "\\\\", 2) == 0; ++bot) + { + e -= 2; + + if (e != b && *(e - 1) == '\n') // Remove preceding newline, if any. + --e; + } + + if (top != 0 || bot != 0) + { + string t; + t.swap (v); + v.assign (b, e - b); + } +} + // The same idea except there are no margins. So we just strip .br. // static void @@ -1337,6 +1582,7 @@ format (semantics::scope& scope, string const& s, bool para) { case ot_plain: break; case ot_html: + case ot_latex: { // Different "newline protocol" inside TOC. // @@ -1531,9 +1777,10 @@ format (semantics::scope& scope, string const& s, bool para) k == block::pre ); break; case block::note: good = (k == block::text || k == block::pre || - (ot == ot_html && (k == block::ul || - k == block::ol || - k == block::dl))); break; + ((ot == ot_html || ot == ot_latex) + && (k == block::ul || + k == block::ol || + k == block::dl))); break; case block::text: good = (k != block::li); break; case block::pre: assert (false); } @@ -1812,6 +2059,26 @@ format (semantics::scope& scope, string const& s, bool para) break; } + case ot_latex: + { + // Separate paragraphs with a blank line. + // + if (!first) + v += "\n\n"; + + if (k == block::pre) + { + v += "\\begin{verbatim}\n"; + v.append (l, n); + v += "\n\\end{verbatim}"; + } + else + { + format_line (ot, v, l, n); + } + + break; + } case ot_man: { if (b.para) @@ -2019,6 +2286,7 @@ format (semantics::scope& scope, string const& s, bool para) break; } + case ot_latex: break; case ot_man: break; } } @@ -2213,6 +2481,59 @@ format (semantics::scope& scope, string const& s, bool para) break; } + case ot_latex: + { + if (!v.empty ()) + v += "\n\n"; + + switch (pb.kind) + { + case block::h: + { + char t (ph[0]); + + string label; + string s (latex_section( options.latex_section_map (), t)); + + if (!pi.empty ()) + label = "\\label{" + pi + '}'; + + v += '\\' + s + '{' + label + pv + '}'; + + break; + } + case block::ul: v += "\\begin{itemize}\n" + pv + "\n\\end{itemize}"; break; + case block::ol: v += "\\begin{enumerate}\n" + pv + "\n\\end{enumerate}"; break; + case block::dl: v += "\\begin{description}\n" + pv + "\n\\end{description}"; break; + case block::li: + { + latex_margin (pv); // Strip leading/trailing newline + + if (b.kind == block::dl) + { + latex_margin (ph); // Strip leading/trailing newline + + v += "\\item[{" + ph + "}] " + pv; + } + else + v += "\\item " + pv; + + break; + } + case block::note: + { + v += "\\begin{tcolorbox}\n"; + v += pv; + v += "\n\\end{tcolorbox}\n"; + + break; + } + case block::text: + case block::pre: assert (false); + } + + break; + } case ot_man: { // Seeing that we always write a macro, one newline is enough. @@ -2305,6 +2626,10 @@ start_toc () tocs.push_back (toc_entry ('\0')); return " <table class=\"toc\">"; } + case ot_latex: + { + return "\\tableofcontents{}\n"; + } case ot_man: break; } @@ -2346,6 +2671,7 @@ end_toc () v += " </table>"; return v; } + case ot_latex: break; case ot_man: break; } diff --git a/cli/context.hxx b/cli/context.hxx index a076c17..6c88929 100644 --- a/cli/context.hxx +++ b/cli/context.hxx @@ -78,6 +78,7 @@ public: { ot_plain, ot_html, + ot_latex, ot_man }; diff --git a/cli/generator.cxx b/cli/generator.cxx index 33f3b46..b27a936 100644 --- a/cli/generator.cxx +++ b/cli/generator.cxx @@ -23,6 +23,7 @@ #include <cli/man.hxx> #include <cli/html.hxx> +#include <cli/latex.hxx> #include <cli/txt.hxx> #include <cli/context.hxx> @@ -146,9 +147,10 @@ generate (options& ops, semantics::cli_unit& unit, path const& p) bool gen_cxx (ops.generate_cxx ()); bool gen_man (ops.generate_man ()); bool gen_html (ops.generate_html ()); + bool gen_latex (ops.generate_latex ()); bool gen_txt (ops.generate_txt ()); - if (!gen_cxx && !gen_man && !gen_html && !gen_txt) + if (!gen_cxx && !gen_man && !gen_html && !gen_latex && !gen_txt) gen_cxx = true; if (ops.stdout_ ()) @@ -159,9 +161,9 @@ generate (options& ops, semantics::cli_unit& unit, path const& p) throw failed (); } - if ((gen_man && gen_html) || - (gen_man && gen_txt) || - (gen_html && gen_txt)) + if ((gen_man && (gen_html || gen_latex || gen_txt)) || + (gen_html && (gen_latex || gen_txt)) || + (gen_latex && gen_txt)) { cerr << "error: --stdout cannot only be used with one output format" << endl; @@ -516,6 +518,55 @@ generate (options& ops, semantics::cli_unit& unit, path const& p) ctx.verify_id_ref (); } + // LaTeX output + // + if (gen_latex) + { + ofstream latex; + + if (!ops.stdout_ ()) + { + // May have to update link derivation in format_line() if changing + // this. + // + path latex_path (pfx + base + sfx + ops.latex_suffix ()); + + if (!ops.output_dir ().empty ()) + latex_path = path (ops.output_dir ()) / latex_path; + + latex.open (latex_path.string ().c_str ()); + + if (!latex.is_open ()) + { + cerr << "error: unable to open '" << latex_path << "' in write mode" + << endl; + throw failed (); + } + + auto_rm.add (latex_path); + } + + // The explicit cast helps VC++ 8.0 overcome its issues. + // + ostream& os (ops.stdout_ () ? cout : static_cast<ostream&> (latex)); + context ctx (os, context::ot_latex, unit, ops); + + for (bool first (true); first || ctx.toc; first = false) + { + append (ctx, ops.latex_prologue (), ops.latex_prologue_file ()); + generate_latex (ctx); + append (ctx, ops.latex_epilogue (), ops.latex_epilogue_file ()); + + if (ctx.toc) + { + assert (first); // Second run should end in non-TOC mode. + ctx.toc++; // TOC phase after restart. + } + } + + ctx.verify_id_ref (); + } + // txt output // if (gen_txt) diff --git a/cli/latex.cxx b/cli/latex.cxx new file mode 100644 index 0000000..1003229 --- /dev/null +++ b/cli/latex.cxx @@ -0,0 +1,372 @@ +// file : cli/latex.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include <vector> +#include <iostream> + +#include <cli/latex.hxx> + +using namespace std; + +namespace +{ + static string + escape_latex (string const& s) + { + string r; + r.reserve (s.size ()); + + for (size_t i (0), n (s.size ()); i < n; ++i) + { + switch (s[i]) + { + case '#': + case '$': + case '%': + case '&': + case '_': + case '{': + case '}': + { + r += string (1, '\\') + s[i]; + break; + } + case '-': + { + if (i + 1 < n && s[i + 1] == '-') + r += "-{}"; + else + r += s[i]; + break; + } + case '\\': + { + r += "\\textbackslash{}"; + break; + } + case '^': + { + r += "\\textasciicircum{}"; + break; + } + case '~': + { + r += "\\textasciitilde{}"; + break; + } + default: + { + r += s[i]; + break; + } + } + } + + return r; + } + + static void + wrap_lines (ostream& os, const string& d, size_t indent) + { + size_t lim (78 - indent); + string ind (indent, ' '); + + bool nl (true); // True if last written to os character is a newline. + + size_t b (0), e (0), i (0); + for (size_t n (d.size ()); i < n; ++i) + { + // First handle \begin{verbatim}. + // + if (d.compare (i, 16, "\\begin{verbatim}") == 0) + { + // Write what might have already accumulated. + // + if (b != i) + { + if (nl) + os << ind; + + os << string (d, b, i - b); + nl = false; + } + + // Output everything until (and including) closing \end{verbatim} as is. + // + e = d.find ("\\end{verbatim}", i + 16); + assert (e != string::npos); + e += 17; // Now points past '}'. + + if (nl) + os << ind; + + os << string (d, i, e - i); + + b = e; + i = e - 1; // For ++i in loop header. + nl = false; + continue; + } + + if (d[i] == ' ' || d[i] == '\n') + e = i; + + if (d[i] == '\n' || (i - b >= lim && e != b)) + { + if (nl && b != e) + os << ind; + + os << string (d, b, e - b) << endl; + + b = e = e + 1; + nl = true; + } + } + + // Write the last line. + // + if (b != i) + { + if (nl) + os << ind; + + os << string (d, b, i - b); + } + } + + struct doc: traversal::doc, context + { + doc (context& c, class_doc_type cd, bool& l) + : context (c), cd_ (cd), list_ (l) {} + + virtual void + traverse (type& ds) + { + if (ds.name ().compare (0, 3, "doc") != 0) // Ignore doc variables. + return; + + // n = 1 - common doc string + // n = 2 - arg string, common doc string + // n > 2 - arg string, short string, long string + // + size_t n (ds.size ()); + const string& d ( + n == 1 + ? (cd_ == cd_short ? first_sentence (ds[0]) : ds[0]) + : (n == 2 + ? (cd_ == cd_short ? first_sentence (ds[1]) : ds[1]) + : ds[cd_ == cd_short ? 1 : 2])); + + std::set<string> arg_set; + if (n > 1) + translate_arg (ds[0], arg_set); + + string s ( + format (ds.scope (), translate (d, arg_set), true)); + + if (s.empty ()) + return; + + if (list_) + { + os << "\\end{description}" << endl + << endl; + list_ = false; + } + + wrap_lines (os, s, 0); // TOC mode does its own thing. + + if (!toc) // TOC mode does its own thing. + os << endl + << endl; + } + + private: + class_doc_type cd_; + bool& list_; // True if we are currently in description list. + }; + + struct option: traversal::option, context + { + option (context& c, class_doc_type cd, bool& l) + : context (c), cd_ (cd), list_ (l) {} + + virtual void + traverse (type& o) + { + using semantics::names; + + semantics::doc_strings const& doc (o.doc ()); + + if (options.suppress_undocumented () && doc.empty ()) + return; + + if (toc) + return; // No option documentation in the TOC mode. + + if (!list_) + { + os << "\\begin{description}" << endl; + list_ = true; + } + else + os << endl; // Separate from the previous description. + + names& n (o.named ()); + string option_label; + + option_label += "\\texttt{\\textbf{"; + + for (names::name_iterator i (n.name_begin ()); i != n.name_end (); ++i) + { + if (i != n.name_begin ()) + option_label += "}}|\\texttt{\\textbf{"; + + option_label += escape_latex (*i); + } + + option_label += "}}"; + + string type (o.type ().name ()); + + std::set<string> arg_set; + + if (type != "bool" || doc.size () >= 3) + { + string s ( + translate_arg ( + doc.size () > 0 ? doc[0] : string ("<arg>"), arg_set)); + + option_label += ' ' + format (o.scope (), s, false); + } + + os << "\\item[{" << option_label << "}] "; + + string d; + if (type == "bool" && doc.size () < 3) + { + if (doc.size () > 1) + d = doc[cd_ == cd_short ? 0 : 1]; + else if (doc.size () > 0) + d = (cd_ == cd_short ? first_sentence (doc[0]) : doc[0]); + } + else + { + if (doc.size () > 2) + d = doc[cd_ == cd_short ? 1 : 2]; + else if (doc.size () > 1) + d = (cd_ == cd_short ? first_sentence (doc[1]) : doc[1]); + } + + // Format the documentation string. + // + d = format (o.scope (), translate (d, arg_set), false); + + wrap_lines (os, d, 0); + os << endl; + } + + private: + class_doc_type cd_; + bool& list_; // True if we are currently in description list. + }; + + // + // + struct class_: traversal::class_, context + { + class_ (context& c, bool& l): context (c), list_ (l), base_ (false) + { + *this >> inherits_ >> *this; + } + + virtual void + traverse (type& c) + { + class_doc_type cd (class_doc (c)); + + if (cd == cd_exclude || (base_ && cd == cd_exclude_base)) + return; + + if (!options.exclude_base () && !options.include_base_last ()) + { + bool ob (base_); + base_ = true; + inherits (c); + base_ = ob; + } + + doc dc (*this, cd, list_); + option op (*this, cd, list_); + traversal::names n; + n >> dc; + n >> op; + names (c, n); + + if (!options.exclude_base () && options.include_base_last ()) + { + bool ob (base_); + base_ = true; + inherits (c); + base_ = ob; + } + } + + private: + bool& list_; + bool base_; + traversal::inherits inherits_; + }; +} + +void +generate_latex (context& ctx) +{ + bool list (false); + + traversal::cli_unit unit; + traversal::names unit_names; + traversal::namespace_ ns; + doc dc (ctx, cd_default, list); + class_ cl (ctx, list); + unit >> unit_names; + unit_names >> dc; + unit_names >> ns; + unit_names >> cl; + + traversal::names ns_names; + ns >> ns_names; + ns_names >> dc; + ns_names >> ns; + ns_names >> cl; + + if (ctx.options.class_ ().empty ()) + unit.dispatch (ctx.unit); + else + { + for (vector<string>::const_iterator i (ctx.options.class_ ().begin ()); + i != ctx.options.class_ ().end (); ++i) + { + string n (*i); + + // Strip leading :: if present. + // + if (n.size () > 2 && n[0] == ':' && n[1] == ':') + n = string (n, 2, string::npos); + + if (semantics::class_* c = ctx.unit.lookup<semantics::class_> ("", n)) + cl.traverse (*c); + else + { + cerr << "error: class '" << *i << "' not found" << endl; + throw generation_failed (); + } + } + } + + if (list) + ctx.os << "\\end{description}" << endl + << endl; +} diff --git a/cli/latex.hxx b/cli/latex.hxx new file mode 100644 index 0000000..4b48eb6 --- /dev/null +++ b/cli/latex.hxx @@ -0,0 +1,14 @@ +// file : cli/latex.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef CLI_LATEX_HXX +#define CLI_LATEX_HXX + +#include <cli/context.hxx> + +void +generate_latex (context&); + +#endif // CLI_LATEX_HXX diff --git a/cli/options.cli b/cli/options.cli index 8781bc6..ace48d0 100644 --- a/cli/options.cli +++ b/cli/options.cli @@ -159,7 +159,8 @@ class options bool --generate-cxx { "Generate C++ code. If neither \cb{--generate-man}, \cb{--generate-html}, - nor \cb{--generate-txt} is specified, this mode is assumed by default." + \cb{--generate-latex} nor \cb{--generate-txt} is specified, this mode is + assumed by default." }; bool --generate-man @@ -172,6 +173,11 @@ class options "Generate documentation in the HTML format." }; + bool --generate-latex + { + "Generate documentation in the LaTeX format." + }; + bool --generate-txt { "Generate documentation in the plain text format, similar to usage." @@ -270,20 +276,20 @@ class options example, \cb{app::options}. The <kind> value can be \cb{short}, \cb{long}, \cb{exclude}, or \cb{exclude-base}. If the value is \cb{exclude}, then the class documentation is excluded from usage and - man/HTML/text output. If it is \cb{exclude-base}, then it is only + man/HTML/LaTeX/text output. If it is \cb{exclude-base}, then it is only excluded when used as a base. For usage, the \cb{short} and \cb{long} values determine which usage function will be called when the class is used as base or as part of the page usage (see \cb{--page-usage}). For - man/HTML/text, these values determine which documentation strings are - used in the output." + man/HTML/LaTeX/text, these values determine which documentation strings + are used in the output." }; std::vector<std::string> --class { "<name>", - "Generate the man page, HTML, or text documentation only for the options - class <name>. The <name> value should be a fully-qualified options class - name, for example, \cb{app::options}. To generate documentation for + "Generate the man page, HTML, LaTeX, or text documentation only for the + options class <name>. The <name> value should be a fully-qualified options + class name, for example, \cb{app::options}. To generate documentation for multiple classes, repeat this option and the documentation will be produced in the order specified. This functionality is useful if you need to assemble documentation from multiple classes in a specific order or to @@ -332,6 +338,14 @@ class options '\cb{h2}', etc)." }; + std::map<char, std::string> --latex-section-map + { + "<c>=<h>", + "Map CLI heading <c> (valid values: '\cb{H}', '\cb{0}', '\cb{1}', + '\cb{h}', and '\cb{2}') to LaTeX section <h> (for example, '\cb{part}', + '\cb{chapter}', etc)." + }; + bool --omit-link-check { "Don't check that local fragment link references (\\l{#ref ...}) resolve @@ -370,6 +384,12 @@ class options "Insert <text> at the beginning of the generated HTML file." }; + std::vector<std::string> --latex-prologue + { + "<text>", + "Insert <text> at the beginning of the generated LaTeX file." + }; + std::vector<std::string> --txt-prologue { "<text>", @@ -408,6 +428,12 @@ class options "Insert <text> at the end of the generated HTML file." }; + std::vector<std::string> --latex-epilogue + { + "<text>", + "Insert <text> at the end of the generated LaTeX file." + }; + std::vector<std::string> --txt-epilogue { "<text>", @@ -451,6 +477,13 @@ class options file." }; + std::string --latex-prologue-file + { + "<file>", + "Insert the content of <file> at the beginning of the generated LaTeX + file." + }; + std::string --txt-prologue-file { "<file>", @@ -493,6 +526,12 @@ class options "Insert the content of <file> at the end of the generated HTML file." }; + std::string --latex-epilogue-file + { + "<file>", + "Insert the content of <file> at the end of the generated LaTeX file." + }; + std::string --txt-epilogue-file { "<file>", @@ -550,6 +589,20 @@ class options of the generated HTML file." }; + std::string --latex-suffix = ".tex" + { + "<suffix>", + "Use <suffix> instead of the default \cb{.tex} to construct the name + of the generated LaTeX file." + }; + + std::string --latex-output-suffix = ".pdf" + { + "<suffix>", + "Use <suffix> instead of the default \cb{.pdf} to construct the name + of the processed output file of the generated LaTeX file." + }; + std::string --txt-suffix = ".txt" { "<suffix>", diff --git a/cli/options.cxx b/cli/options.cxx index 809b588..b4f5723 100644 --- a/cli/options.cxx +++ b/cli/options.cxx @@ -611,6 +611,7 @@ options () generate_cxx_ (), generate_man_ (), generate_html_ (), + generate_latex_ (), generate_txt_ (), stdout__ (), suppress_undocumented_ (), @@ -635,6 +636,8 @@ options () link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + latex_section_map_ (), + latex_section_map_specified_ (false), omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), @@ -646,6 +649,8 @@ options () man_prologue_specified_ (false), html_prologue_ (), html_prologue_specified_ (false), + latex_prologue_ (), + latex_prologue_specified_ (false), txt_prologue_ (), txt_prologue_specified_ (false), hxx_epilogue_ (), @@ -658,6 +663,8 @@ options () man_epilogue_specified_ (false), html_epilogue_ (), html_epilogue_specified_ (false), + latex_epilogue_ (), + latex_epilogue_specified_ (false), txt_epilogue_ (), txt_epilogue_specified_ (false), hxx_prologue_file_ (), @@ -670,6 +677,8 @@ options () man_prologue_file_specified_ (false), html_prologue_file_ (), html_prologue_file_specified_ (false), + latex_prologue_file_ (), + latex_prologue_file_specified_ (false), txt_prologue_file_ (), txt_prologue_file_specified_ (false), hxx_epilogue_file_ (), @@ -682,6 +691,8 @@ options () man_epilogue_file_specified_ (false), html_epilogue_file_ (), html_epilogue_file_specified_ (false), + latex_epilogue_file_ (), + latex_epilogue_file_specified_ (false), txt_epilogue_file_ (), txt_epilogue_file_specified_ (false), output_prefix_ (), @@ -698,6 +709,10 @@ options () man_suffix_specified_ (false), html_suffix_ (".html"), html_suffix_specified_ (false), + latex_suffix_ (".tex"), + latex_suffix_specified_ (false), + latex_output_suffix_ (".pdf"), + latex_output_suffix_specified_ (false), txt_suffix_ (".txt"), txt_suffix_specified_ (false), option_prefix_ ("-"), @@ -749,6 +764,7 @@ options (int& argc, generate_cxx_ (), generate_man_ (), generate_html_ (), + generate_latex_ (), generate_txt_ (), stdout__ (), suppress_undocumented_ (), @@ -773,6 +789,8 @@ options (int& argc, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + latex_section_map_ (), + latex_section_map_specified_ (false), omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), @@ -784,6 +802,8 @@ options (int& argc, man_prologue_specified_ (false), html_prologue_ (), html_prologue_specified_ (false), + latex_prologue_ (), + latex_prologue_specified_ (false), txt_prologue_ (), txt_prologue_specified_ (false), hxx_epilogue_ (), @@ -796,6 +816,8 @@ options (int& argc, man_epilogue_specified_ (false), html_epilogue_ (), html_epilogue_specified_ (false), + latex_epilogue_ (), + latex_epilogue_specified_ (false), txt_epilogue_ (), txt_epilogue_specified_ (false), hxx_prologue_file_ (), @@ -808,6 +830,8 @@ options (int& argc, man_prologue_file_specified_ (false), html_prologue_file_ (), html_prologue_file_specified_ (false), + latex_prologue_file_ (), + latex_prologue_file_specified_ (false), txt_prologue_file_ (), txt_prologue_file_specified_ (false), hxx_epilogue_file_ (), @@ -820,6 +844,8 @@ options (int& argc, man_epilogue_file_specified_ (false), html_epilogue_file_ (), html_epilogue_file_specified_ (false), + latex_epilogue_file_ (), + latex_epilogue_file_specified_ (false), txt_epilogue_file_ (), txt_epilogue_file_specified_ (false), output_prefix_ (), @@ -836,6 +862,10 @@ options (int& argc, man_suffix_specified_ (false), html_suffix_ (".html"), html_suffix_specified_ (false), + latex_suffix_ (".tex"), + latex_suffix_specified_ (false), + latex_output_suffix_ (".pdf"), + latex_output_suffix_specified_ (false), txt_suffix_ (".txt"), txt_suffix_specified_ (false), option_prefix_ ("-"), @@ -890,6 +920,7 @@ options (int start, generate_cxx_ (), generate_man_ (), generate_html_ (), + generate_latex_ (), generate_txt_ (), stdout__ (), suppress_undocumented_ (), @@ -914,6 +945,8 @@ options (int start, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + latex_section_map_ (), + latex_section_map_specified_ (false), omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), @@ -925,6 +958,8 @@ options (int start, man_prologue_specified_ (false), html_prologue_ (), html_prologue_specified_ (false), + latex_prologue_ (), + latex_prologue_specified_ (false), txt_prologue_ (), txt_prologue_specified_ (false), hxx_epilogue_ (), @@ -937,6 +972,8 @@ options (int start, man_epilogue_specified_ (false), html_epilogue_ (), html_epilogue_specified_ (false), + latex_epilogue_ (), + latex_epilogue_specified_ (false), txt_epilogue_ (), txt_epilogue_specified_ (false), hxx_prologue_file_ (), @@ -949,6 +986,8 @@ options (int start, man_prologue_file_specified_ (false), html_prologue_file_ (), html_prologue_file_specified_ (false), + latex_prologue_file_ (), + latex_prologue_file_specified_ (false), txt_prologue_file_ (), txt_prologue_file_specified_ (false), hxx_epilogue_file_ (), @@ -961,6 +1000,8 @@ options (int start, man_epilogue_file_specified_ (false), html_epilogue_file_ (), html_epilogue_file_specified_ (false), + latex_epilogue_file_ (), + latex_epilogue_file_specified_ (false), txt_epilogue_file_ (), txt_epilogue_file_specified_ (false), output_prefix_ (), @@ -977,6 +1018,10 @@ options (int start, man_suffix_specified_ (false), html_suffix_ (".html"), html_suffix_specified_ (false), + latex_suffix_ (".tex"), + latex_suffix_specified_ (false), + latex_output_suffix_ (".pdf"), + latex_output_suffix_specified_ (false), txt_suffix_ (".txt"), txt_suffix_specified_ (false), option_prefix_ ("-"), @@ -1031,6 +1076,7 @@ options (int& argc, generate_cxx_ (), generate_man_ (), generate_html_ (), + generate_latex_ (), generate_txt_ (), stdout__ (), suppress_undocumented_ (), @@ -1055,6 +1101,8 @@ options (int& argc, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + latex_section_map_ (), + latex_section_map_specified_ (false), omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), @@ -1066,6 +1114,8 @@ options (int& argc, man_prologue_specified_ (false), html_prologue_ (), html_prologue_specified_ (false), + latex_prologue_ (), + latex_prologue_specified_ (false), txt_prologue_ (), txt_prologue_specified_ (false), hxx_epilogue_ (), @@ -1078,6 +1128,8 @@ options (int& argc, man_epilogue_specified_ (false), html_epilogue_ (), html_epilogue_specified_ (false), + latex_epilogue_ (), + latex_epilogue_specified_ (false), txt_epilogue_ (), txt_epilogue_specified_ (false), hxx_prologue_file_ (), @@ -1090,6 +1142,8 @@ options (int& argc, man_prologue_file_specified_ (false), html_prologue_file_ (), html_prologue_file_specified_ (false), + latex_prologue_file_ (), + latex_prologue_file_specified_ (false), txt_prologue_file_ (), txt_prologue_file_specified_ (false), hxx_epilogue_file_ (), @@ -1102,6 +1156,8 @@ options (int& argc, man_epilogue_file_specified_ (false), html_epilogue_file_ (), html_epilogue_file_specified_ (false), + latex_epilogue_file_ (), + latex_epilogue_file_specified_ (false), txt_epilogue_file_ (), txt_epilogue_file_specified_ (false), output_prefix_ (), @@ -1118,6 +1174,10 @@ options (int& argc, man_suffix_specified_ (false), html_suffix_ (".html"), html_suffix_specified_ (false), + latex_suffix_ (".tex"), + latex_suffix_specified_ (false), + latex_output_suffix_ (".pdf"), + latex_output_suffix_specified_ (false), txt_suffix_ (".txt"), txt_suffix_specified_ (false), option_prefix_ ("-"), @@ -1174,6 +1234,7 @@ options (int start, generate_cxx_ (), generate_man_ (), generate_html_ (), + generate_latex_ (), generate_txt_ (), stdout__ (), suppress_undocumented_ (), @@ -1198,6 +1259,8 @@ options (int start, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + latex_section_map_ (), + latex_section_map_specified_ (false), omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), @@ -1209,6 +1272,8 @@ options (int start, man_prologue_specified_ (false), html_prologue_ (), html_prologue_specified_ (false), + latex_prologue_ (), + latex_prologue_specified_ (false), txt_prologue_ (), txt_prologue_specified_ (false), hxx_epilogue_ (), @@ -1221,6 +1286,8 @@ options (int start, man_epilogue_specified_ (false), html_epilogue_ (), html_epilogue_specified_ (false), + latex_epilogue_ (), + latex_epilogue_specified_ (false), txt_epilogue_ (), txt_epilogue_specified_ (false), hxx_prologue_file_ (), @@ -1233,6 +1300,8 @@ options (int start, man_prologue_file_specified_ (false), html_prologue_file_ (), html_prologue_file_specified_ (false), + latex_prologue_file_ (), + latex_prologue_file_specified_ (false), txt_prologue_file_ (), txt_prologue_file_specified_ (false), hxx_epilogue_file_ (), @@ -1245,6 +1314,8 @@ options (int start, man_epilogue_file_specified_ (false), html_epilogue_file_ (), html_epilogue_file_specified_ (false), + latex_epilogue_file_ (), + latex_epilogue_file_specified_ (false), txt_epilogue_file_ (), txt_epilogue_file_specified_ (false), output_prefix_ (), @@ -1261,6 +1332,10 @@ options (int start, man_suffix_specified_ (false), html_suffix_ (".html"), html_suffix_specified_ (false), + latex_suffix_ (".tex"), + latex_suffix_specified_ (false), + latex_output_suffix_ (".pdf"), + latex_output_suffix_specified_ (false), txt_suffix_ (".txt"), txt_suffix_specified_ (false), option_prefix_ ("-"), @@ -1313,6 +1388,7 @@ options (::cli::scanner& s, generate_cxx_ (), generate_man_ (), generate_html_ (), + generate_latex_ (), generate_txt_ (), stdout__ (), suppress_undocumented_ (), @@ -1337,6 +1413,8 @@ options (::cli::scanner& s, link_regex_trace_ (), html_heading_map_ (), html_heading_map_specified_ (false), + latex_section_map_ (), + latex_section_map_specified_ (false), omit_link_check_ (), hxx_prologue_ (), hxx_prologue_specified_ (false), @@ -1348,6 +1426,8 @@ options (::cli::scanner& s, man_prologue_specified_ (false), html_prologue_ (), html_prologue_specified_ (false), + latex_prologue_ (), + latex_prologue_specified_ (false), txt_prologue_ (), txt_prologue_specified_ (false), hxx_epilogue_ (), @@ -1360,6 +1440,8 @@ options (::cli::scanner& s, man_epilogue_specified_ (false), html_epilogue_ (), html_epilogue_specified_ (false), + latex_epilogue_ (), + latex_epilogue_specified_ (false), txt_epilogue_ (), txt_epilogue_specified_ (false), hxx_prologue_file_ (), @@ -1372,6 +1454,8 @@ options (::cli::scanner& s, man_prologue_file_specified_ (false), html_prologue_file_ (), html_prologue_file_specified_ (false), + latex_prologue_file_ (), + latex_prologue_file_specified_ (false), txt_prologue_file_ (), txt_prologue_file_specified_ (false), hxx_epilogue_file_ (), @@ -1384,6 +1468,8 @@ options (::cli::scanner& s, man_epilogue_file_specified_ (false), html_epilogue_file_ (), html_epilogue_file_specified_ (false), + latex_epilogue_file_ (), + latex_epilogue_file_specified_ (false), txt_epilogue_file_ (), txt_epilogue_file_specified_ (false), output_prefix_ (), @@ -1400,6 +1486,10 @@ options (::cli::scanner& s, man_suffix_specified_ (false), html_suffix_ (".html"), html_suffix_specified_ (false), + latex_suffix_ (".tex"), + latex_suffix_specified_ (false), + latex_output_suffix_ (".pdf"), + latex_output_suffix_specified_ (false), txt_suffix_ (".txt"), txt_suffix_specified_ (false), option_prefix_ ("-"), @@ -1430,238 +1520,267 @@ print_usage (::std::ostream& os, ::cli::usage_para p) if (p == ::cli::usage_para::text) os << ::std::endl; - os << "--help Print usage information and exit." << ::std::endl; + os << "--help Print usage information and exit." << ::std::endl; - os << "--version Print version and exit." << ::std::endl; + os << "--version Print version and exit." << ::std::endl; - os << "--include-path|-I <dir> Search <dir> for bracket-included (<>) options" << ::std::endl - << " files." << ::std::endl; + os << "--include-path|-I <dir> Search <dir> for bracket-included (<>) options" << ::std::endl + << " files." << ::std::endl; - os << "--output-dir|-o <dir> Write the generated files to <dir> instead of the" << ::std::endl - << " current directory." << ::std::endl; + os << "--output-dir|-o <dir> Write the generated files to <dir> instead of" << ::std::endl + << " the current directory." << ::std::endl; - os << "--std <version> Specify the C++ standard that should be used" << ::std::endl - << " during compilation." << ::std::endl; + os << "--std <version> Specify the C++ standard that should be used" << ::std::endl + << " during compilation." << ::std::endl; - os << "--generate-modifier Generate option value modifiers in addition to" << ::std::endl - << " accessors." << ::std::endl; + os << "--generate-modifier Generate option value modifiers in addition to" << ::std::endl + << " accessors." << ::std::endl; - os << "--generate-specifier Generate functions for determining whether the" << ::std::endl - << " option was specified on the command line." << ::std::endl; + os << "--generate-specifier Generate functions for determining whether the" << ::std::endl + << " option was specified on the command line." << ::std::endl; - os << "--generate-parse Generate parse() functions instead of parsing" << ::std::endl - << " constructors." << ::std::endl; + os << "--generate-parse Generate parse() functions instead of parsing" << ::std::endl + << " constructors." << ::std::endl; - os << "--generate-description Generate the option description list that can be" << ::std::endl - << " examined at runtime." << ::std::endl; + os << "--generate-description Generate the option description list that can be" << ::std::endl + << " examined at runtime." << ::std::endl; - os << "--generate-file-scanner Generate the argv_file_scanner implementation." << ::std::endl; + os << "--generate-file-scanner Generate the argv_file_scanner implementation." << ::std::endl; - os << "--generate-vector-scanner Generate the vector_scanner implementation." << ::std::endl; + os << "--generate-vector-scanner Generate the vector_scanner implementation." << ::std::endl; - os << "--generate-group-scanner Generate the group_scanner implementation." << ::std::endl; + os << "--generate-group-scanner Generate the group_scanner implementation." << ::std::endl; - os << "--suppress-inline Generate all functions non-inline." << ::std::endl; + os << "--suppress-inline Generate all functions non-inline." << ::std::endl; - os << "--suppress-cli Do not generate the CLI support types (scanners," << ::std::endl - << " parser, etc)." << ::std::endl; + os << "--suppress-cli Do not generate the CLI support types (scanners," << ::std::endl + << " parser, etc)." << ::std::endl; - os << "--cli-namespace <ns> Generate the CLI support types in the <ns>" << ::std::endl - << " namespace (cli by default)." << ::std::endl; + os << "--cli-namespace <ns> Generate the CLI support types in the <ns>" << ::std::endl + << " namespace (cli by default)." << ::std::endl; - os << "--ostream-type <type> Output stream type instead of the default" << ::std::endl - << " std::ostream that should be used to print usage" << ::std::endl - << " and exception information." << ::std::endl; + os << "--ostream-type <type> Output stream type instead of the default" << ::std::endl + << " std::ostream that should be used to print usage" << ::std::endl + << " and exception information." << ::std::endl; - os << "--generate-cxx Generate C++ code." << ::std::endl; + os << "--generate-cxx Generate C++ code." << ::std::endl; - os << "--generate-man Generate documentation in the man page format." << ::std::endl; + os << "--generate-man Generate documentation in the man page format." << ::std::endl; - os << "--generate-html Generate documentation in the HTML format." << ::std::endl; + os << "--generate-html Generate documentation in the HTML format." << ::std::endl; - os << "--generate-txt Generate documentation in the plain text format," << ::std::endl - << " similar to usage." << ::std::endl; + os << "--generate-latex Generate documentation in the LaTeX format." << ::std::endl; - os << "--stdout Write output to STDOUT instead of a file." << ::std::endl; + os << "--generate-txt Generate documentation in the plain text format," << ::std::endl + << " similar to usage." << ::std::endl; - os << "--suppress-undocumented Suppress the generation of documentation entries" << ::std::endl - << " for undocumented options." << ::std::endl; + os << "--stdout Write output to STDOUT instead of a file." << ::std::endl; - os << "--suppress-usage Suppress the generation of the usage printing" << ::std::endl - << " code." << ::std::endl; + os << "--suppress-undocumented Suppress the generation of documentation entries" << ::std::endl + << " for undocumented options." << ::std::endl; - os << "--long-usage If no short documentation string is provided, use" << ::std::endl - << " the complete long documentation string in usage." << ::std::endl; + os << "--suppress-usage Suppress the generation of the usage printing" << ::std::endl + << " code." << ::std::endl; - os << "--short-usage If specified together with --long-usage, generate" << ::std::endl - << " both short and long usage versions." << ::std::endl; + os << "--long-usage If no short documentation string is provided," << ::std::endl + << " use the complete long documentation string in" << ::std::endl + << " usage." << ::std::endl; - os << "--page-usage <name> Generate the combined usage printing code for the" << ::std::endl - << " entire page." << ::std::endl; + os << "--short-usage If specified together with --long-usage," << ::std::endl + << " generate both short and long usage versions." << ::std::endl; - os << "--option-length <len> Indent option descriptions <len> characters when" << ::std::endl - << " printing usage." << ::std::endl; + os << "--page-usage <name> Generate the combined usage printing code for" << ::std::endl + << " the entire page." << ::std::endl; - os << "--ansi-color Use ANSI color escape sequences when printing" << ::std::endl - << " usage." << ::std::endl; + os << "--option-length <len> Indent option descriptions <len> characters when" << ::std::endl + << " printing usage." << ::std::endl; - os << "--exclude-base Exclude base class information from usage and" << ::std::endl - << " documentation." << ::std::endl; + os << "--ansi-color Use ANSI color escape sequences when printing" << ::std::endl + << " usage." << ::std::endl; - os << "--include-base-last Include base class information after derived for" << ::std::endl - << " usage and documentation." << ::std::endl; + os << "--exclude-base Exclude base class information from usage and" << ::std::endl + << " documentation." << ::std::endl; - os << "--class-doc <name>=<kind> Specify the documentation <kind> that should be" << ::std::endl - << " used for the options class <name>." << ::std::endl; + os << "--include-base-last Include base class information after derived for" << ::std::endl + << " usage and documentation." << ::std::endl; - os << "--class <name> Generate the man page, HTML, or text documentation" << ::std::endl - << " only for the options class <name>." << ::std::endl; + os << "--class-doc <name>=<kind> Specify the documentation <kind> that should be" << ::std::endl + << " used for the options class <name>." << ::std::endl; - os << "--docvar|-v <name>=<val> Set documentation variable <name> to the value" << ::std::endl - << " <val>." << ::std::endl; + os << "--class <name> Generate the man page, HTML, LaTeX, or text" << ::std::endl + << " documentation only for the options class <name>." << ::std::endl; - os << "--link-regex <regex> Add <regex> to the list of regular expressions" << ::std::endl - << " used to transform link targets in the generated" << ::std::endl - << " documentation." << ::std::endl; + os << "--docvar|-v <name>=<val> Set documentation variable <name> to the value" << ::std::endl + << " <val>." << ::std::endl; - os << "--link-regex-trace Trace the process of applying regular expressions" << ::std::endl - << " specified with the --link-regex option." << ::std::endl; + os << "--link-regex <regex> Add <regex> to the list of regular expressions" << ::std::endl + << " used to transform link targets in the generated" << ::std::endl + << " documentation." << ::std::endl; - os << "--html-heading-map <c>=<h> Map CLI heading <c> (valid values: 'H', '0', '1'," << ::std::endl - << " 'h', and '2') to HTML heading <h> (for example," << ::std::endl - << " 'h1', 'h2', etc)." << ::std::endl; + os << "--link-regex-trace Trace the process of applying regular" << ::std::endl + << " expressions specified with the --link-regex" << ::std::endl + << " option." << ::std::endl; - os << "--omit-link-check Don't check that local fragment link references" << ::std::endl - << " (\\l{#ref ...}) resolve to ids." << ::std::endl; + os << "--html-heading-map <c>=<h> Map CLI heading <c> (valid values: 'H', '0'," << ::std::endl + << " '1', 'h', and '2') to HTML heading <h> (for" << ::std::endl + << " example, 'h1', 'h2', etc)." << ::std::endl; - os << "--hxx-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl - << " C++ header file." << ::std::endl; + os << "--latex-section-map <c>=<h> Map CLI heading <c> (valid values: 'H', '0'," << ::std::endl + << " '1', 'h', and '2') to LaTeX section <h> (for" << ::std::endl + << " example, 'part', 'chapter', etc)." << ::std::endl; - os << "--ixx-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl - << " C++ inline file." << ::std::endl; + os << "--omit-link-check Don't check that local fragment link references" << ::std::endl + << " (\\l{#ref ...}) resolve to ids." << ::std::endl; - os << "--cxx-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl - << " C++ source file." << ::std::endl; + os << "--hxx-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl + << " C++ header file." << ::std::endl; - os << "--man-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl - << " man page file." << ::std::endl; + os << "--ixx-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl + << " C++ inline file." << ::std::endl; - os << "--html-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl - << " HTML file." << ::std::endl; + os << "--cxx-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl + << " C++ source file." << ::std::endl; - os << "--txt-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl - << " text file." << ::std::endl; + os << "--man-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl + << " man page file." << ::std::endl; - os << "--hxx-epilogue <text> Insert <text> at the end of the generated C++" << ::std::endl - << " header file." << ::std::endl; + os << "--html-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl + << " HTML file." << ::std::endl; - os << "--ixx-epilogue <text> Insert <text> at the end of the generated C++" << ::std::endl - << " inline file." << ::std::endl; + os << "--latex-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl + << " LaTeX file." << ::std::endl; - os << "--cxx-epilogue <text> Insert <text> at the end of the generated C++" << ::std::endl - << " source file." << ::std::endl; + os << "--txt-prologue <text> Insert <text> at the beginning of the generated" << ::std::endl + << " text file." << ::std::endl; - os << "--man-epilogue <text> Insert <text> at the end of the generated man page" << ::std::endl - << " file." << ::std::endl; + os << "--hxx-epilogue <text> Insert <text> at the end of the generated C++" << ::std::endl + << " header file." << ::std::endl; - os << "--html-epilogue <text> Insert <text> at the end of the generated HTML" << ::std::endl - << " file." << ::std::endl; + os << "--ixx-epilogue <text> Insert <text> at the end of the generated C++" << ::std::endl + << " inline file." << ::std::endl; - os << "--txt-epilogue <text> Insert <text> at the end of the generated text" << ::std::endl - << " file." << ::std::endl; + os << "--cxx-epilogue <text> Insert <text> at the end of the generated C++" << ::std::endl + << " source file." << ::std::endl; - os << "--hxx-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl - << " the generated C++ header file." << ::std::endl; + os << "--man-epilogue <text> Insert <text> at the end of the generated man" << ::std::endl + << " page file." << ::std::endl; - os << "--ixx-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl - << " the generated C++ inline file." << ::std::endl; + os << "--html-epilogue <text> Insert <text> at the end of the generated HTML" << ::std::endl + << " file." << ::std::endl; - os << "--cxx-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl - << " the generated C++ source file." << ::std::endl; + os << "--latex-epilogue <text> Insert <text> at the end of the generated LaTeX" << ::std::endl + << " file." << ::std::endl; - os << "--man-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl - << " the generated man page file." << ::std::endl; + os << "--txt-epilogue <text> Insert <text> at the end of the generated text" << ::std::endl + << " file." << ::std::endl; - os << "--html-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl - << " the generated HTML file." << ::std::endl; + os << "--hxx-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl + << " the generated C++ header file." << ::std::endl; - os << "--txt-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl - << " the generated text file." << ::std::endl; + os << "--ixx-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl + << " the generated C++ inline file." << ::std::endl; - os << "--hxx-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl - << " generated C++ header file." << ::std::endl; + os << "--cxx-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl + << " the generated C++ source file." << ::std::endl; - os << "--ixx-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl - << " generated C++ inline file." << ::std::endl; + os << "--man-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl + << " the generated man page file." << ::std::endl; - os << "--cxx-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl - << " generated C++ source file." << ::std::endl; + os << "--html-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl + << " the generated HTML file." << ::std::endl; - os << "--man-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl - << " generated man page file." << ::std::endl; + os << "--latex-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl + << " the generated LaTeX file." << ::std::endl; - os << "--html-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl - << " generated HTML file." << ::std::endl; + os << "--txt-prologue-file <file> Insert the content of <file> at the beginning of" << ::std::endl + << " the generated text file." << ::std::endl; - os << "--txt-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl - << " generated text file." << ::std::endl; + os << "--hxx-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl + << " generated C++ header file." << ::std::endl; - os << "--output-prefix <prefix> Add <prefix> at the beginning of the generated" << ::std::endl - << " output file name(s)." << ::std::endl; + os << "--ixx-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl + << " generated C++ inline file." << ::std::endl; - os << "--output-suffix <suffix> Add <suffix> at the end of the generated output" << ::std::endl - << " file name(s)." << ::std::endl; + os << "--cxx-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl + << " generated C++ source file." << ::std::endl; - os << "--hxx-suffix <suffix> Use <suffix> instead of the default .hxx to" << ::std::endl - << " construct the name of the generated header file." << ::std::endl; + os << "--man-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl + << " generated man page file." << ::std::endl; - os << "--ixx-suffix <suffix> Use <suffix> instead of the default .ixx to" << ::std::endl - << " construct the name of the generated inline file." << ::std::endl; + os << "--html-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl + << " generated HTML file." << ::std::endl; - os << "--cxx-suffix <suffix> Use <suffix> instead of the default .cxx to" << ::std::endl - << " construct the name of the generated source file." << ::std::endl; + os << "--latex-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl + << " generated LaTeX file." << ::std::endl; - os << "--man-suffix <suffix> Use <suffix> instead of the default .1 to" << ::std::endl - << " construct the name of the generated man page file." << ::std::endl; + os << "--txt-epilogue-file <file> Insert the content of <file> at the end of the" << ::std::endl + << " generated text file." << ::std::endl; - os << "--html-suffix <suffix> Use <suffix> instead of the default .html to" << ::std::endl - << " construct the name of the generated HTML file." << ::std::endl; + os << "--output-prefix <prefix> Add <prefix> at the beginning of the generated" << ::std::endl + << " output file name(s)." << ::std::endl; - os << "--txt-suffix <suffix> Use <suffix> instead of the default .txt to" << ::std::endl - << " construct the name of the generated text file." << ::std::endl; + os << "--output-suffix <suffix> Add <suffix> at the end of the generated output" << ::std::endl + << " file name(s)." << ::std::endl; - os << "--option-prefix <prefix> Use <prefix> instead of the default '-' as an" << ::std::endl - << " option prefix." << ::std::endl; + os << "--hxx-suffix <suffix> Use <suffix> instead of the default .hxx to" << ::std::endl + << " construct the name of the generated header file." << ::std::endl; - os << "--option-separator <sep> Use <sep> instead of the default '--' as an" << ::std::endl - << " optional separator between options and arguments." << ::std::endl; + os << "--ixx-suffix <suffix> Use <suffix> instead of the default .ixx to" << ::std::endl + << " construct the name of the generated inline file." << ::std::endl; - os << "--keep-separator Leave the option separator in the scanner." << ::std::endl; + os << "--cxx-suffix <suffix> Use <suffix> instead of the default .cxx to" << ::std::endl + << " construct the name of the generated source file." << ::std::endl; - os << "--no-combined-flags Disable support for combining multiple" << ::std::endl - << " single-character flags into a single argument (the" << ::std::endl - << " -xyz form that is equivalent to -x -y -z)." << ::std::endl; + os << "--man-suffix <suffix> Use <suffix> instead of the default .1 to" << ::std::endl + << " construct the name of the generated man page" << ::std::endl + << " file." << ::std::endl; - os << "--no-combined-values Disable support for combining an option and its" << ::std::endl - << " value into a single argument with the assignment" << ::std::endl - << " sign (the option=value form)." << ::std::endl; + os << "--html-suffix <suffix> Use <suffix> instead of the default .html to" << ::std::endl + << " construct the name of the generated HTML file." << ::std::endl; - os << "--include-with-brackets Use angle brackets (<>) instead of quotes (\"\") in" << ::std::endl - << " the generated #include directives." << ::std::endl; + os << "--latex-suffix <suffix> Use <suffix> instead of the default .tex to" << ::std::endl + << " construct the name of the generated LaTeX file." << ::std::endl; - os << "--include-prefix <prefix> Add <prefix> to the generated #include directive" << ::std::endl - << " paths." << ::std::endl; + os << "--latex-output-suffix <suffix> Use <suffix> instead of the default .pdf to" << ::std::endl + << " construct the name of the processed output file" << ::std::endl + << " of the generated LaTeX file." << ::std::endl; - os << "--guard-prefix <prefix> Add <prefix> to the generated header inclusion" << ::std::endl - << " guards." << ::std::endl; + os << "--txt-suffix <suffix> Use <suffix> instead of the default .txt to" << ::std::endl + << " construct the name of the generated text file." << ::std::endl; - os << "--reserved-name <name>=<rep> Add <name> with an optional <rep> replacement to" << ::std::endl - << " the list of names that should not be used as" << ::std::endl - << " identifiers." << ::std::endl; + os << "--option-prefix <prefix> Use <prefix> instead of the default '-' as an" << ::std::endl + << " option prefix." << ::std::endl; - os << "--options-file <file> Read additional options from <file> with each" << ::std::endl - << " option appearing on a separate line optionally" << ::std::endl - << " followed by space and an option value." << ::std::endl; + os << "--option-separator <sep> Use <sep> instead of the default '--' as an" << ::std::endl + << " optional separator between options and" << ::std::endl + << " arguments." << ::std::endl; + + os << "--keep-separator Leave the option separator in the scanner." << ::std::endl; + + os << "--no-combined-flags Disable support for combining multiple" << ::std::endl + << " single-character flags into a single argument" << ::std::endl + << " (the -xyz form that is equivalent to -x -y -z)." << ::std::endl; + + os << "--no-combined-values Disable support for combining an option and its" << ::std::endl + << " value into a single argument with the assignment" << ::std::endl + << " sign (the option=value form)." << ::std::endl; + + os << "--include-with-brackets Use angle brackets (<>) instead of quotes (\"\")" << ::std::endl + << " in the generated #include directives." << ::std::endl; + + os << "--include-prefix <prefix> Add <prefix> to the generated #include directive" << ::std::endl + << " paths." << ::std::endl; + + os << "--guard-prefix <prefix> Add <prefix> to the generated header inclusion" << ::std::endl + << " guards." << ::std::endl; + + os << "--reserved-name <name>=<rep> Add <name> with an optional <rep> replacement to" << ::std::endl + << " the list of names that should not be used as" << ::std::endl + << " identifiers." << ::std::endl; + + os << "--options-file <file> Read additional options from <file> with each" << ::std::endl + << " option appearing on a separate line optionally" << ::std::endl + << " followed by space and an option value." << ::std::endl; p = ::cli::usage_para::option; @@ -1727,6 +1846,8 @@ struct _cli_options_map_init &::cli::thunk< options, bool, &options::generate_man_ >; _cli_options_map_["--generate-html"] = &::cli::thunk< options, bool, &options::generate_html_ >; + _cli_options_map_["--generate-latex"] = + &::cli::thunk< options, bool, &options::generate_latex_ >; _cli_options_map_["--generate-txt"] = &::cli::thunk< options, bool, &options::generate_txt_ >; _cli_options_map_["--stdout"] = @@ -1771,6 +1892,9 @@ struct _cli_options_map_init _cli_options_map_["--html-heading-map"] = &::cli::thunk< options, std::map<char, std::string>, &options::html_heading_map_, &options::html_heading_map_specified_ >; + _cli_options_map_["--latex-section-map"] = + &::cli::thunk< options, std::map<char, std::string>, &options::latex_section_map_, + &options::latex_section_map_specified_ >; _cli_options_map_["--omit-link-check"] = &::cli::thunk< options, bool, &options::omit_link_check_ >; _cli_options_map_["--hxx-prologue"] = @@ -1788,6 +1912,9 @@ struct _cli_options_map_init _cli_options_map_["--html-prologue"] = &::cli::thunk< options, std::vector<std::string>, &options::html_prologue_, &options::html_prologue_specified_ >; + _cli_options_map_["--latex-prologue"] = + &::cli::thunk< options, std::vector<std::string>, &options::latex_prologue_, + &options::latex_prologue_specified_ >; _cli_options_map_["--txt-prologue"] = &::cli::thunk< options, std::vector<std::string>, &options::txt_prologue_, &options::txt_prologue_specified_ >; @@ -1806,6 +1933,9 @@ struct _cli_options_map_init _cli_options_map_["--html-epilogue"] = &::cli::thunk< options, std::vector<std::string>, &options::html_epilogue_, &options::html_epilogue_specified_ >; + _cli_options_map_["--latex-epilogue"] = + &::cli::thunk< options, std::vector<std::string>, &options::latex_epilogue_, + &options::latex_epilogue_specified_ >; _cli_options_map_["--txt-epilogue"] = &::cli::thunk< options, std::vector<std::string>, &options::txt_epilogue_, &options::txt_epilogue_specified_ >; @@ -1824,6 +1954,9 @@ struct _cli_options_map_init _cli_options_map_["--html-prologue-file"] = &::cli::thunk< options, std::string, &options::html_prologue_file_, &options::html_prologue_file_specified_ >; + _cli_options_map_["--latex-prologue-file"] = + &::cli::thunk< options, std::string, &options::latex_prologue_file_, + &options::latex_prologue_file_specified_ >; _cli_options_map_["--txt-prologue-file"] = &::cli::thunk< options, std::string, &options::txt_prologue_file_, &options::txt_prologue_file_specified_ >; @@ -1842,6 +1975,9 @@ struct _cli_options_map_init _cli_options_map_["--html-epilogue-file"] = &::cli::thunk< options, std::string, &options::html_epilogue_file_, &options::html_epilogue_file_specified_ >; + _cli_options_map_["--latex-epilogue-file"] = + &::cli::thunk< options, std::string, &options::latex_epilogue_file_, + &options::latex_epilogue_file_specified_ >; _cli_options_map_["--txt-epilogue-file"] = &::cli::thunk< options, std::string, &options::txt_epilogue_file_, &options::txt_epilogue_file_specified_ >; @@ -1866,6 +2002,12 @@ struct _cli_options_map_init _cli_options_map_["--html-suffix"] = &::cli::thunk< options, std::string, &options::html_suffix_, &options::html_suffix_specified_ >; + _cli_options_map_["--latex-suffix"] = + &::cli::thunk< options, std::string, &options::latex_suffix_, + &options::latex_suffix_specified_ >; + _cli_options_map_["--latex-output-suffix"] = + &::cli::thunk< options, std::string, &options::latex_output_suffix_, + &options::latex_output_suffix_specified_ >; _cli_options_map_["--txt-suffix"] = &::cli::thunk< options, std::string, &options::txt_suffix_, &options::txt_suffix_specified_ >; diff --git a/cli/options.hxx b/cli/options.hxx index dce59bd..e8889d4 100644 --- a/cli/options.hxx +++ b/cli/options.hxx @@ -611,6 +611,15 @@ class options generate_html (const bool&); const bool& + generate_latex () const; + + bool& + generate_latex (); + + void + generate_latex (const bool&); + + const bool& generate_txt () const; bool& @@ -805,6 +814,21 @@ class options void html_heading_map_specified (bool); + const std::map<char, std::string>& + latex_section_map () const; + + std::map<char, std::string>& + latex_section_map (); + + void + latex_section_map (const std::map<char, std::string>&); + + bool + latex_section_map_specified () const; + + void + latex_section_map_specified (bool); + const bool& omit_link_check () const; @@ -890,6 +914,21 @@ class options html_prologue_specified (bool); const std::vector<std::string>& + latex_prologue () const; + + std::vector<std::string>& + latex_prologue (); + + void + latex_prologue (const std::vector<std::string>&); + + bool + latex_prologue_specified () const; + + void + latex_prologue_specified (bool); + + const std::vector<std::string>& txt_prologue () const; std::vector<std::string>& @@ -980,6 +1019,21 @@ class options html_epilogue_specified (bool); const std::vector<std::string>& + latex_epilogue () const; + + std::vector<std::string>& + latex_epilogue (); + + void + latex_epilogue (const std::vector<std::string>&); + + bool + latex_epilogue_specified () const; + + void + latex_epilogue_specified (bool); + + const std::vector<std::string>& txt_epilogue () const; std::vector<std::string>& @@ -1070,6 +1124,21 @@ class options html_prologue_file_specified (bool); const std::string& + latex_prologue_file () const; + + std::string& + latex_prologue_file (); + + void + latex_prologue_file (const std::string&); + + bool + latex_prologue_file_specified () const; + + void + latex_prologue_file_specified (bool); + + const std::string& txt_prologue_file () const; std::string& @@ -1160,6 +1229,21 @@ class options html_epilogue_file_specified (bool); const std::string& + latex_epilogue_file () const; + + std::string& + latex_epilogue_file (); + + void + latex_epilogue_file (const std::string&); + + bool + latex_epilogue_file_specified () const; + + void + latex_epilogue_file_specified (bool); + + const std::string& txt_epilogue_file () const; std::string& @@ -1280,6 +1364,36 @@ class options html_suffix_specified (bool); const std::string& + latex_suffix () const; + + std::string& + latex_suffix (); + + void + latex_suffix (const std::string&); + + bool + latex_suffix_specified () const; + + void + latex_suffix_specified (bool); + + const std::string& + latex_output_suffix () const; + + std::string& + latex_output_suffix (); + + void + latex_output_suffix (const std::string&); + + bool + latex_output_suffix_specified () const; + + void + latex_output_suffix_specified (bool); + + const std::string& txt_suffix () const; std::string& @@ -1463,6 +1577,7 @@ class options bool generate_cxx_; bool generate_man_; bool generate_html_; + bool generate_latex_; bool generate_txt_; bool stdout__; bool suppress_undocumented_; @@ -1487,6 +1602,8 @@ class options bool link_regex_trace_; std::map<char, std::string> html_heading_map_; bool html_heading_map_specified_; + std::map<char, std::string> latex_section_map_; + bool latex_section_map_specified_; bool omit_link_check_; std::vector<std::string> hxx_prologue_; bool hxx_prologue_specified_; @@ -1498,6 +1615,8 @@ class options bool man_prologue_specified_; std::vector<std::string> html_prologue_; bool html_prologue_specified_; + std::vector<std::string> latex_prologue_; + bool latex_prologue_specified_; std::vector<std::string> txt_prologue_; bool txt_prologue_specified_; std::vector<std::string> hxx_epilogue_; @@ -1510,6 +1629,8 @@ class options bool man_epilogue_specified_; std::vector<std::string> html_epilogue_; bool html_epilogue_specified_; + std::vector<std::string> latex_epilogue_; + bool latex_epilogue_specified_; std::vector<std::string> txt_epilogue_; bool txt_epilogue_specified_; std::string hxx_prologue_file_; @@ -1522,6 +1643,8 @@ class options bool man_prologue_file_specified_; std::string html_prologue_file_; bool html_prologue_file_specified_; + std::string latex_prologue_file_; + bool latex_prologue_file_specified_; std::string txt_prologue_file_; bool txt_prologue_file_specified_; std::string hxx_epilogue_file_; @@ -1534,6 +1657,8 @@ class options bool man_epilogue_file_specified_; std::string html_epilogue_file_; bool html_epilogue_file_specified_; + std::string latex_epilogue_file_; + bool latex_epilogue_file_specified_; std::string txt_epilogue_file_; bool txt_epilogue_file_specified_; std::string output_prefix_; @@ -1550,6 +1675,10 @@ class options bool man_suffix_specified_; std::string html_suffix_; bool html_suffix_specified_; + std::string latex_suffix_; + bool latex_suffix_specified_; + std::string latex_output_suffix_; + bool latex_output_suffix_specified_; std::string txt_suffix_; bool txt_suffix_specified_; std::string option_prefix_; diff --git a/cli/options.ixx b/cli/options.ixx index 4c5cfb7..c9e1c56 100644 --- a/cli/options.ixx +++ b/cli/options.ixx @@ -629,6 +629,24 @@ generate_html(const bool& x) } inline const bool& options:: +generate_latex () const +{ + return this->generate_latex_; +} + +inline bool& options:: +generate_latex () +{ + return this->generate_latex_; +} + +inline void options:: +generate_latex(const bool& x) +{ + this->generate_latex_ = x; +} + +inline const bool& options:: generate_txt () const { return this->generate_txt_; @@ -1018,6 +1036,36 @@ html_heading_map_specified(bool x) this->html_heading_map_specified_ = x; } +inline const std::map<char, std::string>& options:: +latex_section_map () const +{ + return this->latex_section_map_; +} + +inline std::map<char, std::string>& options:: +latex_section_map () +{ + return this->latex_section_map_; +} + +inline void options:: +latex_section_map(const std::map<char, std::string>& x) +{ + this->latex_section_map_ = x; +} + +inline bool options:: +latex_section_map_specified () const +{ + return this->latex_section_map_specified_; +} + +inline void options:: +latex_section_map_specified(bool x) +{ + this->latex_section_map_specified_ = x; +} + inline const bool& options:: omit_link_check () const { @@ -1187,6 +1235,36 @@ html_prologue_specified(bool x) } inline const std::vector<std::string>& options:: +latex_prologue () const +{ + return this->latex_prologue_; +} + +inline std::vector<std::string>& options:: +latex_prologue () +{ + return this->latex_prologue_; +} + +inline void options:: +latex_prologue(const std::vector<std::string>& x) +{ + this->latex_prologue_ = x; +} + +inline bool options:: +latex_prologue_specified () const +{ + return this->latex_prologue_specified_; +} + +inline void options:: +latex_prologue_specified(bool x) +{ + this->latex_prologue_specified_ = x; +} + +inline const std::vector<std::string>& options:: txt_prologue () const { return this->txt_prologue_; @@ -1367,6 +1445,36 @@ html_epilogue_specified(bool x) } inline const std::vector<std::string>& options:: +latex_epilogue () const +{ + return this->latex_epilogue_; +} + +inline std::vector<std::string>& options:: +latex_epilogue () +{ + return this->latex_epilogue_; +} + +inline void options:: +latex_epilogue(const std::vector<std::string>& x) +{ + this->latex_epilogue_ = x; +} + +inline bool options:: +latex_epilogue_specified () const +{ + return this->latex_epilogue_specified_; +} + +inline void options:: +latex_epilogue_specified(bool x) +{ + this->latex_epilogue_specified_ = x; +} + +inline const std::vector<std::string>& options:: txt_epilogue () const { return this->txt_epilogue_; @@ -1547,6 +1655,36 @@ html_prologue_file_specified(bool x) } inline const std::string& options:: +latex_prologue_file () const +{ + return this->latex_prologue_file_; +} + +inline std::string& options:: +latex_prologue_file () +{ + return this->latex_prologue_file_; +} + +inline void options:: +latex_prologue_file(const std::string& x) +{ + this->latex_prologue_file_ = x; +} + +inline bool options:: +latex_prologue_file_specified () const +{ + return this->latex_prologue_file_specified_; +} + +inline void options:: +latex_prologue_file_specified(bool x) +{ + this->latex_prologue_file_specified_ = x; +} + +inline const std::string& options:: txt_prologue_file () const { return this->txt_prologue_file_; @@ -1727,6 +1865,36 @@ html_epilogue_file_specified(bool x) } inline const std::string& options:: +latex_epilogue_file () const +{ + return this->latex_epilogue_file_; +} + +inline std::string& options:: +latex_epilogue_file () +{ + return this->latex_epilogue_file_; +} + +inline void options:: +latex_epilogue_file(const std::string& x) +{ + this->latex_epilogue_file_ = x; +} + +inline bool options:: +latex_epilogue_file_specified () const +{ + return this->latex_epilogue_file_specified_; +} + +inline void options:: +latex_epilogue_file_specified(bool x) +{ + this->latex_epilogue_file_specified_ = x; +} + +inline const std::string& options:: txt_epilogue_file () const { return this->txt_epilogue_file_; @@ -1967,6 +2135,66 @@ html_suffix_specified(bool x) } inline const std::string& options:: +latex_suffix () const +{ + return this->latex_suffix_; +} + +inline std::string& options:: +latex_suffix () +{ + return this->latex_suffix_; +} + +inline void options:: +latex_suffix(const std::string& x) +{ + this->latex_suffix_ = x; +} + +inline bool options:: +latex_suffix_specified () const +{ + return this->latex_suffix_specified_; +} + +inline void options:: +latex_suffix_specified(bool x) +{ + this->latex_suffix_specified_ = x; +} + +inline const std::string& options:: +latex_output_suffix () const +{ + return this->latex_output_suffix_; +} + +inline std::string& options:: +latex_output_suffix () +{ + return this->latex_output_suffix_; +} + +inline void options:: +latex_output_suffix(const std::string& x) +{ + this->latex_output_suffix_ = x; +} + +inline bool options:: +latex_output_suffix_specified () const +{ + return this->latex_output_suffix_specified_; +} + +inline void options:: +latex_output_suffix_specified(bool x) +{ + this->latex_output_suffix_specified_ = x; +} + +inline const std::string& options:: txt_suffix () const { return this->txt_suffix_; |