From cd3758bb328ff425bb06f18c81d3c353b508a336 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 9 Nov 2021 13:01:13 +0200 Subject: Add --ascii-tree for translating UTF-8 tree(1) output to ASCII --- cli/cli/html.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cli/cli/html.cxx') diff --git a/cli/cli/html.cxx b/cli/cli/html.cxx index b374b91..48eb5e3 100644 --- a/cli/cli/html.cxx +++ b/cli/cli/html.cxx @@ -127,13 +127,16 @@ namespace // n > 2 - arg string, short string, long string // size_t n (ds.size ()); - const string& d ( + 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])); + if (options.ascii_tree ()) + preprocess_ascii_tree (d); + std::set arg_set; if (n > 1) translate_arg (ds[0], arg_set); @@ -211,6 +214,8 @@ namespace if (type != "bool" || doc.size () >= 3) { + // Note: we naturally assume this doesn't need --ascii-tree treatment. + // string s ( translate_arg ( doc.size () > 0 ? doc[0] : string (""), arg_set)); @@ -236,6 +241,9 @@ namespace d = (cd_ == cd_short ? first_sentence (doc[1]) : doc[1]); } + if (options.ascii_tree ()) + preprocess_ascii_tree (d); + // Format the documentation string. // d = format (o.scope (), escape_html (translate (d, arg_set)), false); -- cgit v1.1