summaryrefslogtreecommitdiff
path: root/cli/cli/html.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-11-09 13:01:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-11-09 13:01:13 +0200
commitcd3758bb328ff425bb06f18c81d3c353b508a336 (patch)
treeed8a85f7c01fa83852bb6d51e4fc2dd2a268b388 /cli/cli/html.cxx
parent9944c0e901d370316fe55fb845ad1c3c6721038d (diff)
Add --ascii-tree for translating UTF-8 tree(1) output to ASCII
Diffstat (limited to 'cli/cli/html.cxx')
-rw-r--r--cli/cli/html.cxx10
1 files changed, 9 insertions, 1 deletions
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<string> 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>"), 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);