Yay. PDF docs for Jinja2
authorArmin Ronacher <armin.ronacher@active-4.com>
Sun, 6 Feb 2011 11:19:30 +0000 (12:19 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sun, 6 Feb 2011 11:19:30 +0000 (12:19 +0100)
Makefile
docs/conf.py
docs/contents.rst.inc [new file with mode: 0644]
docs/index.rst
docs/jinjastyle.sty [new file with mode: 0644]
docs/latexindex.rst [new file with mode: 0644]
docs/logo.pdf [new file with mode: 0644]

index 29a6b71ac928fd779b14207fd56290c962b12cb2..5ea5669cbe2a28f338cd93b710ae01e3622a4c79 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,10 +3,10 @@ test:
 
 upload-docs:
        $(MAKE) -C docs html dirhtml latex
-       #$(MAKE) -C docs/_build/latex all-pdf
+       $(MAKE) -C docs/_build/latex all-pdf
        cd docs/_build/; mv html jinja-docs; zip -r jinja-docs.zip jinja-docs; mv jinja-docs html
        scp -r docs/_build/dirhtml/* pocoo.org:/var/www/jinja.pocoo.org/docs/
-       #scp -r docs/_build/latex/Jinja.pdf pocoo.org:/var/www/jinja.pocoo.org/docs/jinja-docs.pdf
+       scp -r docs/_build/latex/Jinja.pdf pocoo.org:/var/www/jinja.pocoo.org/docs/jinja-docs.pdf
        scp -r docs/_build/jinja-docs.zip pocoo.org:/var/www/jinja.pocoo.org/docs/
 
 .PHONY: test
index 49f541185032e5adb7df24e5b6cf49fa72e9c75c..0a5157de558f7c221b5730fb15ab747579180ae0 100644 (file)
@@ -119,21 +119,26 @@ latex_paper_size = 'a4'
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title, author, document class [howto/manual]).
 latex_documents = [
-  ('index', 'Jinja2.tex', 'Jinja2 Documentation', 'Armin Ronacher', 'manual', 'toctree_only'),
+  ('latexindex', 'Jinja2.tex', 'Jinja2 Documentation', 'Armin Ronacher',
+   'manual'),
 ]
 
-# Additional stuff for the LaTeX preamble.
-latex_preamble = '''
-\usepackage{palatino}
-\definecolor{TitleColor}{rgb}{0.7,0,0}
-\definecolor{InnerLinkColor}{rgb}{0.7,0,0}
-\definecolor{OuterLinkColor}{rgb}{0.8,0,0}
-\definecolor{VerbatimColor}{rgb}{0.985,0.985,0.985}
-\definecolor{VerbatimBorderColor}{rgb}{0.8,0.8,0.8}
+# Additional stuff for LaTeX
+latex_elements = {
+    'fontpkg':      r'\usepackage{mathpazo}',
+    'papersize':    'a4paper',
+    'pointsize':    '12pt',
+    'preamble':     r'''
+\usepackage{jinjastyle}
+
+% i hate you latex
+\DeclareUnicodeCharacter{14D}{o}
 '''
+}
+
+latex_use_parts = True
 
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
+latex_additional_files = ['jinjastyle.sty', 'logo.pdf']
 
 # If false, no module index is generated.
 latex_use_modindex = False
diff --git a/docs/contents.rst.inc b/docs/contents.rst.inc
new file mode 100644 (file)
index 0000000..35d6d23
--- /dev/null
@@ -0,0 +1,29 @@
+Jinja2 Documentation
+--------------------
+
+.. toctree::
+   :maxdepth: 2
+
+   intro
+   api
+   sandbox
+   templates
+   extensions
+   integration
+   switching
+   tricks
+
+Additional Information
+----------------------
+
+.. toctree::
+   :maxdepth: 2
+
+   faq
+   changelog
+
+If you can't find the information you're looking for, have a look at the
+index of try to find it using the search function:
+
+* :ref:`genindex`
+* :ref:`search`
index 6d050b452064f06fda2a9b8dcb36229273ef6e0d..7225e1cb68af3ffbda957db6d42dd4e3cce357cf 100644 (file)
@@ -25,29 +25,7 @@ with the optional sandboxed template execution environment:
     the correct line in the template.
 -   configurable syntax
 
-Jinja2 Documentation
---------------------
-
-.. toctree::
-   :maxdepth: 2
-
-   intro
-   api
-   sandbox
-   templates
-   extensions
-   integration
-   switching
-   tricks
-
-Additional Information
-----------------------
-
-.. toctree::
-   :maxdepth: 2
-
-   faq
-   changelog
+.. include:: contents.rst.inc
 
 If you can't find the information you're looking for, have a look at the
 index of try to find it using the search function:
diff --git a/docs/jinjastyle.sty b/docs/jinjastyle.sty
new file mode 100644 (file)
index 0000000..da811ce
--- /dev/null
@@ -0,0 +1,119 @@
+\definecolor{TitleColor}{rgb}{0,0,0}
+\definecolor{InnerLinkColor}{rgb}{0,0,0}
+\definecolor{OuterLinkColor}{rgb}{0.8,0,0}
+
+\renewcommand{\maketitle}{%
+  \begin{titlepage}%
+    \let\footnotesize\small
+    \let\footnoterule\relax
+    \ifsphinxpdfoutput
+      \begingroup
+      % This \def is required to deal with multi-line authors; it
+      % changes \\ to ', ' (comma-space), making it pass muster for
+      % generating document info in the PDF file.
+      \def\\{, }
+      \pdfinfo{
+        /Author (\@author)
+        /Title (\@title)
+      }
+      \endgroup
+    \fi
+    \begin{flushright}%
+      %\sphinxlogo%
+      {\center
+        \vspace*{3cm}
+       \includegraphics{logo.pdf}
+        \vspace{3cm}
+       \par
+        {\rm\Huge \@title \par}%
+        {\em\LARGE \py@release\releaseinfo \par}
+        {\large
+         \@date \par
+         \py@authoraddress \par
+        }}%
+    \end{flushright}%\par
+    \@thanks
+  \end{titlepage}%
+  \cleardoublepage%
+  \setcounter{footnote}{0}%
+  \let\thanks\relax\let\maketitle\relax
+  %\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
+}
+
+\fancypagestyle{normal}{
+  \fancyhf{}
+  \fancyfoot[LE,RO]{{\thepage}}
+  \fancyfoot[LO]{{\nouppercase{\rightmark}}}
+  \fancyfoot[RE]{{\nouppercase{\leftmark}}}
+  \fancyhead[LE,RO]{{ \@title, \py@release}}
+  \renewcommand{\headrulewidth}{0.4pt}
+  \renewcommand{\footrulewidth}{0.4pt}
+}
+
+\fancypagestyle{plain}{
+  \fancyhf{}
+  \fancyfoot[LE,RO]{{\thepage}}
+  \renewcommand{\headrulewidth}{0pt}
+  \renewcommand{\footrulewidth}{0.4pt}
+}
+
+\titleformat{\section}{\Large}%
+            {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor}
+\titleformat{\subsection}{\large}%
+            {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
+\titleformat{\subsubsection}{}%
+            {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
+\titleformat{\paragraph}{\large}%
+            {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}
+
+\ChNameVar{\raggedleft\normalsize}
+\ChNumVar{\raggedleft \bfseries\Large}
+\ChTitleVar{\raggedleft \rm\Huge}
+
+\renewcommand\thepart{\@Roman\c@part}
+\renewcommand\part{%
+   \pagestyle{plain}
+   \if@noskipsec \leavevmode \fi
+   \cleardoublepage
+   \vspace*{6cm}%
+   \@afterindentfalse
+   \secdef\@part\@spart}
+
+\def\@part[#1]#2{%
+    \ifnum \c@secnumdepth >\m@ne
+      \refstepcounter{part}%
+      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+    \else
+      \addcontentsline{toc}{part}{#1}%
+    \fi
+    {\parindent \z@ %\center
+     \interlinepenalty \@M
+     \normalfont
+     \ifnum \c@secnumdepth >\m@ne
+       \rm\Large \partname~\thepart
+       \par\nobreak
+     \fi
+     \MakeUppercase{\rm\Huge #2}%
+     \markboth{}{}\par}%
+    \nobreak
+    \vskip 8ex
+    \@afterheading}
+\def\@spart#1{%
+    {\parindent \z@ %\center
+     \interlinepenalty \@M
+     \normalfont
+     \huge \bfseries #1\par}%
+     \nobreak
+     \vskip 3ex
+     \@afterheading}
+
+% use inconsolata font
+\usepackage{inconsolata}
+
+% fix single quotes, for inconsolata. (does not work)
+%%\usepackage{textcomp}
+%%\begingroup
+%%  \catcode`'=\active
+%%  \g@addto@macro\@noligs{\let'\textsinglequote}
+%%  \endgroup
+%%\endinput
diff --git a/docs/latexindex.rst b/docs/latexindex.rst
new file mode 100644 (file)
index 0000000..300e60d
--- /dev/null
@@ -0,0 +1,6 @@
+:orphan:
+
+Jinja2 Documentation
+====================
+
+.. include:: contents.rst.inc
diff --git a/docs/logo.pdf b/docs/logo.pdf
new file mode 100644 (file)
index 0000000..3e8a9cf
Binary files /dev/null and b/docs/logo.pdf differ