Update manual generation

This commit is contained in:
Matthias Krack 2019-03-13 16:51:17 +01:00
parent f95bf01704
commit 264ff465c5
3 changed files with 40 additions and 48 deletions

View file

@ -702,42 +702,27 @@
<h2 align="center">How to generate the CP2K input reference manual</h2>
<ul class="disc">
<li>
Prepare a CP2K executable. It does not matter which type of CP2K executable (e.g. sopt) you are using.
Prepare a CP2K executable. It does not matter which type of CP2K executable (e.g. psmp) you are using,
since running a CP2K executable with the flag <big class="tt">--xml</big> like:
<ul class="none">
<li><big class="tt">cp2k.psmp --xml</big></li>
</ul>
will generate a file named <big class="tt">cp2k_input.xml</big> with an XML dump of the entire CP2K input structure
in the same directory describing all features of the actual CP2K executable.<br/>
That XML output in <big class="tt">cp2k_input.xml</big> has to be transformed to HTML using an XML 2.0 compliant
translator like SAXON. Preferentially, you may want to employ the platform independent Java version of SAXON, which
can be downloaded from <a href="https://sourceforge.net/projects/saxon">https://sourceforge.net/projects/saxon</a>.<br/>
</li>
<li>
Run the CP2K executable with the flag <big class="tt">--xml</big> like:
Alternatively, you can also run the script
<ul class="none">
<li><big class="tt">cp2k.sopt --xml</big></li>
<li><big class="tt">update_manual local psmp</big></li>
</ul>
which will generate a file named <big class="tt">cp2k_input.xml</big> with a XML dump of the CP2K input
structure in the same directory.
in the folder cp2k/tools/manual/ which will perform all steps using the CP2K executable cp2k/exe/local/cp2k.psmp.
</li>
<li>
Copy the XSLT file <big class="tt">cp2k_input.xsl</big> from <big class="tt">cp2k/tools/manual/</big> to
your working directory, if needed.
</li>
<li>
Transform the XML output in <big class="tt">cp2k_input.xml</big> to HTML using a XML 2.0 compliant
translator like SAXON.<br/>
If you have the SAXON package already installed, then just run:
<ul class="none">
<li><big class="tt">saxon -o index.html cp2k_input.xml cp2k_input.xsl</big></li>
</ul>
Alternatively, you may employ the platform independent Java version of SAXON
<ul class="none">
<li><big class="tt">java -jar saxon8.jar -o index.html cp2k_input.xml cp2k_input.xsl</big></li>
</ul>
which can be downloaded from
<a href="https://sourceforge.net/projects/saxon">https://sourceforge.net/projects/saxon</a>.<br/>
The latter choice might be more convenient, if you have the Java Runtime Environment 1.5 or higher installed anyway.<br/>
You may check your installed Java version with:
<ul class="none">
<li><big class="tt">java -version</big></li>
</ul>
</li>
<li>
Launch your favorite web browser and load the <big class="tt">index.html</big> file generated in the
previous step.
Launch your favorite web browser and load the generated <big class="tt">index.html</big> file, e.g. in cp2k/tools/manual/local/psmp
from the previous step.
</li>
<li>
Happy browsing!

View file

@ -1,38 +1,42 @@
#!/bin/sh
echo Update CP2K manual:
cwd=${PWD}
if [[ -z $1 ]]; then
if [[ -z ${regtest} ]]; then
arch=Linux-x86-64-${FORT_C_NAME}
else
arch=Linux-x86-64-${FORT_C_NAME}-regtest
fi
arch=local
else
arch=$1
shift
fi
if [[ -z $1 ]]; then
version=pdbg
version=psmp
else
version=$1
shift
fi
cp2kexe=../../exe/${arch}/cp2k.${version}
echo "CP2K executable: ${cp2kexe}"
cp2kexe=${cwd}/../../exe/${arch}/cp2k.${version}
echo "CP2K executable: ${cp2kexe}"
version_string=$(${cp2kexe} -v | head -1)
if [[ -n $(echo ${version_string} | grep Development) ]]; then
version_string=trunk
else
version_string=$(echo "${version_string}" | awk '{print $3}')
fi
echo Update CP2K manual: ${version_string}
if [[ -z $1 ]]; then
mandir=
mandir=${arch}/${version}
else
mandir=$1
shift
fi
echo "CP2K manual path: ${mandir}"
rm -rf cp2k_input.xml CP2K_INPUT.html index.html references.html units.html generate_manual_howto.html html_tables.html cp2k.vim CP2K_INPUT/
if [[ -s ${cp2kexe} ]]; then
[[ -d ${mandir} ]] && rm -rf ${mandir}
mkdir -p ${mandir}
cp collapsibleList.js cp2k_input.xsl cp2k_manual_logo.png cp2k_manual_logo.svg favicon.png favicon.svg toggle_folding.js xml2htm ../input_editing/vim/vim.xsl ${mandir}
cd ${mandir}
${cp2kexe} --xml
./xml2htm
if [[ -n ${mandir} ]]; then
scp -r cp2k.vim toggle_folding.js cp2k_input.xsl cp2k_input.xml CP2K_INPUT.html html_tables.html index.html references.html units.html generate_manual_howto.html favicon.png CP2K_INPUT/ ${mandir}
fi
./xml2htm ${version_string}
echo "CP2K manual update done."
cd ${cwd} >/dev/null
else
echo "ERROR in $(basename $0): CP2K executable file ${cp2kexe} not found"
fi

View file

@ -2,7 +2,10 @@
# Provide path to saxon
# Java version from http://sourceforge.net/projects/saxon
export SAXON=~/bin/saxon9he.jar
version=$(basename ${PWD%/cp2k/tools/manual})
java -Xmx256m -jar $SAXON -o:index.html cp2k_input.xml cp2k_input.xsl add_edit_links=no version=${version}
if [[ -z $1 ]]; then
java -Xmx256m -jar $SAXON -o:index.html cp2k_input.xml cp2k_input.xsl add_edit_links=no
else
java -Xmx256m -jar $SAXON -o:index.html cp2k_input.xml cp2k_input.xsl add_edit_links=no version=$1
fi
# Update the CP2K syntax file for the (g)vim editor
java -Xmx256m -jar $SAXON -o:cp2k.vim cp2k_input.xml ../input_editing/vim/vim.xsl
java -Xmx256m -jar $SAXON -o:cp2k.vim cp2k_input.xml vim.xsl