diff options
author | Jim Newsome <jnewsome@torproject.org> | 2023-11-09 18:23:30 -0600 |
---|---|---|
committer | Jim Newsome <jnewsome@torproject.org> | 2023-11-09 18:45:20 -0600 |
commit | 72722037eed69e1a05d204c62ed9629f5b571b85 (patch) | |
tree | 135871a7b4049be1d87741f72259f96f82170e24 /bin | |
parent | 1eef207b51ddbb92c2bc4a02ae7b46929583355b (diff) | |
download | torspec-72722037eed69e1a05d204c62ed9629f5b571b85.tar.gz torspec-72722037eed69e1a05d204c62ed9629f5b571b85.zip |
Reorganize output
Adding an additional output plugin to mdbook causes it to create an
extra level of subdirectories in its build directory; one for each
output plugin.
We add an intermediate build directory `build`, and after building the
individual mdbooks, construct the `html` directory with the desired
layout.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/build_html | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/bin/build_html b/bin/build_html index 26fd7d8..0a3d7f6 100755 --- a/bin/build_html +++ b/bin/build_html @@ -18,7 +18,7 @@ cd "${TOPLEVEL}" # and then make changes to that copy. # # When we are done with these changes, we will set some variables: -# - HTML_OUTPUT_DIR is "", or the location where we have put our output. +# - MDBOOK_OUTPUT_DIR is "", or the location where we have put our raw mdbook output. # - MDBOOK_DIR is the parent directory of the possibly modified copies # of mdbook/{spec,proposals}. @@ -36,7 +36,7 @@ if test -n "${MMDC:-}" || command -v "mmdc" >&/dev/null; then TMPDIR=$(mktemp -d "${TOPLEVEL}/tmp_mmdc.XXXXXXXX") trap 'rm -rf "$TMPDIR"' 0 ./bin/mermaid_cvt_svg "$TMPDIR" - HTML_OUTPUT_DIR="$TMPDIR/html" + MDBOOK_OUTPUT_DIR="$TMPDIR/build" MDBOOK_DIR="$TMPDIR/mdbook" elif test -n "${MDBOOK_MERMAID:-}" || command -v "mdbook-mermaid" >&/dev/null; then # CASE 2: mdbook_mermaid is installed. @@ -53,24 +53,26 @@ elif test -n "${MDBOOK_MERMAID:-}" || command -v "mdbook-mermaid" >&/dev/null; t cp -r ./mdbook/proposals ./mdbook/spec ./mdbook/theme "$TMPDIR" mdbook-mermaid install "$TMPDIR/spec" mdbook-mermaid install "$TMPDIR/proposals" - HTML_OUTPUT_DIR="" + MDBOOK_OUTPUT_DIR="" MDBOOK_DIR="$TMPDIR" else # CASE 3: No mermaid support. # # In this case we run mdbook on our inputs unchanged. # The mermaid blocks will render as code. - HTML_OUTPUT_DIR="" + MDBOOK_OUTPUT_DIR="" MDBOOK_DIR="$TOPLEVEL/mdbook" fi -cd "${MDBOOK_DIR}/spec" -$MDBOOK build +$MDBOOK build "${MDBOOK_DIR}/spec" +$MDBOOK build "${MDBOOK_DIR}/proposals" -cd "${MDBOOK_DIR}/proposals" -$MDBOOK build - -if test -n "${HTML_OUTPUT_DIR}"; then - rm -rf "${TOPLEVEL}/html" - mv "${HTML_OUTPUT_DIR}" "${TOPLEVEL}/html" +if test -n "${MDBOOK_OUTPUT_DIR}"; then + rm -rf "${TOPLEVEL}/build" + mv "${MDBOOK_OUTPUT_DIR}" "${TOPLEVEL}/build" fi + +rm -rf "${TOPLEVEL}/html/" +cp -r "${TOPLEVEL}/build/spec/html/" "${TOPLEVEL}" +cp -r "${TOPLEVEL}/build/proposals/html/" "${TOPLEVEL}/html/proposals/" + |