diff --git a/doc/.gitignore b/doc/.gitignore index 7c953d2432..28e583fa0b 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -17,3 +17,10 @@ *.el /utils/sphinx-config/_static/mathjax /utils/sphinx-config/_static/polyfill.js +/src/pairs.rst +/src/bonds.rst +/src/angles.rst +/src/dihedrals.rst +/src/impropers.rst +/src/computes.rst +/src/fixes.rst diff --git a/doc/Makefile b/doc/Makefile index f9f8336665..dda15151a7 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -83,7 +83,11 @@ $(SPHINXCONFIG)/conf.py: $(SPHINXCONFIG)/conf.py.in -e 's,@LAMMPS_PYTHON_DIR@,$(BUILDDIR)/../python,g' \ -e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@ -html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) +globbed-tocs: + @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi + $(SHELL) $(BUILDDIR)/utils/make-globbed-tocs.sh $(RSTDIR) + +html: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @(\ @@ -113,7 +117,7 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @rm -rf html/PDF/.[sg]* @echo "Build finished. The HTML pages are in doc/html." -fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) +fasthtml: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @mkdir -p fasthtml @@ -132,7 +136,7 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @rm -rf fasthtml/PDF/.[sg]* @echo "Fast HTML build finished. The HTML pages are in doc/fasthtml." -spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt +spelling: xmlgen globbed-tocs $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @(\ . $(VENV)/bin/activate ; \ @@ -143,7 +147,7 @@ spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives ) @echo "Spell check finished." -epub: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) +epub: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @mkdir -p epub/JPG @@ -166,7 +170,7 @@ mobi: epub @ebook-convert LAMMPS.epub LAMMPS.mobi @echo "Conversion finished. The MOBI manual file is created." -pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) +pdf: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi diff --git a/doc/src/angles.rst b/doc/src/angles.rst.in similarity index 73% rename from doc/src/angles.rst rename to doc/src/angles.rst.in index c940689d4d..2bf3afc768 100644 --- a/doc/src/angles.rst +++ b/doc/src/angles.rst.in @@ -3,6 +3,4 @@ Angle Styles .. toctree:: :maxdepth: 1 - :glob: - angle_* diff --git a/doc/src/bonds.rst b/doc/src/bonds.rst.in similarity index 73% rename from doc/src/bonds.rst rename to doc/src/bonds.rst.in index 4118e153e9..c66e61ace6 100644 --- a/doc/src/bonds.rst +++ b/doc/src/bonds.rst.in @@ -3,6 +3,4 @@ Bond Styles .. toctree:: :maxdepth: 1 - :glob: - bond_* diff --git a/doc/src/computes.rst b/doc/src/computes.rst.in similarity index 68% rename from doc/src/computes.rst rename to doc/src/computes.rst.in index 8d53b6cf06..9ba0e61576 100644 --- a/doc/src/computes.rst +++ b/doc/src/computes.rst.in @@ -3,6 +3,4 @@ Computes .. toctree:: :maxdepth: 1 - :glob: - compute_* diff --git a/doc/src/dihedrals.rst b/doc/src/dihedrals.rst.in similarity index 72% rename from doc/src/dihedrals.rst rename to doc/src/dihedrals.rst.in index f56e323427..f2818afb17 100644 --- a/doc/src/dihedrals.rst +++ b/doc/src/dihedrals.rst.in @@ -3,6 +3,4 @@ Dihedral Styles .. toctree:: :maxdepth: 1 - :glob: - dihedral_* diff --git a/doc/src/fixes.rst b/doc/src/fixes.rst.in similarity index 69% rename from doc/src/fixes.rst rename to doc/src/fixes.rst.in index eb0215e310..825f278729 100644 --- a/doc/src/fixes.rst +++ b/doc/src/fixes.rst.in @@ -3,6 +3,4 @@ Fixes .. toctree:: :maxdepth: 1 - :glob: - fix_* diff --git a/doc/src/impropers.rst b/doc/src/impropers.rst.in similarity index 72% rename from doc/src/impropers.rst rename to doc/src/impropers.rst.in index a6653fde7d..2ca1e8cf3c 100644 --- a/doc/src/impropers.rst +++ b/doc/src/impropers.rst.in @@ -3,6 +3,4 @@ Improper Styles .. toctree:: :maxdepth: 1 - :glob: - improper_* diff --git a/doc/src/pairs.rst b/doc/src/pairs.rst.in similarity index 73% rename from doc/src/pairs.rst rename to doc/src/pairs.rst.in index b764c74cc7..7ae581382e 100644 --- a/doc/src/pairs.rst +++ b/doc/src/pairs.rst.in @@ -3,6 +3,4 @@ Pair Styles .. toctree:: :maxdepth: 1 - :glob: - pair_* diff --git a/doc/utils/make-globbed-tocs.sh b/doc/utils/make-globbed-tocs.sh new file mode 100755 index 0000000000..29c53cacb3 --- /dev/null +++ b/doc/utils/make-globbed-tocs.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# script to emulate globbed toctrees that allows to skip files that were entered already elsewhere + +if [ $# != 1 ] +then + echo "Usage: $0 " + exit 1 +fi + +RSTDIR="$1" +TMPNAM=${RANDOM} +TMPDIR=${TMPDIR-/tmp} + +# pairs.rst +cp ${RSTDIR}/pairs.rst.in ${TMPDIR}/${TMPNAM}.pairs.rst +for f in $(echo ${RSTDIR}/pair_*.rst | sed -e "s@${RSTDIR}/@@g" -e 's@\.rst@@g' -e 's@pair_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.pairs.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.pairs.rst ${RSTDIR}/pairs.rst || mv -vf ${TMPDIR}/${TMPNAM}.pairs.rst ${RSTDIR}/pairs.rst +rm -f ${TMPDIR}/${TMPNAM}.pairs.rst + +# bonds.rst +cp ${RSTDIR}/bonds.rst.in ${TMPDIR}/${TMPNAM}.bonds.rst +for f in $(echo ${RSTDIR}/bond_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@bond_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.bonds.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.bonds.rst ${RSTDIR}/bonds.rst || mv -vf ${TMPDIR}/${TMPNAM}.bonds.rst ${RSTDIR}/bonds.rst +rm -f ${TMPDIR}/${TMPNAM}.bonds.rst + +# angles.rst +cp ${RSTDIR}/angles.rst.in ${TMPDIR}/${TMPNAM}.angles.rst +for f in $(echo ${RSTDIR}/angle_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@angle_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.angles.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.angles.rst ${RSTDIR}/angles.rst || mv -vf ${TMPDIR}/${TMPNAM}.angles.rst ${RSTDIR}/angles.rst +rm -f ${TMPDIR}/${TMPNAM}.angles.rst + +# dihedrals.rst +cp ${RSTDIR}/dihedrals.rst.in ${TMPDIR}/${TMPNAM}.dihedrals.rst +for f in $(echo ${RSTDIR}/dihedral_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@dihedral_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.dihedrals.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.dihedrals.rst ${RSTDIR}/dihedrals.rst || mv -vf ${TMPDIR}/${TMPNAM}.dihedrals.rst ${RSTDIR}/dihedrals.rst +rm -f ${TMPDIR}/${TMPNAM}.dihedrals.rst + +# impropers.rst +cp ${RSTDIR}/impropers.rst.in ${TMPDIR}/${TMPNAM}.impropers.rst +for f in $(echo ${RSTDIR}/improper_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@improper_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.impropers.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.impropers.rst ${RSTDIR}/impropers.rst || mv -vf ${TMPDIR}/${TMPNAM}.impropers.rst ${RSTDIR}/impropers.rst +rm -f ${TMPDIR}/${TMPNAM}.impropers.rst + +# computes.rst +cp ${RSTDIR}/computes.rst.in ${TMPDIR}/${TMPNAM}.computes.rst +for f in $(echo ${RSTDIR}/compute_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@compute_modify@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.computes.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.computes.rst ${RSTDIR}/computes.rst || mv -vf ${TMPDIR}/${TMPNAM}.computes.rst ${RSTDIR}/computes.rst +rm -f ${TMPDIR}/${TMPNAM}.computes.rst + +# fixs.rst +cp ${RSTDIR}/fixes.rst.in ${TMPDIR}/${TMPNAM}.fixes.rst +for f in $(echo ${RSTDIR}/fix_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@fix_\(modify\|modify_atc_commands\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.fixes.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.fixes.rst ${RSTDIR}/fixes.rst || mv -vf ${TMPDIR}/${TMPNAM}.fixes.rst ${RSTDIR}/fixes.rst +rm -f ${TMPDIR}/${TMPNAM}.fixes.rst