summaryrefslogtreecommitdiff
path: root/bin/gendoc
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gendoc')
-rwxr-xr-xbin/gendoc101
1 files changed, 101 insertions, 0 deletions
diff --git a/bin/gendoc b/bin/gendoc
new file mode 100755
index 0000000..6b50f9c
--- /dev/null
+++ b/bin/gendoc
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+# This file is part of RTSAdmin Community Edition.
+# Copyright (c) 2011 by RisingTide Systems LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, version 3 (AGPLv3).
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+path=$PWD
+
+rm -rf doc &>/dev/null
+mkdir doc
+cp README COPYING doc/
+cp rtsadmin-doc/rtslogo.* doc/
+
+CSS=../rtsadmin-doc/html4css1.css
+#CSS=../rtsadmin-doc/voidspace.css
+RSTTITLE="rtsadmin_reference"
+TITLE=$RSTTITLE
+#MARK="% generated by Docutils"
+MARK="\documentclass.*"
+./bin/gendoc.py > doc/$TITLE.rst
+
+cd doc
+rst2html $TITLE.rst --stylesheet-path $CSS --embed-stylesheet --no-xml-declaration $TITLE.html
+cat $TITLE.rst | grep -v ".. sectnum::" | grep -v "header::" > $TITLE.rst2
+mv $TITLE.rst2 $TITLE.rst
+
+rst2latex $RSTTITLE.rst --toc-entry-backlinks --compound-enumerators --use-verbatim-when-possible --use-latex-toc --section-numbering --documentclass article --documentoptions "10pt,a4paper" --use-latex-toc --use-latex-docinfo --hyperlink-color black $TITLE.tex
+
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{fancyhdr}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{lastpage}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{color}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{titlesec}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\pagestyle{fancy}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\\definecolor{rtsblue}{RGB}{79,130,189}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\rhead{\\\includegraphics[height=13pt]{rtslogo.eps}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\chead{}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\lhead{\\\leftmark}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\headrule}{{\\\color{rtsblue}\\\hrule width\\\headwidth height\\\headrulewidth \\\vskip-\\\headrulewidth}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\cfoot{}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\lfoot{Copyright \\\copyright2009-2010 by RisingTide Systems LLC}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\rfoot{Page \\\thepage\\\ of\\\ \\\pageref{LastPage}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\footrule}{{\\\color{rtsblue}\\\hrule width\\\headwidth height\\\headrulewidth \\\vskip-\\\headrulewidth}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\headrulewidth}{0.4pt}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\footrulewidth}{0.4pt}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\\titleformat{\\\chapter}\[display\]{\\\color{rtsblue}\\\normalfont\\\huge\\\bfseries}{\\\chaptertitlename\\\thechapter}{20pt}{\\\Huge}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\\titleformat{\\\section}{\\\color{rtsblue}\\\normalfont\\\Large\\\bfseries}{\\\thesection}{1em}{}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\\titleformat{\\\subsection}{\\\color{rtsblue}\\\normalfont\\\large\\\bfseries}{\\\thesubsection}{1em}{}/g" $TITLE.tex
+
+# once for generating the formatting
+latex $TITLE.tex $TITLE.dvi
+# once more for the TOC
+latex $TITLE.tex $TITLE.dvi
+# And now get the labels right
+latex $TITLE.tex $TITLE.dvi
+dvipdf $TITLE.dvi $TITLE.pdf
+
+TITLE="rtsadmin_reference_for_print"
+
+rst2latex $RSTTITLE.rst --toc-entry-backlinks --compound-enumerators --use-verbatim-when-possible --use-latex-toc --section-numbering --documentclass book --documentoptions "10pt,a4paper" --use-latex-toc --use-latex-docinfo --hyperlink-color black $TITLE.tex
+
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{fancyhdr}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{lastpage}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{color}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\usepackage{titlesec}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\\definecolor{rtsblue}{RGB}{79,130,189}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\pagestyle{fancy}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\rhead{\\\includegraphics[height=13pt]{rtslogo.eps}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\chead{}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\lhead{\\\leftmark}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\headrule}{{\\\color{rtsblue}\\\hrule width\\\headwidth height\\\headrulewidth \\\vskip-\\\headrulewidth}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\cfoot{}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\lfoot{Copyright \\\copyright2009-2010 by RisingTide Systems LLC}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\rfoot{Page \\\thepage\\\ of\\\ \\\pageref{LastPage}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\footrule}{{\\\color{rtsblue}\\\hrule width\\\headwidth height\\\headrulewidth \\\vskip-\\\headrulewidth}}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\headrulewidth}{0.4pt}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\renewcommand{\\\footrulewidth}{0.4pt}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\\titleformat{\\\chapter}\[display\]{\\\color{rtsblue}\\\normalfont\\\huge\\\bfseries}{\\\chaptertitlename\\\thechapter}{20pt}{\\\Huge}/g" $TITLE.tex
+perl -pi -e "s/\($MARK\)/\1\n\\\\titleformat{\\\section}{\\\color{rtsblue}\\\normalfont\\\Large\\\bfseries}{\\\thesection}{1em}{}/g" $TITLE.tex
+
+# once for generating the formatting
+latex $TITLE.tex $TITLE.dvi
+# once more for the TOC
+latex $TITLE.tex $TITLE.dvi
+# And now get the labels right
+latex $TITLE.tex $TITLE.dvi
+dvipdf $TITLE.dvi $TITLE.pdf
+
+
+cd ..
+