[Python-checkins] r62758 - in doctools/trunk: CHANGES doc/concepts.rst sphinx/latexwriter.py sphinx/texinputs/sphinx.sty
georg.brandl
python-checkins at python.org
Tue May 6 09:21:46 CEST 2008
Author: georg.brandl
Date: Tue May 6 09:21:46 2008
New Revision: 62758
Log:
Support all rst admonitions in LaTeX.
Modified:
doctools/trunk/CHANGES
doctools/trunk/doc/concepts.rst
doctools/trunk/sphinx/latexwriter.py
doctools/trunk/sphinx/texinputs/sphinx.sty
Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES (original)
+++ doctools/trunk/CHANGES Tue May 6 09:21:46 2008
@@ -47,6 +47,9 @@
* sphinx.ext.autodoc: descriptors are detected properly now.
+* sphinx.latexwriter: implement all reST admonitions, not just ``note``
+ and ``warning``.
+
* Lots of little fixes to the LaTeX output and style.
* Fix OpenSearch template and make template URL absolute. The
Modified: doctools/trunk/doc/concepts.rst
==============================================================================
--- doctools/trunk/doc/concepts.rst (original)
+++ doctools/trunk/doc/concepts.rst Tue May 6 09:21:46 2008
@@ -16,16 +16,6 @@
slashes. All values, parameters and suchlike referring to "documents" expect
such a document name.
-.. cfunction:: Class::method(int bla, int foo) const
-
- pass
-
-.. cmdoption:: --longopt <arg>
-
-.. class:: Test
-
- .. method:: X
-
The TOC tree
------------
Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py (original)
+++ doctools/trunk/sphinx/latexwriter.py Tue May 6 09:21:46 2008
@@ -625,15 +625,31 @@
def depart_image(self, node):
pass
- def visit_note(self, node):
- self.body.append('\n\\begin{notice}[note]')
- def depart_note(self, node):
+ def _make_visit_admonition(name):
+ def visit_admonition(self, node):
+ self.body.append('\n\\begin{notice}[%s]' % name)
+ return visit_admonition
+ def depart_admonition(self, node):
self.body.append('\\end{notice}\n')
- def visit_warning(self, node):
- self.body.append('\n\\begin{notice}[warning]')
- def depart_warning(self, node):
- self.body.append('\\end{notice}\n')
+ visit_attention = _make_visit_admonition('attention')
+ depart_attention = depart_admonition
+ visit_caution = _make_visit_admonition('caution')
+ depart_caution = depart_admonition
+ visit_danger = _make_visit_admonition('danger')
+ depart_danger = depart_admonition
+ visit_error = _make_visit_admonition('error')
+ depart_error = depart_admonition
+ visit_hint = _make_visit_admonition('hint')
+ depart_hint = depart_admonition
+ visit_important = _make_visit_admonition('important')
+ depart_important = depart_admonition
+ visit_note = _make_visit_admonition('note')
+ depart_note = depart_admonition
+ visit_tip = _make_visit_admonition('tip')
+ depart_tip = depart_admonition
+ visit_warning = _make_visit_admonition('warning')
+ depart_warning = depart_admonition
def visit_versionmodified(self, node):
self.body.append('\\%s' % node['type'])
Modified: doctools/trunk/sphinx/texinputs/sphinx.sty
==============================================================================
--- doctools/trunk/sphinx/texinputs/sphinx.sty (original)
+++ doctools/trunk/sphinx/texinputs/sphinx.sty Tue May 6 09:21:46 2008
@@ -671,6 +671,8 @@
\end{tabular}
}
+% Notices / Admonitions
+%
\newlength{\py at noticelength}
\newcommand{\py at heavybox}{
@@ -689,15 +691,37 @@
\fbox{\TheSbox}
}
-% a 'note' is as plain as it gets:
+% Some are quite plain:
\newcommand{\py at noticelabel@note}{Note:}
\newcommand{\py at noticestart@note}{}
\newcommand{\py at noticeend@note}{}
+\newcommand{\py at noticelabel@hint}{Hint:}
+\newcommand{\py at noticestart@hint}{}
+\newcommand{\py at noticeend@hint}{}
+\newcommand{\py at noticelabel@important}{Important:}
+\newcommand{\py at noticestart@important}{}
+\newcommand{\py at noticeend@important}{}
+\newcommand{\py at noticelabel@tip}{Tip:}
+\newcommand{\py at noticestart@tip}{}
+\newcommand{\py at noticeend@tip}{}
-% a 'warning' gets more visible distinction:
+% Others gets more visible distinction:
\newcommand{\py at noticelabel@warning}{Warning:}
\newcommand{\py at noticestart@warning}{\py at heavybox}
\newcommand{\py at noticeend@warning}{\py at endheavybox}
+\newcommand{\py at noticelabel@caution}{Caution:}
+\newcommand{\py at noticestart@caution}{\py at heavybox}
+\newcommand{\py at noticeend@caution}{\py at endheavybox}
+\newcommand{\py at noticelabel@attention}{Attention:}
+\newcommand{\py at noticestart@attention}{\py at heavybox}
+\newcommand{\py at noticeend@attention}{\py at endheavybox}
+\newcommand{\py at noticelabel@danger}{Danger:}
+\newcommand{\py at noticestart@danger}{\py at heavybox}
+\newcommand{\py at noticeend@danger}{\py at endheavybox}
+\newcommand{\py at noticelabel@error}{Error:}
+\newcommand{\py at noticestart@error}{\py at heavybox}
+\newcommand{\py at noticeend@error}{\py at endheavybox}
+
\newenvironment{notice}[1][note]{
\def\py at noticetype{#1}
More information about the Python-checkins
mailing list