diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index a6dee79..203f93d 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,5 +1,5 @@ ## -## Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +## Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics ## Laboratory LLC. ## ## This file is part of the Asynchronous Network Management System (ANMS). @@ -37,23 +37,38 @@ jobs: contents: read steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 submodules: recursive - name: Set up OS run: | - sudo rm /var/lib/man-db/auto-update - sudo apt-get update && sudo apt-get install -y cmake make coreutils ruby asciidoctor graphviz inkscape dblatex docbook-xsl-ns xsltproc xmlstarlet - sudo gem install asciidoctor-diagram + sudo apt-get update + sudo apt-get install -y \ + cmake make coreutils \ + ruby asciidoctor graphviz plantuml inkscape \ + dblatex xmlstarlet aspell + sudo gem install \ + asciidoctor-diagram \ + 'asciidoctor-diagram-plantuml:~>1.2024.8' - name: Build env: DESTDIR: public run: ./build.sh - - uses: actions/upload-artifact@v4 + - name: Misspelling + run: ./build.sh docs-spelling + - uses: actions/upload-artifact@v7 with: name: docs path: public + - uses: actions/upload-artifact@v7 + with: + archive: false + path: public/product-guide/anms-product-guide.pdf + - uses: actions/upload-artifact@v7 + with: + archive: false + path: public/user-guide/anms-user-guide.pdf deploy: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages @@ -73,16 +88,16 @@ jobs: if: github.ref == 'refs/heads/main' runs-on: ubuntu-24.04 steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: name: docs path: public - name: Setup Pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v6 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v5 with: path: public - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v5 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f81dd30..e7fa1a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ ## -## Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +## Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics ## Laboratory LLC. ## ## This file is part of the Asynchronous Network Management System (ANMS). diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e0e66b..1fdbede 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ #[[ -Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics Laboratory LLC. This file is part of the Asynchronous Network Management System (ANMS). @@ -24,10 +24,24 @@ cmake_minimum_required(VERSION 3.16) project(anms-docs LANGUAGES ) set(CMAKE_INSTALL_PREFIX "") +include(FetchContent) +FetchContent_Declare( + xsltng + URL https://codeberg.org/DocBook/xslTNG/releases/download/2.8.0/docbook-xslTNG-2.8.0.zip + URL_HASH SHA256=adbbddbf33a4fcc5c949a2851cac53e8111d30a5fd0b32429eeec68aedb61efd + DOWNLOAD_EXTRACT_TIMESTAMP OFF +) +FetchContent_MakeAvailable(xsltng) +file(GLOB xsltng_JAR "${xsltng_SOURCE_DIR}/libs/*.jar") +if(NOT xsltng_JAR) + message(FATAL_ERROR "No xslTNG jar file found under ${xsltng_SOURCE_DIR}") +endif(NOT xsltng_JAR) + add_subdirectory(user-guide) add_subdirectory(product-guide) install( - FILES index.html + FILES deploy-index.html + RENAME index.html DESTINATION . ) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 2549162..c66db18 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,5 +1,5 @@ - + Index diff --git a/product-guide/CMakeLists.txt b/product-guide/CMakeLists.txt index 6a30db6..9802c55 100644 --- a/product-guide/CMakeLists.txt +++ b/product-guide/CMakeLists.txt @@ -1,5 +1,5 @@ #[[ -Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics Laboratory LLC. This file is part of the Asynchronous Network Management System (ANMS). @@ -42,98 +42,157 @@ endif() set(OUT_DOCINFO "docinfo.xml") configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}.in" - "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}" - @ONLY + "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}.in" + "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}" + @ONLY ) -set(OUT_DBOOK "manual.docbook.xml") +set(OUT_DBOOK "${CMAKE_CURRENT_BINARY_DIR}/manual.docbook.xml") add_custom_command( - OUTPUT ${OUT_DBOOK} - DEPENDS ${ADOC_SOURCE} ${ADOC_EXTRAS} ${OUT_DOCINFO} - COMMAND - ${ASCIIDOC} -v -r asciidoctor-diagram - --base-dir ${CMAKE_CURRENT_SOURCE_DIR} - --destination-dir ${CMAKE_CURRENT_BINARY_DIR} - -o ${OUT_DBOOK} + OUTPUT ${OUT_DBOOK} + DEPENDS ${ADOC_SOURCE} ${ADOC_EXTRAS} ${OUT_DOCINFO} + COMMAND + ${ASCIIDOC} -v -r asciidoctor-diagram + --base-dir ${CMAKE_CURRENT_SOURCE_DIR} + --destination-dir ${CMAKE_CURRENT_BINARY_DIR} + -o ${OUT_DBOOK} ${ADOC_SOURCE} ) # Place source images into build directory set(INSTALL_IMGS ${CMAKE_CURRENT_SOURCE_DIR}/install_imgs.sh) add_custom_target( - ${PROJECT_NAME}-img-bin - DEPENDS ${INSTALL_IMGS} ${OUT_DBOOK} - COMMAND ${INSTALL_IMGS} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${OUT_DBOOK} + ${PROJECT_NAME}-img-bin + DEPENDS ${INSTALL_IMGS} ${OUT_DBOOK} + COMMAND + ${INSTALL_IMGS} ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} ${OUT_DBOOK} ) -find_program(XSLTPROC xsltproc REQUIRED) -set(HTML_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/xhtml-opts.xsl") +find_program(JAVA_BIN java REQUIRED) find_program(XMLSTARLET xmlstarlet REQUIRED) +set(HTML_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/xhtml-opts.xsl") +set(MANUAL_CSS "${CMAKE_CURRENT_SOURCE_DIR}/manual.css") +set(DOCBOOK_CSS_FILES + "docbook.css" "docbook-paged.css" + "docbook-toc.css" "pygments.css" +) +set(DOCBOOK_JS_FILES "copy-verbatim.js" "persistent-toc.js") +set(OUT_MANUAL_CSS "html/css/manual.css") set(OUT_HTML "html/index.html") -set(OUT_CSS "html/docbook.css") + +configure_file( + "xml-catalog.xml.in" + "xml-catalog.xml" + @ONLY +) add_custom_command( - OUTPUT ${OUT_HTML} - BYPRODUCTS ${OUT_CSS} - DEPENDS ${OUT_DBOOK} ${HTML_XSLT} - COMMAND ${XSLTPROC} -o ${OUT_HTML} ${HTML_XSLT} ${OUT_DBOOK} + OUTPUT ${OUT_HTML} + DEPENDS ${OUT_DBOOK} "xml-catalog.xml" ${HTML_XSLT} + COMMAND + ${JAVA_BIN} -jar ${xsltng_JAR} + -catalog:xml-catalog.xml -xsl:${HTML_XSLT} + -o:${OUT_HTML} ${OUT_DBOOK} ) -# Place needed images into HTML tree +# Place needed files into HTML tree +add_custom_command( + OUTPUT ${OUT_MANUAL_CSS} + DEPENDS ${MANUAL_CSS} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MANUAL_CSS} ${OUT_MANUAL_CSS} + COMMENT "Copy manual.css" +) +set(OUT_DOCBOOK_FILES "") +foreach(FILENAME ${DOCBOOK_CSS_FILES}) + set(INPATH "${xsltng_SOURCE_DIR}/resources/css/${FILENAME}") + set(OUTPATH "html/css/${FILENAME}") + add_custom_command( + OUTPUT ${OUTPATH} + DEPENDS ${INPATH} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPATH} ${OUTPATH} + COMMENT "Copy css/${FILENAME}" + ) + list(APPEND OUT_DOCBOOK_FILES ${OUTPATH}) +endforeach() +foreach(FILENAME ${DOCBOOK_JS_FILES}) + set(INPATH "${xsltng_SOURCE_DIR}/resources/js/${FILENAME}") + set(OUTPATH "html/js/${FILENAME}") + add_custom_command( + OUTPUT ${OUTPATH} + DEPENDS ${INPATH} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPATH} ${OUTPATH} + COMMENT "Copy js/${FILENAME}" + ) + list(APPEND OUT_DOCBOOK_FILES ${OUTPATH}) +endforeach() add_custom_target( - ${PROJECT_NAME}-img-html - DEPENDS ${INSTALL_IMGS} ${OUT_HTML} ${PROJECT_NAME}-img-bin - COMMAND ${INSTALL_IMGS} ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/html" + ${PROJECT_NAME}-img-html + DEPENDS ${INSTALL_IMGS} ${OUT_HTML} ${PROJECT_NAME}-img-bin + COMMAND + ${INSTALL_IMGS} ${CMAKE_CURRENT_BINARY_DIR} + "${CMAKE_CURRENT_BINARY_DIR}/html" ) add_custom_target( - ${PROJECT_NAME}-html ALL - DEPENDS ${OUT_HTML} ${PROJECT_NAME}-img-html + ${PROJECT_NAME}-html ALL + DEPENDS + ${OUT_HTML} ${OUT_MANUAL_CSS} ${OUT_DOCBOOK_FILES} ${PROJECT_NAME}-img-html ) install( - DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" - DESTINATION ${PROJECT_NAME} -) - - -# spellcheck on HTML output -set(DICTIONARY_TXT "${CMAKE_CURRENT_SOURCE_DIR}/dictionary.txt") -set(SPELLCHECK_XSL "${CMAKE_CURRENT_SOURCE_DIR}/spellcheck.xsl") -set(MISSPELLING_TXT "misspelling.txt") -add_custom_command( - OUTPUT "dictionary.cwl" - DEPENDS "${DICTIONARY_TXT}" - COMMAND cat "${DICTIONARY_TXT}" | - ${ASPELL} --lang=en create master "./dictionary.cwl" -) -add_custom_command( - OUTPUT "${MISSPELLING_TXT}" - DEPENDS "${OUT_HTML}" "${SPELLCHECK_XSL}" "dictionary.cwl" - COMMAND ${XMLSTARLET} tr "${SPELLCHECK_XSL}" "${OUT_HTML}" | - ${ASPELL} --mode=html --lang=EN_US --extra-dicts=./dictionary.cwl list | - sort | uniq > "${MISSPELLING_TXT}" -) -add_custom_target( - ${PROJECT_NAME}-misspelling ALL - DEPENDS "${MISSPELLING_TXT}" - COMMAND cat "${MISSPELLING_TXT}" - # success means file is present and empty - COMMAND test -f "${MISSPELLING_TXT}" -a ! -s "${MISSPELLING_TXT}" - COMMENT "Checking ${MISSPELLING_TXT}" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" + DESTINATION ${PROJECT_NAME} ) +if(XMLSTARLET AND ASPELL) + # spellcheck on HTML output + set(DICTIONARY_TXT "${CMAKE_CURRENT_SOURCE_DIR}/dictionary.txt") + set(SPELLCHECK_XSL "${CMAKE_CURRENT_SOURCE_DIR}/spellcheck.xsl") + add_custom_command( + OUTPUT "dictionary.cwl" + DEPENDS "${DICTIONARY_TXT}" + COMMAND cat "${DICTIONARY_TXT}" | + ${ASPELL} --lang=en create master "./dictionary.cwl" + ) + add_custom_command( + OUTPUT "misspelling.txt" + DEPENDS + "${OUT_HTML}" "${SPELLCHECK_XSL}" "dictionary.cwl" + COMMAND + ${XMLSTARLET} tr "${SPELLCHECK_XSL}" "${OUT_HTML}" | + ${ASPELL} --mode=html --lang=EN_US --extra-dicts=./dictionary.cwl list | + sort -u >"misspelling.txt" + ) + add_custom_command( + OUTPUT "misspelling-ctx.txt" + DEPENDS + "${OUT_HTML}" "misspelling.txt" + COMMAND + ${XMLSTARLET} fo "${OUT_HTML}" | + grep --file "misspelling.txt" >"misspelling-ctx.txt" || true + ) + add_custom_target( + ${PROJECT_NAME}-misspelling ALL + DEPENDS "misspelling.txt" "misspelling-ctx.txt" + ) +endif(XMLSTARLET AND ASPELL) # PDF document output find_program(DBLATEX dblatex REQUIRED) -set(PDF_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/pdf-opts.xsl") -set(OUT_PDF "manual.pdf") -add_custom_command( - OUTPUT ${OUT_PDF} - DEPENDS ${OUT_DBOOK} ${PDF_XSLT} ${PROJECT_NAME}-img-bin - COMMAND ${DBLATEX} -o ${OUT_PDF} --xsl-user=${PDF_XSLT} ${OUT_DBOOK} -) -add_custom_target( - ${PROJECT_NAME}-pdf ALL - DEPENDS ${OUT_PDF} -) -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/${OUT_PDF}" - DESTINATION ${PROJECT_NAME} -# RENAME "ANMS Product Guide v${PROJECT_VERSION}.pdf" -) +if(DBLATEX) + set(PDF_STYLE "${CMAKE_CURRENT_SOURCE_DIR}/manual.sty") + set(PDF_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/pdf-opts.xsl") + set(OUT_PDF "manual.pdf") + add_custom_command( + OUTPUT ${OUT_PDF} + DEPENDS ${OUT_DBOOK} ${PDF_STYLE} ${PDF_XSLT} ${PROJECT_NAME}-img-bin + COMMAND + ${DBLATEX} + --texstyle=${PDF_STYLE} --xsl-user=${PDF_XSLT} + -o ${OUT_PDF} ${OUT_DBOOK} + ) + add_custom_target( + ${PROJECT_NAME}-pdf ALL + DEPENDS ${OUT_PDF} + ) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/${OUT_PDF}" + RENAME "anms-product-guide.pdf" + DESTINATION ${PROJECT_NAME} + ) +endif(DBLATEX) diff --git a/product-guide/dictionary.txt b/product-guide/dictionary.txt index 0cdc7b5..473a986 100644 --- a/product-guide/dictionary.txt +++ b/product-guide/dictionary.txt @@ -75,6 +75,7 @@ TBD TCP testenv TLS +toc transcoder transcoding tshark diff --git a/product-guide/install_imgs.sh b/product-guide/install_imgs.sh index 3cc9946..fcc222f 100755 --- a/product-guide/install_imgs.sh +++ b/product-guide/install_imgs.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash ## -## Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +## Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics ## Laboratory LLC. ## ## This file is part of the Asynchronous Network Management System (ANMS). @@ -24,14 +24,14 @@ SRCDIR=$1 OUTDIR=$2 DBOOKFILE=$3 -if [ -z "${DBOOKFILE}" ] +if [[ -z "${DBOOKFILE}" ]] then FILENAMES="" for HTMLFILE in ${OUTDIR}/*.html do - echo "Scanning ${HTMLFILE}" - THESENAMES=$(xmlstarlet sel -N xhtml=http://www.w3.org/1999/xhtml -t -v '//xhtml:img/@src' -n "${HTMLFILE}") - FILENAMES="${FILENAMES} ${THESENAMES}" + echo "Scanning ${HTMLFILE}" + THESENAMES=$(xmlstarlet sel -N xhtml=http://www.w3.org/1999/xhtml -t -v '//xhtml:img/@src' -n "${HTMLFILE}") + FILENAMES="${FILENAMES} ${THESENAMES}" done else FILENAMES=$(xmlstarlet sel -N db=http://docbook.org/ns/docbook -t -v '//db:imagedata/@fileref' -n "${DBOOKFILE}") @@ -40,7 +40,7 @@ fi for FN in ${FILENAMES} do SRCFN="${SRCDIR}/${FN}" - if [ ! -f "${SRCFN}" ] + if [[ ! -f "${SRCFN}" ]] then continue fi diff --git a/product-guide/manual.css b/product-guide/manual.css new file mode 100644 index 0000000..a08eb12 --- /dev/null +++ b/product-guide/manual.css @@ -0,0 +1,78 @@ +/* +Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics +Laboratory LLC. + +This file is part of the Asynchronous Network Management System (ANMS). + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +This work was performed for the Jet Propulsion Laboratory, California +Institute of Technology, sponsored by the United States Government under +the prime contract 80NM0018D0004 between the Caltech and NASA under +subcontract 1658085. +*/ +:root { + background-color: #f8f8f8; +} + +main { + padding-top: 0em; + padding-left: 1em; + padding-right: 1em; + background-color: #ffffff; + --background-color: #ffffff; + --header-color: #ffffff; +} + +div.legalnotice { + margin: 0.5em; + padding: 0.5em; +} +div.legalnotice header { + margin-top: 1em; +} + +div.revhistory div.title, div.revhistory ul { + border-bottom-style: solid; + border-bottom-width: 1px; + border-bottom-color: #808080; +} +div.revhistory p { + margin-top: 8px; + margin-bottom: 8px; +} + +ul.toc { + padding-left: 1em; +} +ul.toc li { + padding-left: 1em; +} + +div.varlistentry dt { + font-weight: bold; +} +div.varlistentry dd p { + margin-top: 0; +} + +td p { + margin-top: 4px; + margin-bottom: 4px; +} + +div.figure { + border-color: #c8c8c8; +} + +div.qanda div.question { + font-weight: bold; +} diff --git a/product-guide/manual.sty b/product-guide/manual.sty new file mode 100644 index 0000000..4da3275 --- /dev/null +++ b/product-guide/manual.sty @@ -0,0 +1,40 @@ +%% +%% This style is derivated from the docbook one +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{mystyle}[2007/04/04 My DocBook Style] + +%% Just use the original package and pass the options +\RequirePackageWithOptions{docbook} + +%% Allow "json" source files +\lstdefinelanguage{json}{ + basicstyle=\normalfont\small\ttfamily, + numbers=left, + numberstyle=\scriptsize, + stepnumber=1, + numbersep=8pt, + showstringspaces=false, + breaklines=true, + frame=lines, + string=[s]{"}{"}, + comment=[l]{:[}, + morecomment=[l]{:"}, + literate= + *{0}{{{\color{red}0}}}{1} + {1}{{{\color{red}1}}}{1} + {2}{{{\color{red}2}}}{1} + {3}{{{\color{red}3}}}{1} + {4}{{{\color{red}4}}}{1} + {5}{{{\color{red}5}}}{1} + {6}{{{\color{red}6}}}{1} + {7}{{{\color{red}7}}}{1} + {8}{{{\color{red}8}}}{1} + {9}{{{\color{red}9}}}{1} + {:}{{{\color{black}:}}}{1} + {,}{{{\color{black},}}}{1} + {\{}{{{\color{black}\{}}}{1} + {\}}{{{\color{black}\}}}}{1} + {[}{{{\color{black}[}}}{1} + {]}{{{\color{black}]}}}{1}, +} \ No newline at end of file diff --git a/product-guide/pdf-opts.xsl b/product-guide/pdf-opts.xsl index 11b7d80..af963bb 100644 --- a/product-guide/pdf-opts.xsl +++ b/product-guide/pdf-opts.xsl @@ -1,5 +1,11 @@ + letterpaper + 0.75in + 0.75in + 0.75in + 0.75in + 0 1 2 diff --git a/product-guide/sort_dictionary.sh b/product-guide/sort_dictionary.sh index dc2a49e..6bf52e0 100755 --- a/product-guide/sort_dictionary.sh +++ b/product-guide/sort_dictionary.sh @@ -1,6 +1,6 @@ #!/bin/bash ## -## Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +## Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics ## Laboratory LLC. ## ## This file is part of the Asynchronous Network Management System (ANMS). diff --git a/product-guide/xhtml-opts.xsl b/product-guide/xhtml-opts.xsl index 118b331..3dc4443 100644 --- a/product-guide/xhtml-opts.xsl +++ b/product-guide/xhtml-opts.xsl @@ -1,22 +1,23 @@ - - - + + + - 0 - 1 - 1 - 2 - -book toc,title,figure,table,example,equation - + css/manual.css + - 0 - + list + component section + 2 + - none - 1 - 0 + + none diff --git a/product-guide/xml-catalog.xml.in b/product-guide/xml-catalog.xml.in new file mode 100644 index 0000000..94b985d --- /dev/null +++ b/product-guide/xml-catalog.xml.in @@ -0,0 +1,8 @@ + + + + + + diff --git a/user-guide/CMakeLists.txt b/user-guide/CMakeLists.txt index e54b3f2..04ee805 100644 --- a/user-guide/CMakeLists.txt +++ b/user-guide/CMakeLists.txt @@ -1,5 +1,5 @@ #[[ -Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics Laboratory LLC. This file is part of the Asynchronous Network Management System (ANMS). @@ -27,6 +27,7 @@ project(${DIRNAME} VERSION 0 LANGUAGES ) # File paths set(ADOC_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/manual.adoc") +file(GLOB ADOC_EXTRAS "images/*.png") find_program(ASCIIDOC asciidoctor REQUIRED) @@ -37,98 +38,157 @@ endif() set(OUT_DOCINFO "docinfo.xml") configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}.in" - "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}" - @ONLY + "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}.in" + "${CMAKE_CURRENT_SOURCE_DIR}/${OUT_DOCINFO}" + @ONLY ) -set(OUT_DBOOK "manual.docbook.xml") +set(OUT_DBOOK "${CMAKE_CURRENT_BINARY_DIR}/manual.docbook.xml") add_custom_command( - OUTPUT ${OUT_DBOOK} - DEPENDS ${ADOC_SOURCE} ${OUT_DOCINFO} - COMMAND - ${ASCIIDOC} -v -r asciidoctor-diagram - --base-dir ${CMAKE_CURRENT_SOURCE_DIR} - --destination-dir ${CMAKE_CURRENT_BINARY_DIR} - -o ${OUT_DBOOK} + OUTPUT ${OUT_DBOOK} + DEPENDS ${ADOC_SOURCE} ${ADOC_EXTRAS} ${OUT_DOCINFO} + COMMAND + ${ASCIIDOC} -v -r asciidoctor-diagram + --base-dir ${CMAKE_CURRENT_SOURCE_DIR} + --destination-dir ${CMAKE_CURRENT_BINARY_DIR} + -o ${OUT_DBOOK} ${ADOC_SOURCE} ) # Place source images into build directory set(INSTALL_IMGS ${CMAKE_CURRENT_SOURCE_DIR}/install_imgs.sh) add_custom_target( - ${PROJECT_NAME}-img-bin - DEPENDS ${INSTALL_IMGS} ${OUT_DBOOK} - COMMAND ${INSTALL_IMGS} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${OUT_DBOOK} + ${PROJECT_NAME}-img-bin + DEPENDS ${INSTALL_IMGS} ${OUT_DBOOK} + COMMAND + ${INSTALL_IMGS} ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} ${OUT_DBOOK} ) -find_program(XSLTPROC xsltproc REQUIRED) -set(HTML_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/xhtml-opts.xsl") +find_program(JAVA_BIN java REQUIRED) find_program(XMLSTARLET xmlstarlet REQUIRED) +set(HTML_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/xhtml-opts.xsl") +set(MANUAL_CSS "${CMAKE_CURRENT_SOURCE_DIR}/manual.css") +set(DOCBOOK_CSS_FILES + "docbook.css" "docbook-paged.css" + "docbook-toc.css" "pygments.css" +) +set(DOCBOOK_JS_FILES "copy-verbatim.js" "persistent-toc.js") +set(OUT_MANUAL_CSS "html/css/manual.css") set(OUT_HTML "html/index.html") -set(OUT_CSS "html/docbook.css") + +configure_file( + "xml-catalog.xml.in" + "xml-catalog.xml" + @ONLY +) add_custom_command( - OUTPUT ${OUT_HTML} - BYPRODUCTS ${OUT_CSS} - DEPENDS ${OUT_DBOOK} ${HTML_XSLT} - COMMAND ${XSLTPROC} -o ${OUT_HTML} ${HTML_XSLT} ${OUT_DBOOK} + OUTPUT ${OUT_HTML} + DEPENDS ${OUT_DBOOK} "xml-catalog.xml" ${HTML_XSLT} + COMMAND + ${JAVA_BIN} -jar ${xsltng_JAR} + -catalog:xml-catalog.xml -xsl:${HTML_XSLT} + -o:${OUT_HTML} ${OUT_DBOOK} ) -# Place needed images into HTML tree +# Place needed files into HTML tree +add_custom_command( + OUTPUT ${OUT_MANUAL_CSS} + DEPENDS ${MANUAL_CSS} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MANUAL_CSS} ${OUT_MANUAL_CSS} + COMMENT "Copy manual.css" +) +set(OUT_DOCBOOK_FILES "") +foreach(FILENAME ${DOCBOOK_CSS_FILES}) + set(INPATH "${xsltng_SOURCE_DIR}/resources/css/${FILENAME}") + set(OUTPATH "html/css/${FILENAME}") + add_custom_command( + OUTPUT ${OUTPATH} + DEPENDS ${INPATH} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPATH} ${OUTPATH} + COMMENT "Copy css/${FILENAME}" + ) + list(APPEND OUT_DOCBOOK_FILES ${OUTPATH}) +endforeach() +foreach(FILENAME ${DOCBOOK_JS_FILES}) + set(INPATH "${xsltng_SOURCE_DIR}/resources/js/${FILENAME}") + set(OUTPATH "html/js/${FILENAME}") + add_custom_command( + OUTPUT ${OUTPATH} + DEPENDS ${INPATH} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPATH} ${OUTPATH} + COMMENT "Copy js/${FILENAME}" + ) + list(APPEND OUT_DOCBOOK_FILES ${OUTPATH}) +endforeach() add_custom_target( - ${PROJECT_NAME}-img-html - DEPENDS ${INSTALL_IMGS} ${OUT_HTML} ${PROJECT_NAME}-img-bin - COMMAND ${INSTALL_IMGS} ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/html" + ${PROJECT_NAME}-img-html + DEPENDS ${INSTALL_IMGS} ${OUT_HTML} ${PROJECT_NAME}-img-bin + COMMAND + ${INSTALL_IMGS} ${CMAKE_CURRENT_BINARY_DIR} + "${CMAKE_CURRENT_BINARY_DIR}/html" ) add_custom_target( - ${PROJECT_NAME}-html ALL - DEPENDS ${OUT_HTML} ${PROJECT_NAME}-img-html + ${PROJECT_NAME}-html ALL + DEPENDS + ${OUT_HTML} ${OUT_MANUAL_CSS} ${OUT_DOCBOOK_FILES} ${PROJECT_NAME}-img-html ) install( - DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" - DESTINATION ${PROJECT_NAME} -) - - -# spellcheck on HTML output -set(DICTIONARY_TXT "${CMAKE_CURRENT_SOURCE_DIR}/dictionary.txt") -set(SPELLCHECK_XSL "${CMAKE_CURRENT_SOURCE_DIR}/spellcheck.xsl") -set(MISSPELLING_TXT "misspelling.txt") -add_custom_command( - OUTPUT "dictionary.cwl" - DEPENDS "${DICTIONARY_TXT}" - COMMAND cat "${DICTIONARY_TXT}" | - ${ASPELL} --lang=en create master "./dictionary.cwl" -) -add_custom_command( - OUTPUT "${MISSPELLING_TXT}" - DEPENDS "${OUT_HTML}" "${SPELLCHECK_XSL}" "dictionary.cwl" - COMMAND ${XMLSTARLET} tr "${SPELLCHECK_XSL}" "${OUT_HTML}" | - ${ASPELL} --mode=html --lang=EN_US --extra-dicts=./dictionary.cwl list | - sort | uniq > "${MISSPELLING_TXT}" -) -add_custom_target( - ${PROJECT_NAME}-misspelling ALL - DEPENDS "${MISSPELLING_TXT}" - COMMAND cat "${MISSPELLING_TXT}" - # success means file is present and empty - COMMAND test -f "${MISSPELLING_TXT}" -a ! -s "${MISSPELLING_TXT}" - COMMENT "Checking ${MISSPELLING_TXT}" + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" + DESTINATION ${PROJECT_NAME} ) +if(XMLSTARLET AND ASPELL) + # spellcheck on HTML output + set(DICTIONARY_TXT "${CMAKE_CURRENT_SOURCE_DIR}/dictionary.txt") + set(SPELLCHECK_XSL "${CMAKE_CURRENT_SOURCE_DIR}/spellcheck.xsl") + add_custom_command( + OUTPUT "dictionary.cwl" + DEPENDS "${DICTIONARY_TXT}" + COMMAND cat "${DICTIONARY_TXT}" | + ${ASPELL} --lang=en create master "./dictionary.cwl" + ) + add_custom_command( + OUTPUT "misspelling.txt" + DEPENDS + "${OUT_HTML}" "${SPELLCHECK_XSL}" "dictionary.cwl" + COMMAND + ${XMLSTARLET} tr "${SPELLCHECK_XSL}" "${OUT_HTML}" | + ${ASPELL} --mode=html --lang=EN_US --extra-dicts=./dictionary.cwl list | + sort -u >"misspelling.txt" + ) + add_custom_command( + OUTPUT "misspelling-ctx.txt" + DEPENDS + "${OUT_HTML}" "misspelling.txt" + COMMAND + ${XMLSTARLET} fo "${OUT_HTML}" | + grep --file "misspelling.txt" >"misspelling-ctx.txt" || true + ) + add_custom_target( + ${PROJECT_NAME}-misspelling ALL + DEPENDS "misspelling.txt" "misspelling-ctx.txt" + ) +endif(XMLSTARLET AND ASPELL) # PDF document output find_program(DBLATEX dblatex REQUIRED) -set(PDF_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/pdf-opts.xsl") -set(OUT_PDF "manual.pdf") -add_custom_command( - OUTPUT ${OUT_PDF} - DEPENDS ${OUT_DBOOK} ${PDF_XSLT} ${PROJECT_NAME}-img-bin - COMMAND ${DBLATEX} -o ${OUT_PDF} --xsl-user=${PDF_XSLT} ${OUT_DBOOK} -) -add_custom_target( - ${PROJECT_NAME}-pdf ALL - DEPENDS ${OUT_PDF} -) -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/${OUT_PDF}" - DESTINATION ${PROJECT_NAME} -# RENAME "ANMS User Guide v${PROJECT_VERSION}.pdf" -) +if(DBLATEX) + set(PDF_STYLE "${CMAKE_CURRENT_SOURCE_DIR}/manual.sty") + set(PDF_XSLT "${CMAKE_CURRENT_SOURCE_DIR}/pdf-opts.xsl") + set(OUT_PDF "manual.pdf") + add_custom_command( + OUTPUT ${OUT_PDF} + DEPENDS ${OUT_DBOOK} ${PDF_STYLE} ${PDF_XSLT} ${PROJECT_NAME}-img-bin + COMMAND + ${DBLATEX} + --texstyle=${PDF_STYLE} --xsl-user=${PDF_XSLT} + -o ${OUT_PDF} ${OUT_DBOOK} + ) + add_custom_target( + ${PROJECT_NAME}-pdf ALL + DEPENDS ${OUT_PDF} + ) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/${OUT_PDF}" + RENAME "anms-user-guide.pdf" + DESTINATION ${PROJECT_NAME} + ) +endif(DBLATEX) diff --git a/user-guide/dictionary.txt b/user-guide/dictionary.txt index 5ccd132..7ea6b83 100644 --- a/user-guide/dictionary.txt +++ b/user-guide/dictionary.txt @@ -58,6 +58,7 @@ STR submodule tbr timeframe +toc TODO transcode transcoded diff --git a/user-guide/install_imgs.sh b/user-guide/install_imgs.sh index 3cc9946..fcc222f 100755 --- a/user-guide/install_imgs.sh +++ b/user-guide/install_imgs.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash ## -## Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +## Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics ## Laboratory LLC. ## ## This file is part of the Asynchronous Network Management System (ANMS). @@ -24,14 +24,14 @@ SRCDIR=$1 OUTDIR=$2 DBOOKFILE=$3 -if [ -z "${DBOOKFILE}" ] +if [[ -z "${DBOOKFILE}" ]] then FILENAMES="" for HTMLFILE in ${OUTDIR}/*.html do - echo "Scanning ${HTMLFILE}" - THESENAMES=$(xmlstarlet sel -N xhtml=http://www.w3.org/1999/xhtml -t -v '//xhtml:img/@src' -n "${HTMLFILE}") - FILENAMES="${FILENAMES} ${THESENAMES}" + echo "Scanning ${HTMLFILE}" + THESENAMES=$(xmlstarlet sel -N xhtml=http://www.w3.org/1999/xhtml -t -v '//xhtml:img/@src' -n "${HTMLFILE}") + FILENAMES="${FILENAMES} ${THESENAMES}" done else FILENAMES=$(xmlstarlet sel -N db=http://docbook.org/ns/docbook -t -v '//db:imagedata/@fileref' -n "${DBOOKFILE}") @@ -40,7 +40,7 @@ fi for FN in ${FILENAMES} do SRCFN="${SRCDIR}/${FN}" - if [ ! -f "${SRCFN}" ] + if [[ ! -f "${SRCFN}" ]] then continue fi diff --git a/user-guide/manual.css b/user-guide/manual.css new file mode 100644 index 0000000..a08eb12 --- /dev/null +++ b/user-guide/manual.css @@ -0,0 +1,78 @@ +/* +Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics +Laboratory LLC. + +This file is part of the Asynchronous Network Management System (ANMS). + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +This work was performed for the Jet Propulsion Laboratory, California +Institute of Technology, sponsored by the United States Government under +the prime contract 80NM0018D0004 between the Caltech and NASA under +subcontract 1658085. +*/ +:root { + background-color: #f8f8f8; +} + +main { + padding-top: 0em; + padding-left: 1em; + padding-right: 1em; + background-color: #ffffff; + --background-color: #ffffff; + --header-color: #ffffff; +} + +div.legalnotice { + margin: 0.5em; + padding: 0.5em; +} +div.legalnotice header { + margin-top: 1em; +} + +div.revhistory div.title, div.revhistory ul { + border-bottom-style: solid; + border-bottom-width: 1px; + border-bottom-color: #808080; +} +div.revhistory p { + margin-top: 8px; + margin-bottom: 8px; +} + +ul.toc { + padding-left: 1em; +} +ul.toc li { + padding-left: 1em; +} + +div.varlistentry dt { + font-weight: bold; +} +div.varlistentry dd p { + margin-top: 0; +} + +td p { + margin-top: 4px; + margin-bottom: 4px; +} + +div.figure { + border-color: #c8c8c8; +} + +div.qanda div.question { + font-weight: bold; +} diff --git a/user-guide/manual.sty b/user-guide/manual.sty new file mode 100644 index 0000000..4da3275 --- /dev/null +++ b/user-guide/manual.sty @@ -0,0 +1,40 @@ +%% +%% This style is derivated from the docbook one +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{mystyle}[2007/04/04 My DocBook Style] + +%% Just use the original package and pass the options +\RequirePackageWithOptions{docbook} + +%% Allow "json" source files +\lstdefinelanguage{json}{ + basicstyle=\normalfont\small\ttfamily, + numbers=left, + numberstyle=\scriptsize, + stepnumber=1, + numbersep=8pt, + showstringspaces=false, + breaklines=true, + frame=lines, + string=[s]{"}{"}, + comment=[l]{:[}, + morecomment=[l]{:"}, + literate= + *{0}{{{\color{red}0}}}{1} + {1}{{{\color{red}1}}}{1} + {2}{{{\color{red}2}}}{1} + {3}{{{\color{red}3}}}{1} + {4}{{{\color{red}4}}}{1} + {5}{{{\color{red}5}}}{1} + {6}{{{\color{red}6}}}{1} + {7}{{{\color{red}7}}}{1} + {8}{{{\color{red}8}}}{1} + {9}{{{\color{red}9}}}{1} + {:}{{{\color{black}:}}}{1} + {,}{{{\color{black},}}}{1} + {\{}{{{\color{black}\{}}}{1} + {\}}{{{\color{black}\}}}}{1} + {[}{{{\color{black}[}}}{1} + {]}{{{\color{black}]}}}{1}, +} \ No newline at end of file diff --git a/user-guide/pdf-opts.xsl b/user-guide/pdf-opts.xsl index 11b7d80..af963bb 100644 --- a/user-guide/pdf-opts.xsl +++ b/user-guide/pdf-opts.xsl @@ -1,5 +1,11 @@ + letterpaper + 0.75in + 0.75in + 0.75in + 0.75in + 0 1 2 diff --git a/user-guide/sort_dictionary.sh b/user-guide/sort_dictionary.sh index dc2a49e..6bf52e0 100755 --- a/user-guide/sort_dictionary.sh +++ b/user-guide/sort_dictionary.sh @@ -1,6 +1,6 @@ #!/bin/bash ## -## Copyright (c) 2023-2025 The Johns Hopkins University Applied Physics +## Copyright (c) 2023-2026 The Johns Hopkins University Applied Physics ## Laboratory LLC. ## ## This file is part of the Asynchronous Network Management System (ANMS). diff --git a/user-guide/xhtml-opts.xsl b/user-guide/xhtml-opts.xsl index 118b331..3dc4443 100644 --- a/user-guide/xhtml-opts.xsl +++ b/user-guide/xhtml-opts.xsl @@ -1,22 +1,23 @@ - - - + + + - 0 - 1 - 1 - 2 - -book toc,title,figure,table,example,equation - + css/manual.css + - 0 - + list + component section + 2 + - none - 1 - 0 + + none diff --git a/user-guide/xml-catalog.xml.in b/user-guide/xml-catalog.xml.in new file mode 100644 index 0000000..94b985d --- /dev/null +++ b/user-guide/xml-catalog.xml.in @@ -0,0 +1,8 @@ + + + + + +