Skip to content

Commit

Permalink
include global parameters and fixup for HTML meta-characters
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Aug 22, 2022
1 parent f6e4a45 commit 0eea021
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/mk_params_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def help(ous):
ous.write("Z3 Options\n")
z3_exe = BUILD_DIR + "/z3"
out = subprocess.Popen([z3_exe, "-pm"],stdout=subprocess.PIPE).communicate()[0]
modules = []
modules = ["global"]
if out != None:
out = out.decode(sys.stdout.encoding)
module_re = re.compile(r"\[module\] (.*)\,")
Expand Down
10 changes: 8 additions & 2 deletions src/util/gparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,15 +536,21 @@ struct gparams::imp {
void display_module_markdown(std::ostream & out, char const* module_name) {
lock_guard lock(*gparams_mux);
param_descrs * d = nullptr;

if (module_name == std::string("global")) {
out << "\n## Global Parameters\n\n";
get_param_descrs().display_markdown(out);
return;
}
if (!get_module_param_descr(module_name, d)) {
std::stringstream strm;
strm << "unknown module '" << module_name << "'";
throw exception(std::move(strm).str());
}
out << "\n## Module " << module_name << "\n\n";
out << "\n## " << module_name << "\n\n";
char const * descr = nullptr;
if (get_module_descrs().find(module_name, descr))
out << "Description: " << descr << "\n";
out << descr << "\n";
out << "\n";
d->display_markdown(out);
}
Expand Down
14 changes: 12 additions & 2 deletions src/util/params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,19 @@ struct param_descrs::imp {
out << " | " << d.m_kind << " ";
else
out << " (" << d.m_kind << ")";
if (markdown)
if (markdown) {
out << " | ";
if (include_descr)
std::string desc;
for (auto ch : std::string(d.m_descr)) {
switch (ch) {
case '<': desc += "&lt;"; break;
case '>': desc += "&gt;"; break;
default: desc.push_back(ch);
}
}
out << " " << desc;
}
else if (include_descr)
out << " " << d.m_descr;
if (markdown) {
out << " | ";
Expand Down

0 comments on commit 0eea021

Please sign in to comment.