Skip to content

Commit

Permalink
Tidied doc generation more.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Mar 22, 2017
1 parent 308c35f commit 590ef62
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 77 deletions.
17 changes: 7 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
# python bytecode
*.pyc

# generated documentation
doc/commands/
doc/categories/
doc/cylc.txt
doc/commands.tex
doc/graphics/png-scaled/
doc/html/
doc/pdf/
doc/index.html
doc/cylc-version.txt
# Generated documentation files.
# User Guide
doc/src/cylc-user-guide/pdf
doc/src/cylc-user-guide/html
doc/src/cylc-user-guide/commands.tex
doc/src/cylc-user-guide/cylc-version.txt
# Suite Design Guide
*.aux
*.out
*.pdf
Expand Down
1 change: 0 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ clean:

installclean:
rm -r install

28 changes: 3 additions & 25 deletions doc/src/cylc-user-guide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
.PHONY: all pdf html html-multi html-single clean

DEPS := $(shell ./scripts/get-deps.sh)
CYLC = ../../../bin/cylc

all: $(DEPS)

Expand All @@ -30,24 +31,7 @@ html-multi: html/multi/cug-html.html

html-single: html/single/cug-html.html

cylc.txt: ../../../bin/cylc
$< --help > $@

cats = $(shell ../../../bin/cylc categories)
catx = $(cats:%=categories/%.txt)

cmds = $(shell ../../../bin/cylc commands)
cmdx = $(cmds:%=commands/%.txt)

$(cmdx): commands/%.txt: ../../../bin/cylc-%
if test ! -d commands; then mkdir -p commands/; fi
$(patsubst ../../../bin/cylc-%,../../../bin/cylc %,$<) --help > $@

$(catx): categories/%.txt: ../../../bin/cylc
if test ! -d categories; then mkdir -p categories/; fi
../../../bin/cylc $(subst .txt,,$(subst categories/,,$@)) --help > $@

commands.tex: $(cmdx) $(catx) cylc.txt
commands.tex: $(CYLC)-*
./scripts/make-commands.sh

html/multi/cug-html.html: commands.tex cug-html.tex cug.tex suiterc.tex siterc.tex gcylcrc.tex cug-html.cfg
Expand All @@ -60,10 +44,4 @@ pdf/cug-pdf.pdf: commands.tex cug-pdf.tex cug.tex suiterc.tex siterc.tex gcylcrc
- ./scripts/make-pdf.sh

clean:
rm -r pdf \
html \
cylc.txt \
commands \
categories \
commands.tex \
cylc-version.txt
rm -rf pdf html commands.tex cylc-version.txt
27 changes: 18 additions & 9 deletions doc/src/cylc-user-guide/scripts/make-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,40 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

CYLC=../../bin/cylc
# Create cylc-version.txt and commands.tex for inclusion in LaTeX doc.

CYLC=$(dirname $0)/../../../../bin/cylc

$CYLC --version > cylc-version.txt

cat > commands.tex <<END
\label{help}
\lstinputlisting{cylc.txt}
\begin{lstlisting}
$($CYLC --help)
\end{lstlisting}
\subsection{Command Categories}
END

for CAT in $( $CYLC categories ); do
for CAT in $($CYLC categories); do
cat >> commands.tex <<END
\subsubsection{$CAT}
\label{$CAT}
\lstinputlisting{categories/${CAT}.txt}
\begin{lstlisting}
$($CYLC $CAT --help)
\end{lstlisting}
END
done

cat >> commands.tex <<END
\subsection{Commands}
END

for COMMAND in $( $CYLC commands ); do
for COM in $($CYLC commands); do
cat >> commands.tex <<END
\subsubsection{$COMMAND}
\label{$COMMAND}
\lstinputlisting{commands/${COMMAND}.txt}
\subsubsection{$COM}
\label{$COM}
\begin{lstlisting}
$($CYLC $COM --help)
\end{lstlisting}
END
done

22 changes: 4 additions & 18 deletions doc/src/cylc-user-guide/scripts/make-html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

set -e

CYLC=$(dirname $0)/../../../../bin/cylc
# Make HTML Cylc User Guide (called from Makefile).

function usage {
echo "USAGE make-html.sh [multi|single]"
}

if [[ $# != 1 ]]; then
usage
exit 1
fi
set -e

TYPE=$1
if [[ $TYPE != multi ]] && [[ $TYPE != single ]]; then
usage
exit 1
fi
TYPE=$1 # "multi" or "single"

DEST=html/$TYPE
rm -rf $DEST; mkdir -p $DEST

$CYLC -v > cylc-version.txt

cp -r *.tex cug-html.cfg cylc-version.txt titlepic.sty $DEST

cd $DEST
ls *.tex | xargs -n 1 perl -pi -e 's@graphics/png/orig@../../graphics/png/scaled@g'
ls *.tex | xargs -n 1 perl -pi -e 's@\.\./examples/@../../../examples/@g'
Expand Down
16 changes: 3 additions & 13 deletions doc/src/cylc-user-guide/scripts/make-pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

set -e

CYLC=$(dirname $0)/../../../../bin/cylc

function usage {
echo "USAGE make.sh"
}
# Make PDF Cylc User Guide (called from Makefile).

if [[ $# != 0 ]]; then
usage
exit 1
fi
set -e

DEST=pdf
rm -rf $DEST; mkdir -p $DEST

$CYLC -v > cylc-version.txt

cp -r *.tex cylc-version.txt titlepic.sty $DEST

cd $DEST
ls *.tex | xargs -n 1 perl -pi -e 's@graphics/png/orig@../graphics/png/orig@g'
ls *.tex | xargs -n 1 perl -pi -e 's@\.\./examples/@../../examples/@g'
Expand Down
2 changes: 1 addition & 1 deletion doc/src/suite-design-guide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

.PHONY: all
.PHONY: all clean

all: document.pdf

Expand Down

0 comments on commit 590ef62

Please sign in to comment.