Fix: Adds histogram to boostbook (#273)

This commit is contained in:
Hans Dembinski 2020-03-07 18:48:45 +01:00 committed by GitHub
parent 0583e6598d
commit f97cae4548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 25 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ build*
*.gcov
doc/html
doc/reference.xml
doc/reference_pp.xml
__pycache__
*.pyc
.DS_Store

View File

@ -3,11 +3,16 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# How to set up Boost Build for building the documentation:
# https://www.boost.org/doc/libs/1_72_0/doc/html/quickbook/install.html
project doc/histogram ;
import os ;
import doxygen ;
import quickbook ;
import boostbook : boostbook ;
import notfile ;
path-constant THIS_PATH : . ;
@ -33,15 +38,25 @@ doxygen reference
\"BOOST_ATTRIBUTE_NODISCARD\""
;
make reference_pp.xml : reference.xml : @doxygen_postprocessing ;
actions doxygen_postprocessing
actions doxygen-postprocessing
{
python $(THIS_PATH)/doxygen_postprocessing.py $(>) $(<)
python $(THIS_PATH)/doxygen_postprocessing.py "$(>)"
}
boostbook histogram
notfile reference-pp : @doxygen-postprocessing : reference.xml ;
xml histogram
:
histogram.qbk
:
<dependency>reference-pp
;
path-constant images_location : html ;
boostbook standalone
:
histogram
:
<xsl:param>boost.root=../../../..
<xsl:param>boost.libraries=../../../libraries.htm
@ -49,10 +64,14 @@ boostbook histogram
<xsl:param>chunk.first.sections=1
<xsl:param>generate.toc="chapter nop section toc"
<xsl:param>toc.section.depth=3
<dependency>reference_pp.xml
<format>pdf:<xsl:param>img.src.path=$(images_location)/
<format>pdf:<xsl:param>boost.url.prefix="http://www.boost.org/doc/libs/release/doc/html"
;
alias boostdoc ;
alias boostdoc
:
histogram
;
explicit boostdoc ;
alias boostrelease : histogram ;
alias boostrelease ;
explicit boostrelease ;

View File

@ -46,7 +46,10 @@ def is_deprecated(x):
return False
tree = ET.parse(sys.argv[1])
input_file = sys.argv[1]
output_file = input_file.replace(".xml", "_pp.xml")
tree = ET.parse(input_file)
root = tree.getroot()
parent_map = {c: p for p in tree.iter() for c in p}
@ -75,11 +78,20 @@ for item in select(is_detail, "type"):
# hide everything that's deprecated
for item in select(is_deprecated, "typedef"):
parent = parent_map[item]
log("removing deprecated", item.tag, item.get("name"), "from", parent.tag, parent.get("name"))
log(
"removing deprecated",
item.tag,
item.get("name"),
"from",
parent.tag,
parent.get("name"),
)
parent.remove(item)
# hide private member functions
for item in select(lambda x: x.get("name") == "private member functions", "method-group"):
for item in select(
lambda x: x.get("name") == "private member functions", "method-group"
):
parent = parent_map[item]
log("removing private member functions from", parent.tag, parent.get("name"))
parent.remove(item)
@ -90,8 +102,14 @@ for item in select(lambda x:True, "class", "struct", "function"):
purpose = item.find("purpose")
if purpose is None:
parent = parent_map[item]
log("removing undocumented", item.tag, item.get("name"), "from",
parent.tag, parent.get("name"))
log(
"removing undocumented",
item.tag,
item.get("name"),
"from",
parent.tag,
parent.get("name"),
)
if item in parent_map[item]:
parent_map[item].remove(item)
elif purpose.text.strip().lower() == "implementation detail":
@ -109,8 +127,11 @@ parent_map = {c:p for p in tree.iter() for c in p}
# hide methods and constructors explicitly declared as "implementation detail"
for item in select(is_detail, "constructor", "method"):
name = item.get("name")
log("removing", (item.tag + " " + name) if name is not None else item.tag,
"declared as implementation detail")
log(
"removing",
(item.tag + " " + name) if name is not None else item.tag,
"declared as implementation detail",
)
parent_map[item].remove(item)
tree.write(sys.argv[2])
tree.write(output_file)