diff options
Diffstat (limited to 'sandbox/grubert')
57 files changed, 0 insertions, 4950 deletions
diff --git a/sandbox/grubert/README.txt b/sandbox/grubert/README.txt deleted file mode 100644 index 2808e6548..000000000 --- a/sandbox/grubert/README.txt +++ /dev/null @@ -1,72 +0,0 @@ -2003-02 -------- - -latex writer into main -~~~~~~~~~~~~~~~~~~~~~~ - -Done: - -* move latex2e.py into docutils/writers -* move rst2latex.py into tools. -* add latex to writers/__init__ writer_aliases. -* documentation: tools documentation. - -To do: - -* commandline options, style.tex, ... - - Where to move the latex2e-README.txt. - -* test: writer tests might be too simple, currently publish is used. - test/test_writers - test that the produced latex document is the same. - - -2002-12 -------- - -pdfsamples -~~~~~~~~~~ - -1. reduced tools_test.txt_ multirow and multicol tablecells donot work. - -2. docs_tools.txt_. - -3. specs_pep-0256.txt_. - -.. _tools_test.txt: test.pdf -.. _specs_pep-0256.txt: pep-0256.pdf -.. _docs_tools.txt: tools.pdf - - -2002-09 -------- - -latex enhanced by julien. - -2002-07 -------- - -Menu changed now try for latex writer. - -2002-05-11 ----------- - -This month sandbox menu is a pdf writer using -reportlab lib. - -I am unsure it it will ever work, justification might -need hyphenation and automatic sizing of table cells -seams to be nontrivial (considering the size of the -usual html browsers). - -A better layout might be possible via the latex2e writer. -(on next month menu). - -I try to approach davids structure and work and -coding conventions but slowly as a morning sunrise. - -cheers - - grubert@users.sourceforge.net - diff --git a/sandbox/grubert/check b/sandbox/grubert/check deleted file mode 100644 index bf46570f6..000000000 --- a/sandbox/grubert/check +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -EXT=tex -REF_DIR=test -if [ "$1" = "man" ] ;then - REF_DIR=man.test - EXT=man - shift -fi - -if [ "$1" = "create" ] ; then - CREATE=1 -fi - -TMPF=.diff.tmp -for F in `ls $REF_DIR/*.txt*.$EXT` ; do - diff -s -u $F.ref $F > $TMPF - if test $? -gt 0 ; then - less $TMPF - if [ "$CREATE" == "1" ] ; then - mv $F $F.ref - fi - fi -done -rm $TMPF diff --git a/sandbox/grubert/directory_structur b/sandbox/grubert/directory_structur deleted file mode 100644 index 44e39d4df..000000000 --- a/sandbox/grubert/directory_structur +++ /dev/null @@ -1,24 +0,0 @@ -Sandbox directory structure (2002-07-05) - -sandbox/ - userid/ - component_name/ # A verbose name is best. - README.txt # Please explain requirements, - # purpose/goals, and usage. - docs/ - ... - component.py # The component is a single module. - # *OR* (but *not* both) - component/ # The component is a package. - __init__.py # Contains the Reader/Writer class. - other1.py # Other modules and data files used - data.txt # by this component. - ... - test/ # Test suite. - ... - tools/ # For front-ends etc. - ... - setup.py # Use Distutils to install the component - # code and tools/ files into the right - # places in Docutils. - diff --git a/sandbox/grubert/docutils.sty b/sandbox/grubert/docutils.sty deleted file mode 100644 index 7c25b3ad4..000000000 --- a/sandbox/grubert/docutils.sty +++ /dev/null @@ -1,54 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%% docutils.sty: A style for docutils latex output %%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% o author: Alexander Schmolck (a.schmolck@gmx.net) -%% o created: 2002-07-07 10:50:31+00:40 -%% o last modified: $Date$ -%% o keywords: -%% o license: -%XXX titlesec -%% XXX geometry -\usepackage{graphicx} -\usepackage{latexsym} % extra symbols -\usepackage{url} % !!!: pay attention when using in other commands!!! -\usepackage{verbatim} % normal verbatim has lenght-limit -\usepackage{enumerate} % easy style choice with e.g: ``\begin{enumerate}[Ex i.]`` -\usepackage{hyperref} %href, htarget and hlink XXX: pdfauthor, pdfcreator etc. -\usepackage{xr} %XXX do we need this? -% need this to have ``fboxes`` in ``enviroments``, as well as ``verbatim``s -\usepackage{fancybox} -\usepackage{mdwtab} % better tables and arrays (fixes spacing and adds - % vertical align and multirows (m)) -\usepackage{ltxtable} % long and autoscaling tables (use X for autoscaled - % columns) -\newcommand{\transition}{\vspace{2em}\par\hrule{}\par\vspace{2em}} -\newcommand{\classifier}[1]{(\textit{#1})} -\newenvironment{topic}[1]% -{\begin{Sbox}% - \begin{minipage}{.8\textwidth}% - \protect{\large{\textbf{#1}}}\par\vspace{.5em}}% -{\end{minipage}\end{Sbox}\fbox{\TheSbox}\par\vspace{.5em}} -%XXX shadow box for warnings? -\newenvironment{admonition}[1]% -{\begin{center}% - \begin{Sbox}% - \begin{minipage}{.9\textwidth}% - \protect{\textsc{#1}}\par\vspace{.2em}}% -{\end{minipage}\end{Sbox}\fbox{\TheSbox}\par\vspace{.5em}\end{center}} - -\newenvironment{doctest}% -{\VerbatimEnvironment - \begin{Verbatim}}% -{\end{Verbatim}} -% {% -% \begin{Sbox}% -% \begin{minipage}{.8\textwidth}% -% \protect{\large{\textsc{#1}}\par\vspace{.5em}}}% -% {\end{minipage}\end{Sbox}\fbox{\TheSbox}\par\vspace{.5em}} -%{\end{minipage}\end{Sbox}\fbox{\TheSbox}} - - -%% just a piece of example code -% \newcommand{\vitem}% -% {\SaveVerb[{\item[\UseVerb{\MyTemp}]}]{\MyTemp}} diff --git a/sandbox/grubert/latex.py b/sandbox/grubert/latex.py deleted file mode 100755 index a0f1a6ab8..000000000 --- a/sandbox/grubert/latex.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -""" -:Author: David Goodger -:Contact: goodger@users.sourceforge.net -:Revision: $Revision$ -:Date: $Date$ -:Copyright: This module has been placed in the public domain. - -A minimal front-end to the Docutils Publisher, producing HTML. -""" - -import locale -locale.setlocale(locale.LC_ALL, '') - -from docutils.core import publish_cmdline - - -usage = '%prog [options] [source [destination]]' -description = ('Generate LaTeX documents from standalone reStructuredText ' - 'sources.') - -publish_cmdline(writer_name='latex', usage=usage, description=description) diff --git a/sandbox/grubert/latex/__init__.py b/sandbox/grubert/latex/__init__.py deleted file mode 100644 index 0981bc081..000000000 --- a/sandbox/grubert/latex/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from latex2e import Writer diff --git a/sandbox/grubert/latex2e-README.txt b/sandbox/grubert/latex2e-README.txt deleted file mode 100644 index 8c66007d0..000000000 --- a/sandbox/grubert/latex2e-README.txt +++ /dev/null @@ -1,158 +0,0 @@ -latex2e BUGS TODOS and other animals ------------------------------------- - -for processing tools/test.txt use pdflatex because it will handle png-images. - - -:Author: engelbert gruber -:Contact: grubert@users.sourceforge.net -:Date: $Date$ - -To do -~~~~~ - -* handle image options : height,width,class. - -* setting urls: french does put a spcae before ":" and "?". - - using ``\url`` long urls the url is typeset int tt, but hyphenates. - using ``\href`` does typeset in normal font. - -* dedication is centered italic in html (test.txt). - -* term: html puts classifier in italic and newline after classifier, - latex in parentheses and no newline after it (test.txt). - -* field lists are indented in latex (test.txt). - -* literal block is indented in html (test.txt). - -* doctest block is indented in html. - -* footnotes donot link back in latex. - -* quotes for german: {\glqq} {\grqq} {\glq} {\grq} {\dq}. - -* support embed-stylesheet. - -* the ^-sign is problematic: using mathmode wedge is usually the wrong font. - -* Maybe add end of line after term in definition list. see - http://roundup.sf.net/doc-0.5/features.pdf - -* In tools.txt the option tables right column, there should be some more spacing - between the description and the next paragraph "Default:". - - Paragraph separation in tables is hairy. - see http://www.tex.ac.uk/cgi-bin/texfaq2html?label=struttab - - - The strut solution did not work. - - setting extrarowheight added ad top of row not between paragraphs in - a cell. ALTHOUGH i set it to 2pt because, text is too close to the topline. - - baselineskip/stretch does not help. - -* two hlines after table head and on table end ? - -* table: multicol cells are always {l}. - -* pdfbookmark level 4 (and greater) does not work (might be settable but OTOH). - -* center subsection{Abstract} gives a latex error here. - ``! LaTeX Error: Something's wrong--perhaps a missing \item.`` - Committed a HACK: centering by hfill - -* document errors are also too silent. - -* use optionlist for docinfo. - -* the title "table of contents" is centered too. - -* consider peter funk's hooks for TeXpert: - - * Define his own document preamble (including the choice to - choose his own documentclass. That would make the ``--documentclass`` - option superfluous). I suggest to call this option ``--preamble`` - - * Use two additional hooks to put additional stuff just behind the - ``\begin{document}`` and just before the ``\end{document}`` macros. - Typical uses would be ``\tableofcontents``, ``\listoffigures`` and - ``\appendix``, ``\makeindex``, ``\makeglossary`` and some such - for larger documents. - -* hyphens: co-developers should be co--developers ? - -* table heads and footer for longtable (firstpage lastpage ..) - -* longtable does not work with multirow - -* tabularx says "do not use any multicolmn which spans any X column. - maybe use ltxtable instead of tabularx (Longtable combined with tabularx). - but ltxtable disables longtable's multicolumn. - -* multiple author entries in docinfo (same thing as in html). - -* the indentional problematic error in test.txt is not referring anywhere. - -* table cells with multirow and multicolumn - -* tables have borders, and the border is missing in empty cells. - -* footnotes are not all on the same page (as in tools/test.txt) and do not link back - and forth. - -* no link to system errors. - -* hyperlinks are not hyphenated this leads to bad spacing. see tools/test.txt - 2.14 directives directives - -* meta keywords into pdf ? - -* pagestyle headings does not work, when sections are starred. - -* additional docinfo items: the field_body is inserted as text. - -ATTENTION -~~~~~~~~~ -* put labeling inside (after the begin) environments. -* me (e.g.) uses textwidth, julien linewidth see what is what. - - textwidth: is the normal width of the text on a page. It should generally - be changed only in the preamble. - - linewidth: is the width of lines in the current environment. Normally equal to - \textwidth, it may be different within an environment such as list or quote - environments. - -* from http://netra.wustl.edu/links/LaTeX/LaTeX.html - - - Aligning Images - - By default, images align according to their "reference point," which is never - what you want it to be. Put a minipage around an image to make it align - properly (according to its center):: - - \usepackage{graphicx} - \begin{minipage}{2in} - \includegraphics[width=2in,angle=-90]{foo} - \end{minpage} - - - 2-Column Images - - When in 2-column mode (using either \twocolumn or the multicols environment - (package multicol)), use \begin{figure*} and \begin{table*} to create figures - and tables that span the entire width of the page. \begin{figure} and - \begin{table} span only one column. - - - LaTeX->PDF - - I've found that the best way to convert from LaTeX to PDF is to use "pdflatex." - The first time that you run it, you'll find that the produced PDF file doesn't - include any of your figures. To fix this, - - 1. Use "epstopdf" to convert all of your EPS images to PDF - 2. Make sure that you are using the "graphicx" package for including images. - 3. Remove any .eps or .ps extensions from filenames in your LaTeX file - - When you run LaTeX, graphicx will use the dvips driver to incorporate EPS - files. When you run pdflatex, it will pick up the pdftex driver and incorporate - the PDF files. diff --git a/sandbox/grubert/ltx-test.txt b/sandbox/grubert/ltx-test.txt deleted file mode 100644 index 134eda67e..000000000 --- a/sandbox/grubert/ltx-test.txt +++ /dev/null @@ -1,476 +0,0 @@ -.. This is a comment. Note how any initial comments are moved by - transforms to after the document title, subtitle, and docinfo. - -================================ - reStructuredText Test Document -================================ - -.. Above is the document title, and below is the subtitle. - They are transformed from section titles after parsing. - --------------------------------- - Examples of Syntax Constructs --------------------------------- - -.. bibliographic fields (which also require a transform): - -:Author: David Goodger -:Address: 123 Example Street - Example, EX Canada - A1B 2C3 -:Contact: goodger@users.sourceforge.net -:Authors: Me; Myself; I -:organization: humankind -:date: $Date$ -:status: This is a "work in progress" -:revision: $Revision$ -:version: 1 -:copyright: This document has been placed in the public domain. You - may do with it as you wish. You may copy, modify, - redistribute, reattribute, sell, buy, rent, lease, - destroy, or improve it, quote it at length, excerpt, - incorporate, collate, fold, staple, or mutilate it, or do - anything else to it that your or anyone else's heart - desires. -:field name: This is a generic bibliographic field. -:field name 2: - Generic bibliographic fields may contain multiple body elements. - - Like this. - -:Dedication: - - For Docutils users & co-developers. - -:abstract: - - This is a test document, containing at least one example of each - reStructuredText construct. - -.. meta:: - :keywords: reStructuredText, test, parser - :description lang=en: A test document, containing at least one - example of each reStructuredText construct. - -.. contents:: Table of Contents -.. section-numbering:: - - -Structural Elements -=================== - -Section Title -------------- - -That's it, the text just above this line. - -Transitions ------------ - -Here's a transition: - ---------- - -It divides the section. - -Body Elements -============= - -Paragraphs ----------- - -A paragraph. - -Inline Markup -````````````` - -Paragraphs contain text and may contain inline markup: *emphasis*, -**strong emphasis**, `interpreted text`, ``inline literals``, -standalone hyperlinks (http://www.python.org), external hyperlinks -(Python_), internal cross-references (example_), footnote references -(manually numbered [1]_, anonymous auto-numbered [#]_, labeled -auto-numbered [#label]_, or symbolic [*]_), citation references -([CIT2002]_), substitution references (|example|), and _`inline -hyperlink targets` (see Targets_ below for a reference back to here). -Problems are indicated by |problematic| text (generated by processing -errors; this one is intentional). - -.. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! - -Let's test wrapping and whitespace significance in inline literals: -``This is an example of --inline-literal --text, --including some-- -strangely--hyphenated-words. Adjust-the-width-of-your-browser-window -to see how the text is wrapped. -- ---- -------- Now note the -spacing between the words of this sentence (words -should be grouped in pairs).`` - -If the ``--pep-references`` option was supplied, there should be a -live link to PEP 258 here. - -Bullet Lists ------------- - -- A bullet list - - + Nested bullet list. - + Nested item 2. - -- Item 2. - - Paragraph 2 of item 2. - - * Nested bullet list. - * Nested item 2. - - - Third level. - - Item 2. - - * Nested item 3. - -Enumerated Lists ----------------- - -1. Arabic numerals. - - a) lower alpha) - - (i) (lower roman) - - A. upper alpha. - - I) upper roman) - -2. Lists that don't start at 1: - - 3. Three - - 4. Four - - C. C - - D. D - - iii. iii - - iv. iv - -Definition Lists ----------------- - -Term - Definition -Term : classifier - Definition paragraph 1. - - Definition paragraph 2. -Term - Definition - -Field Lists ------------ - -:what: Field lists map field names to field bodies, like database - records. They are often part of an extension syntax. They are - an unambiguous variant of RFC 2822 fields. - -:how arg1 arg2: - - The field marker is a colon, the field name, and a colon. - - The field body may contain one or more body elements, indented - relative to the field marker. - -Option Lists ------------- - -For listing command-line options: - --a command-line option "a" --b file options can have arguments - and long descriptions ---long options can be long also ---input=file long options can also have - arguments - ---very-long-option - The description can also start on the next line. - - The description may contain multiple body elements, - regardless of where it starts. - --x, -y, -z Multiple options are an "option group". --v, --verbose Commonly-seen: short & long options. --1 file, --one=file, --two file - Multiple options with arguments. -/V DOS/VMS-style options too - -There must be at least two spaces between the option and the -description. - -Literal Blocks --------------- - -Literal blocks are indented, and indicated with a double-colon ("::") -at the end of the preceding paragraph (right here ``-->``):: - - if literal_block: - text = 'is left as-is' - spaces_and_linebreaks = 'are preserved' - markup_processing = None - -Block Quotes ------------- - -Block quotes consist of indented body elements: - - This theory, that is mine, is mine. - - -- Anne Elk (Miss) - -Doctest Blocks --------------- - ->>> print 'Python-specific usage examples; begun with ">>>"' -Python-specific usage examples; begun with ">>>" ->>> print '(cut and pasted from interactive Python sessions)' -(cut and pasted from interactive Python sessions) - -Tables ------- - -Here's a grid table followed by a simple table: - -+------------------------+------------+----------+----------+ -| Header row, column 1 | Header 2 | Header 3 | Header 4 | -| (header rows optional) | | | | -+========================+============+==========+==========+ -| body row 1, column 1 | column 2 | column 3 | column 4 | -+------------------------+------------+----------+----------+ -| body row 2 | Cells may span columns. | -+------------------------+------------+----------+----------+ -| body row 5 | Cells may also be | | -| | empty: ``-->`` | | -+------------------------+-----------------------+----------+ - -.. not for latex - +------------------------+------------+---------------------+ - | body row 3 | Cells may | - Table cells | - +------------------------+ span rows. | - contain | - | body row 4 | | - body elements. | - - -===== ===== ====== - Inputs Output ------------- ------ - A B A or B -===== ===== ====== -False False False -True False True -False True True -True True True -===== ===== ====== - -Footnotes ---------- - -.. [1] A footnote contains body elements, consistently indented by at - least 3 spaces. - - This is the footnote's second paragraph. - -.. [#label] Footnotes may be numbered, either manually (as in [1]_) or - automatically using a "#"-prefixed label. This footnote has a - label so it can be referred to from multiple places, both as a - footnore reference ([#label]_) and as a hyperlink reference - (label_). - -.. [#] This footnote is numbered automatically and anonymously using a - label of "#" only. - -.. [*] Footnotes may also use symbols, specified with a "*" label. - Here's a reference to the next footnote: [*]_. - -.. [*] This footnote shows the next symbol in the sequence. - -.. [4] Here's an unreferenced footnote, with a reference to a - nonexistent footnote: [5]_. - -Citations ---------- - -.. [CIT2002] Citations are text-labeled footnotes. They may be - rendered separately and differently from footnotes. - -Here's a reference to the above, [CIT2002]_, and a [nonexistent]_ -citation. - -Targets -------- - -.. _example: - -This paragraph is pointed to by the explicit "example" target. A -reference can be found under `Inline Markup`_, above. `Inline -hyperlink targets`_ are also possible. - -Section headers are implicit targets, referred to by name. See -Targets_, which is a subsection of `Body Elements`_. - -Explicit external targets are interpolated into references such as -"Python_". - -.. _Python: http://www.python.org/ - -Targets may be indirect and anonymous. Thus `this phrase`__ may also -refer to the Targets_ section. - -__ Targets_ - -Here's a `hyperlink reference without a target`_, which generates an -error. - -Duplicate Target Names -`````````````````````` - -Duplicate names in section headers or other implicit targets will -generate "info" (level-1) system messages. Duplicate names in -explicit targets will generate "warning" (level-2) system messages. - -Duplicate Target Names -`````````````````````` - -Since there are two "Duplicate Target Names" section headers, we -cannot uniquely refer to either of them by name. If we try to (like -this: `Duplicate Target Names`_), an error is generated. - -Directives ----------- - -.. contents:: :local: - -These are just a sample of the many reStructuredText Directives. For -others, please see http://docutils.sf.net/spec/rst/directives.html. - -Document Parts -`````````````` - -An example of the "contents" directive can be seen above this section -(a local, untitled table of contents_) and at the beginning of the -document (a document-wide `table of contents`_). - -Images -`````` - -An image directive: - -.. image:: ../docs/rst/images/title.png - -A figure directive: - -.. figure:: ../docs/rst/images/title.png - :alt: reStructuredText, the markup syntax - - A figure is an image with a caption and/or a legend: - - +------------+-----------------------------------------------+ - | re | Revised, revisited, based on 're' module. | - +------------+-----------------------------------------------+ - | Structured | Structure-enhanced text, structuredtext. | - +------------+-----------------------------------------------+ - | Text | Well it is, isn't it? | - +------------+-----------------------------------------------+ - - This paragraph is also part of the legend. - -Admonitions -``````````` - -.. Attention:: Directives at large. - -.. Caution:: - - Don't take any wooden nickels. - -.. DANGER:: Mad scientist at work! - -.. Error:: Does not compute. - -.. Hint:: It's bigger than a bread box. - -.. Important:: - - Wash behind your ears. - - Clean up your room. - - Call your mother. - - Back up your data. - -.. Note:: This is a note. - -.. Tip:: 15% if the service is good. - -.. WARNING:: Strong prose may provoke extreme mental exertion. - Reader discretion is strongly advised. - -Target Footnotes -```````````````` - -.. target-notes:: - -Line Blocks -``````````` - -Take it away, Eric the Orchestra Leader! - -.. line-block:: - - A one, two, a one two three four - - Half a bee, philosophically, - must, *ipso facto*, half not be. - But half the bee has got to be, - *vis a vis* its entity. D'you see? - - But can a bee be said to be - or not to be an entire bee, - when half the bee is not a bee, - due to some ancient injury? - - Singing... - -Replacement Text -```````````````` - -I recommend you try |Python|_. - -.. |Python| replace:: Python, *the* best language around - -Substitution Definitions ------------------------- - -An inline image (|example|) example: - -.. |EXAMPLE| image:: ../docs/rst/images/biohazard.png - -(Substitution definitions are not visible in the HTML source.) - -Comments --------- - -Here's one: - -.. Comments begin with two dots and a space. Anything may - follow, except for the syntax of footnotes, hyperlink - targets, directives, or substitution definitions. - - Double-dashes -- "--" -- must be escaped somehow in HTML output. - -(View the HTML source to see the comment.) - -Error Handling -============== - -Any errors caught during processing will generate system messages. - -There should be five messages in the following, auto-generated -section, "Docutils System Messages": - -.. section should be added by Docutils automatically diff --git a/sandbox/grubert/making_a_writer.txt b/sandbox/grubert/making_a_writer.txt deleted file mode 100644 index 4d76b5170..000000000 --- a/sandbox/grubert/making_a_writer.txt +++ /dev/null @@ -1,133 +0,0 @@ -=============== -Making a writer -=============== - -:Author: engelbert gruber -:Contact: grubert@users.sourceforge.net -:Date: $Date$ -:Web site: http://docutils.sourceforge.net/ - -.. contents:: - -Introduction -============ - -This might become a document sometime, is now a FAQ, collected -from docutils-develop@lists.sourceforge.net. - -This should give help in making a writer for the python docutils. -Writers are backends writing to a dedicated format. - -General description -=================== - -from PEP-0258: - - Writers produce the final output (HTML, XML, TeX, etc.). Writers translate - the internal document tree structure into the final data format, possibly - running Writer-specific transforms first. - - Responsibilities: - - * Run transforms over the doctree(s). - * Translate doctree(s) into specific output formats. - * Transform references into format-native forms. - * Write the translated output to the destination I/O. - -or in other words - - By the time the document gets to the Writer, it should be in - final form. The Writer's job is simply (and only) to translate from - the Docutils doctree structure to the target format. Some small - transforms may be required, but they should be local and - format-specific. - - -The smallest writer -=================== - -Next to come. This should be a writer module where everything is done -in unimplemented. - - -Methods -======= - -Empty methods -------------- - -It is legal and does not hint to missing functionality, when a -method only implements pass, it just means that this calls information -is not used, the actual content is usually produced between ``visit_*`` -and ``depart_*`` calls. e.g.:: - - def visit_Text(self, node): - self.body.append(self.encode(node.astext())) - - def depart_Text(self, node): - pass - -As long as there is no need for termination depart_Text is ok. - -Fallback methods ----------------- - -If derived from NodeVisitor - -* unknown_visit, unknown_departure - -Deriving from SparseNodeVisitor means everything might pass. - -GenericNodeVisitor adds - -* default_visit, default_depart. - -unimplemented_visit( self, node) seams to be there for both. - -Each might raise NotImplementedError(describe_here), - -General Problems ----------------- - -html pages are more like papyrus rolls, if one wants to go more usual -paper formats some things are different or not. - -* page headings -* page numbers - - -Problems --------- - -In latex2e writer this looks awful to me, but as i understand this ensures -that e.g. http addresses are not only text. - -Maybe this is due to the fact that self.docinfo is used, if one would remove -it context might be unecessary. - -:: - - def visit_docinfo_item (...): - ... - else: - ##self.head.append('\\%s{%s}\n' - ## % (name, self.attval(node.astext()))) - self.docinfo.append('\\textbf{%s} &\n\t' % name) - self.context.append(' \\\\\n') - self.context.append(self.docinfo) - self.context.append(len(self.body)) - ##raise nodes.SkipNode - - def depart_docinfo_item(self, node): - size = self.context.pop() - dest = self.context.pop() - tail = self.context.pop() - tail = self.body[size:] + [tail] - del self.body[size:] - dest.extend(tail) - - -Notes on Classes ----------------- - -To be completed. diff --git a/sandbox/grubert/man.py b/sandbox/grubert/man.py deleted file mode 100755 index f3f81b241..000000000 --- a/sandbox/grubert/man.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python - -# Author: -# Contact: grubert@users.sf.net -# Copyright: This module has been placed in the public domain. - -""" -man.py -====== - -This module provides a simple command line interface that uses the -man page writer to output from ReStructuredText source. -""" - -import locale -try: - locale.setlocale(locale.LC_ALL, '') -except: - pass - -from docutils.core import publish_cmdline, default_description -from man import ManPageWriter - -description = ("Generates plain man. " + default_description) - -publish_cmdline(writer=ManPageWriter.Writer(), description=description) diff --git a/sandbox/grubert/man/ManPageWriter.py b/sandbox/grubert/man/ManPageWriter.py deleted file mode 100644 index 44eea3f8a..000000000 --- a/sandbox/grubert/man/ManPageWriter.py +++ /dev/null @@ -1,952 +0,0 @@ -# Author: -# Contact: grubert@users.sf.net -# Copyright: 2003 - engelbert gruber - All Rights Reserved -# License: This module is put into the public domain. -# -# CVS: $Id$ - -""" -Man page formatting for reStructuredText. - -See http://www.tldp.org/HOWTO/Man-Page for a start. - -Man pages have no subsection only parts. -Standard parts - NAME , - SYNOPSIS , - DESCRIPTION , - OPTIONS , - FILES , - SEE ALSO , - BUGS , -and - AUTHOR . - -""" - -# NOTE: the macros only work when at line start, so try the rule -# start new lines in visit_ functions. - -__docformat__ = 'reStructuredText' - -import sys -import os -import time -import re -from types import ListType - -import docutils -from docutils import nodes, utils, writers, languages - - -class Writer(writers.Writer): - - supported = ('ManPage') - """Formats this writer supports.""" - - output = None - """Final translated form of `document`.""" - - def __init__(self): - writers.Writer.__init__(self) - self.translator_class = Translator - - def translate(self): - visitor = self.translator_class(self.document) - self.document.walkabout(visitor) - self.output = visitor.astext() - - -class Translator(nodes.NodeVisitor): - """""" - - words_and_spaces = re.compile(r'\S+| +|\n') - document_start = """Man page generated from reStructeredText.""" - - def __init__(self, document): - nodes.NodeVisitor.__init__(self, document) - self.settings = settings = document.settings - lcode = settings.language_code - self.language = languages.get_language(lcode) - self.head = [] - self.body = [] - self.foot = [] - self.section_level = 0 - self.context = [] - self.topic_class = '' - self.colspecs = [] - self.compact_p = 1 - self.compact_simple = None - self.in_docinfo = None - - def comment_begin(self, text): - """Return commented version of the passed text WITHOUT end of line/comment.""" - prefix = '\n.\\" ' - return prefix+prefix.join(text.split('\n')) - - def comment(self, text): - """Return commented version of the passed text.""" - prefix = '\n.\\" ' - return prefix+prefix.join(text.split('\n'))+'\n' - - def astext(self): - """Return the final formatted document as a string.""" - return ''.join(self.head + self.body + self.foot) - - def visit_Text(self, node): - self.body.append(node.astext().replace('-','\-')) - - def depart_Text(self, node): - pass - - def visit_address(self, node): - raise NotImplementedError, node.astext() - self.visit_docinfo_item(node, 'address', meta=None) - - def depart_address(self, node): - self.depart_docinfo_item() - - def visit_admonition(self, node, name): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'div', CLASS=name)) - self.body.append('<p class="admonition-title">' - + self.language.labels[name] + '</p>\n') - - def depart_admonition(self): - raise NotImplementedError, node.astext() - self.body.append('</div>\n') - - def visit_attention(self, node): - self.visit_admonition(node, 'attention') - - def depart_attention(self, node): - self.depart_admonition() - - def visit_author(self, node): - self.visit_docinfo_item(node, 'author') - - def depart_author(self, node): - self.depart_docinfo_item() - - def visit_authors(self, node): - pass - - def depart_authors(self, node): - pass - - def visit_block_quote(self, node): - self.body.append(self.comment('visit_block_quote')) - - def depart_block_quote(self, node): - self.body.append(self.comment('depart_block_quote')) - - def check_simple_list(self, node): - raise NotImplementedError, node.astext() - """Check for a simple list that can be rendered compactly.""" - visitor = SimpleListChecker(self.document) - try: - node.walk(visitor) - except nodes.NodeFound: - return None - else: - return 1 - - def visit_bullet_list(self, node): - self.body.append(self.comment('depart_bullet_list')) - - def depart_bullet_list(self, node): - self.body.append(self.comment('depart_bullet_list')) - - def visit_caption(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'p', '', CLASS='caption')) - - def depart_caption(self, node): - raise NotImplementedError, node.astext() - self.body.append('</p>\n') - - def visit_caution(self, node): - self.visit_admonition(node, 'caution') - - def depart_caution(self, node): - self.depart_admonition() - - def visit_citation(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'table', CLASS='citation', - frame="void", rules="none")) - self.body.append('<colgroup><col class="label" /><col /></colgroup>\n' - '<col />\n' - '<tbody valign="top">\n' - '<tr>') - self.footnote_backrefs(node) - - def depart_citation(self, node): - raise NotImplementedError, node.astext() - self.body.append('</td></tr>\n' - '</tbody>\n</table>\n') - - def visit_citation_reference(self, node): - raise NotImplementedError, node.astext() - href = '' - if node.has_key('refid'): - href = '#' + node['refid'] - elif node.has_key('refname'): - href = '#' + self.document.nameids[node['refname']] - self.body.append(self.starttag(node, 'a', '[', href=href, - CLASS='citation-reference')) - - def depart_citation_reference(self, node): - raise NotImplementedError, node.astext() - self.body.append(']</a>') - - def visit_classifier(self, node): - raise NotImplementedError, node.astext() - self.body.append(' <span class="classifier-delimiter">:</span> ') - self.body.append(self.starttag(node, 'span', '', CLASS='classifier')) - - def depart_classifier(self, node): - raise NotImplementedError, node.astext() - self.body.append('</span>') - - def visit_colspec(self, node): - self.colspecs.append(node) - - def depart_colspec(self, node): - pass - - def write_colspecs(self): - raise NotImplementedError, node.astext() - width = 0 - for node in self.colspecs: - width += node['colwidth'] - for node in self.colspecs: - colwidth = int(node['colwidth'] * 100.0 / width + 0.5) - self.body.append(self.emptytag(node, 'col', - width='%i%%' % colwidth)) - self.colspecs = [] - - def visit_comment(self, node, - sub=re.compile('-(?=-)').sub): - raise NotImplementedError, node.astext() - """Escape double-dashes in comment text.""" - self.body.append('<!-- %s -->\n' % sub('- ', node.astext())) - # Content already processed: - raise nodes.SkipNode - - def visit_contact(self, node): - self.visit_docinfo_item(node, 'contact') - - def depart_contact(self, node): - self.depart_docinfo_item() - - def visit_copyright(self, node): - self.visit_docinfo_item(node, 'copyright') - - def depart_copyright(self, node): - self.depart_docinfo_item() - - def visit_danger(self, node): - self.visit_admonition(node, 'danger') - - def depart_danger(self, node): - self.depart_admonition() - - def visit_date(self, node): - self.visit_docinfo_item(node, 'date') - - def depart_date(self, node): - self.depart_docinfo_item() - - def visit_decoration(self, node): - pass - - def depart_decoration(self, node): - pass - - def visit_definition(self, node): - self.body.append(self.comment('visit_definition')) - - def depart_definition(self, node): - self.body.append(self.comment('depart_definition')) - - def visit_definition_list(self, node): - self.body.append(self.comment('visit_definition_list')) - - def depart_definition_list(self, node): - self.body.append(self.comment('depart_definition_list')) - - def visit_definition_list_item(self, node): - self.body.append(self.comment('visit_definition_list_item')) - - def depart_definition_list_item(self, node): - self.body.append(self.comment('depart_definition_list_item')) - - def visit_description(self, node): - self.body.append('\n') - - def depart_description(self, node): - pass - - def visit_docinfo(self, node): - self.body.append(self.comment('visit_docinfo')) - - def depart_docinfo(self, node): - self.body.append(self.comment('depart_docinfo')) - - def visit_docinfo_item(self, node, name): - self.body.append(self.comment('%s: ' % self.language.labels[name])) - if len(node): - if isinstance(node[0], nodes.Element): - node[0].set_class('first') - if isinstance(node[0], nodes.Element): - node[-1].set_class('last') - - def depart_docinfo_item(self): - pass - - def visit_doctest_block(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'pre', CLASS='doctest-block')) - - def depart_doctest_block(self, node): - raise NotImplementedError, node.astext() - self.body.append('\n</pre>\n') - - def visit_document(self, node): - self.body.append(self.comment(self.document_start)) - # BUG ad date and revision - # BUG where do we get the name and the filemodification date. - self.body.append('.TH FOO 1 "%s" "Linux User Manuals"\n' % time.strftime("%B %Y")) - - def depart_document(self, node): - self.body.append(self.comment('Generated by docutils ManPageWriter on %s.\n' - % (time.strftime('%Y-%m-%d %H:%M')) ) ) - - def visit_emphasis(self, node): - self.body.append('\n.I ') - - def depart_emphasis(self, node): - self.body.append('\n') - - def visit_entry(self, node): - raise NotImplementedError, node.astext() - if isinstance(node.parent.parent, nodes.thead): - tagname = 'th' - else: - tagname = 'td' - atts = {} - if node.has_key('morerows'): - atts['rowspan'] = node['morerows'] + 1 - if node.has_key('morecols'): - atts['colspan'] = node['morecols'] + 1 - self.body.append(self.starttag(node, tagname, '', **atts)) - self.context.append('</%s>\n' % tagname.lower()) - if len(node) == 0: # empty cell - self.body.append(' ') - else: - node[0].set_class('first') - node[-1].set_class('last') - - def depart_entry(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.context.pop()) - - def visit_enumerated_list(self, node): - self.body.append(self.comment('visit_enumerated_list')) - - def depart_enumerated_list(self, node): - self.body.append(self.comment('depart_enumerated_list')) - - def visit_error(self, node): - self.visit_admonition(node, 'error') - - def depart_error(self, node): - self.depart_admonition() - - def visit_field(self, node): - self.body.append(self.comment('visit_field')) - - def depart_field(self, node): - self.body.append(self.comment('depart_field')) - - def visit_field_body(self, node): - self.body.append(self.comment('visit_field_body')) - if len(node): - node[0].set_class('first') - node[-1].set_class('last') - - def depart_field_body(self, node): - self.body.append(self.comment('depart_field_body')) - - def visit_field_list(self, node): - self.body.append(self.comment('visit_field_list')) - - def depart_field_list(self, node): - self.body.append(self.comment('depart_field_list')) - - def visit_field_name(self, node): - self.body.append(self.comment('visit_field_name')) - atts = {} - if self.in_docinfo: - atts['class'] = 'docinfo-name' - else: - atts['class'] = 'field-name' - if len(node.astext()) > 14: - atts['colspan'] = 2 - self.context.append('</tr>\n<tr><td> </td>') - else: - self.context.append('') - self.body.append(self.comment('atts')) - - def depart_field_name(self, node): - self.body.append(self.comment('depart_field_name')) - - def visit_figure(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'div', CLASS='figure')) - - def depart_figure(self, node): - raise NotImplementedError, node.astext() - self.body.append('</div>\n') - - def visit_footer(self, node): - raise NotImplementedError, node.astext() - self.context.append(len(self.body)) - - def depart_footer(self, node): - raise NotImplementedError, node.astext() - start = self.context.pop() - footer = (['<hr class="footer"/>\n', - self.starttag(node, 'div', CLASS='footer')] - + self.body[start:] + ['</div>\n']) - self.body_suffix[:0] = footer - del self.body[start:] - - def visit_footnote(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'table', CLASS='footnote', - frame="void", rules="none")) - self.body.append('<colgroup><col class="label" /><col /></colgroup>\n' - '<tbody valign="top">\n' - '<tr>') - self.footnote_backrefs(node) - - def footnote_backrefs(self, node): - raise NotImplementedError, node.astext() - if self.settings.footnote_backlinks and node.hasattr('backrefs'): - backrefs = node['backrefs'] - if len(backrefs) == 1: - self.context.append('') - self.context.append('<a class="fn-backref" href="#%s" ' - 'name="%s">' % (backrefs[0], node['id'])) - else: - i = 1 - backlinks = [] - for backref in backrefs: - backlinks.append('<a class="fn-backref" href="#%s">%s</a>' - % (backref, i)) - i += 1 - self.context.append('<em>(%s)</em> ' % ', '.join(backlinks)) - self.context.append('<a name="%s">' % node['id']) - else: - self.context.append('') - self.context.append('<a name="%s">' % node['id']) - - def depart_footnote(self, node): - raise NotImplementedError, node.astext() - self.body.append('</td></tr>\n' - '</tbody>\n</table>\n') - - def visit_footnote_reference(self, node): - raise NotImplementedError, node.astext() - href = '' - if node.has_key('refid'): - href = '#' + node['refid'] - elif node.has_key('refname'): - href = '#' + self.document.nameids[node['refname']] - format = self.settings.footnote_references - if format == 'brackets': - suffix = '[' - self.context.append(']') - elif format == 'superscript': - suffix = '<sup>' - self.context.append('</sup>') - else: # shouldn't happen - suffix = '???' - self.content.append('???') - self.body.append(self.starttag(node, 'a', suffix, href=href, - CLASS='footnote-reference')) - - def depart_footnote_reference(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.context.pop() + '</a>') - - def visit_generated(self, node): - pass - - def depart_generated(self, node): - pass - - def visit_header(self, node): - raise NotImplementedError, node.astext() - self.context.append(len(self.body)) - - def depart_header(self, node): - raise NotImplementedError, node.astext() - start = self.context.pop() - self.body_prefix.append(self.starttag(node, 'div', CLASS='header')) - self.body_prefix.extend(self.body[start:]) - self.body_prefix.append('<hr />\n</div>\n') - del self.body[start:] - - def visit_hint(self, node): - self.visit_admonition(node, 'hint') - - def depart_hint(self, node): - self.depart_admonition() - - def visit_image(self, node): - raise NotImplementedError, node.astext() - atts = node.attributes.copy() - atts['src'] = atts['uri'] - del atts['uri'] - if not atts.has_key('alt'): - atts['alt'] = atts['src'] - if isinstance(node.parent, nodes.TextElement): - self.context.append('') - else: - self.body.append('<p>') - self.context.append('</p>\n') - self.body.append(self.emptytag(node, 'img', '', **atts)) - - def depart_image(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.context.pop()) - - def visit_important(self, node): - self.visit_admonition(node, 'important') - - def depart_important(self, node): - self.depart_admonition() - - def visit_label(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'td', '%s[' % self.context.pop(), - CLASS='label')) - - def depart_label(self, node): - raise NotImplementedError, node.astext() - self.body.append(']</a></td><td>%s' % self.context.pop()) - - def visit_legend(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'div', CLASS='legend')) - - def depart_legend(self, node): - raise NotImplementedError, node.astext() - self.body.append('</div>\n') - - def visit_line_block(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'pre', CLASS='line-block')) - - def depart_line_block(self, node): - raise NotImplementedError, node.astext() - self.body.append('\n</pre>\n') - - def visit_list_item(self, node): - self.body.append(self.comment('visit_list_item')) - - def depart_list_item(self, node): - self.body.append(self.comment('depart_list_item')) - - def visit_literal(self, node): - self.body.append(self.comment('visit_literal')) - - def depart_literal(self, node): - self.body.append(self.comment('depart_literal')) - - def visit_literal_block(self, node): - self.body.append(self.comment('visit_literal_block')) - - def depart_literal_block(self, node): - self.body.append(self.comment('depart_literal_block')) - - def visit_meta(self, node): - raise NotImplementedError, node.astext() - self.head.append(self.emptytag(node, 'meta', **node.attributes)) - - def depart_meta(self, node): - pass - - def visit_note(self, node): - self.visit_admonition(node, 'note') - - def depart_note(self, node): - self.depart_admonition() - - def visit_option_list(self, node): - # e.g. the list of commandline options - pass - - def depart_option_list(self, node): - pass - - def visit_option_list_item(self, node): - # one item of the list - self.body.append('\n.TP') - - def depart_option_list_item(self, node): - pass - - def visit_option_group(self, node): - # as one option could have several forms it is a group - # options without parameter bold only, .B, -v - # options with parameter bold italic, .BI, -f file - - # we do not know if .B or .BI - self.context.append('.B') # blind guess - self.context.append(len(self.body)) # to be able to insert later - self.context.append(0) # optoin counter - - def depart_option_group(self, node): - self.context.pop() # the counter - start_position = self.context.pop() - text = self.body[start_position:] - del self.body[start_position:] - self.body.append('\n%s%s' % (self.context.pop(), ''.join(text))) - - def visit_option(self, node): - # each form of the option will be presented separately - if self.context[-1]>0: - self.body.append(' ,') - if self.context[-3] == '.BI': - self.body.append('\\') - self.body.append(' ') - - def depart_option(self, node): - self.context[-1] += 1 - - def visit_option_string(self, node): - # do not know if .B or .BI - pass - - def depart_option_string(self, node): - pass - - def visit_option_argument(self, node): - self.context[-3] = '.BI' - if self.body[len(self.body)-1].endswith('='): - # a blank only means no blank in output - self.body.append(' ') - else: - # backslash blank blank - self.body.append('\\ ') - - def depart_option_argument(self, node): - pass - - def visit_organization(self, node): - raise NotImplementedError, node.astext() - self.visit_docinfo_item(node, 'organization') - - def depart_organization(self, node): - raise NotImplementedError, node.astext() - self.depart_docinfo_item() - - def visit_paragraph(self, node): - # .PP or - return - self.body.append('\n') - - def depart_paragraph(self, node): - # .PP or an empty line - return - self.body.append('>\n') - - def visit_problematic(self, node): - raise NotImplementedError, node.astext() - if node.hasattr('refid'): - self.body.append('<a href="#%s" name="%s">' % (node['refid'], - node['id'])) - self.context.append('</a>') - else: - self.context.append('') - self.body.append(self.starttag(node, 'span', '', CLASS='problematic')) - - def depart_problematic(self, node): - raise NotImplementedError, node.astext() - self.body.append('</span>') - self.body.append(self.context.pop()) - - def visit_raw(self, node): - raise NotImplementedError, node.astext() - if node.get('format') == 'html': - self.body.append(node.astext()) - # Keep non-HTML raw text out of output: - raise nodes.SkipNode - - def visit_reference(self, node): - """E.g. email address.""" - pass - - def depart_reference(self, node): - pass - - def visit_revision(self, node): - self.visit_docinfo_item(node, 'revision') - - def depart_revision(self, node): - self.depart_docinfo_item() - - def visit_row(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'tr', '')) - - def depart_row(self, node): - raise NotImplementedError, node.astext() - self.body.append('</tr>\n') - - def visit_section(self, node): - self.body.append(self.comment('visit_section')) - self.body.append('\n.SH ') - # BUG first section = title should say NAME for whatis database. - self.section_level += 1 - - def depart_section(self, node): - self.section_level -= 1 - self.body.append('\n') - self.body.append(self.comment('depart_section')) - - def visit_status(self, node): - raise NotImplementedError, node.astext() - self.visit_docinfo_item(node, 'status', meta=None) - - def depart_status(self, node): - self.depart_docinfo_item() - - def visit_strong(self, node): - raise NotImplementedError, node.astext() - self.body.append('<strong>') - - def depart_strong(self, node): - raise NotImplementedError, node.astext() - self.body.append('</strong>') - - def visit_substitution_definition(self, node): - """Internal only.""" - raise nodes.SkipNode - - def visit_substitution_reference(self, node): - self.unimplemented_visit(node) - - def visit_subtitle(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'h2', '', CLASS='subtitle')) - - def depart_subtitle(self, node): - raise NotImplementedError, node.astext() - self.body.append('</h2>\n') - - def visit_system_message(self, node): - raise NotImplementedError, node.astext() - if node['level'] < self.document.reporter['writer'].report_level: - # Level is too low to display: - raise nodes.SkipNode - self.body.append(self.starttag(node, 'div', CLASS='system-message')) - self.body.append('<p class="system-message-title">') - attr = {} - backref_text = '' - if node.hasattr('id'): - attr['name'] = node['id'] - if node.hasattr('backrefs'): - backrefs = node['backrefs'] - if len(backrefs) == 1: - backref_text = ('; <em><a href="#%s">backlink</a></em>' - % backrefs[0]) - else: - i = 1 - backlinks = [] - for backref in backrefs: - backlinks.append('<a href="#%s">%s</a>' % (backref, i)) - i += 1 - backref_text = ('; <em>backlinks: %s</em>' - % ', '.join(backlinks)) - if node.hasattr('line'): - line = ', line %s' % node['line'] - else: - line = '' - if attr: - a_start = self.starttag({}, 'a', '', **attr) - a_end = '</a>' - else: - a_start = a_end = '' - self.body.append('System Message: %s%s/%s%s (<tt>%s</tt>%s)%s</p>\n' - % (a_start, node['type'], node['level'], a_end, - node['source'], line, backref_text)) - - def depart_system_message(self, node): - raise NotImplementedError, node.astext() - self.body.append('</div>\n') - - def visit_table(self, node): - self.body.append(self.comment('visit_table')) - raise nodes.SkipNode - - def depart_table(self, node): - self.body.append(self.comment('depart_table')) - - def visit_target(self, node): - self.body.append(self.comment('visit_target')) - - def depart_target(self, node): - self.body.append(self.comment('depart_target')) - - def visit_tbody(self, node): - raise NotImplementedError, node.astext() - self.write_colspecs() - self.body.append(self.context.pop()) # '</colgroup>\n' or '' - self.body.append(self.starttag(node, 'tbody', valign='top')) - - def depart_tbody(self, node): - raise NotImplementedError, node.astext() - self.body.append('</tbody>\n') - - def visit_term(self, node): - self.body.append(self.comment('visit_term')) - - def depart_term(self, node): - self.body.append(self.comment('depart_term')) - - def visit_tgroup(self, node): - raise NotImplementedError, node.astext() - # Mozilla needs <colgroup>: - self.body.append(self.starttag(node, 'colgroup')) - # Appended by thead or tbody: - self.context.append('</colgroup>\n') - - def depart_tgroup(self, node): - pass - - def visit_thead(self, node): - raise NotImplementedError, node.astext() - self.write_colspecs() - self.body.append(self.context.pop()) # '</colgroup>\n' - # There may or may not be a <thead>; this is for <tbody> to use: - self.context.append('') - self.body.append(self.starttag(node, 'thead', valign='bottom')) - - def depart_thead(self, node): - raise NotImplementedError, node.astext() - self.body.append('</thead>\n') - - def visit_tip(self, node): - self.visit_admonition(node, 'tip') - - def depart_tip(self, node): - self.depart_admonition() - - def visit_title(self, node): - if isinstance(node.parent, nodes.topic): - self.body.append(self.comment('topic-title')) - elif isinstance(node.parent, nodes.sidebar): - self.body.append(self.comment('sidebar-title')) - elif isinstance(node.parent, nodes.admonition): - self.body.append(self.comment('admonition-title')) - elif self.section_level == 0: - # document title maybe for .TH - # self.head.append('<title>%s</title>\n' - # % self.encode(node.astext())) - pass - else: - # self.body.append(self.comment('h%s' % self.section_level)) - pass - - def depart_title(self, node): - pass - - def visit_title_reference(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.starttag(node, 'cite', '')) - - def depart_title_reference(self, node): - raise NotImplementedError, node.astext() - self.body.append('</cite>') - - def visit_topic(self, node): - self.body.append(self.comment('topic: '+node.astext())) - raise nodes.SkipNode - ##self.topic_class = node.get('class') - - def depart_topic(self, node): - ##self.topic_class = '' - pass - - def visit_transition(self, node): - raise NotImplementedError, node.astext() - self.body.append(self.emptytag(node, 'hr')) - - def depart_transition(self, node): - pass - - def visit_version(self, node): - raise NotImplementedError, node.astext() - self.visit_docinfo_item(node, 'version', meta=None) - - def depart_version(self, node): - self.depart_docinfo_item() - - def visit_warning(self, node): - self.visit_admonition(node, 'warning') - - def depart_warning(self, node): - self.depart_admonition() - - def unimplemented_visit(self, node): - raise NotImplementedError('visiting unimplemented node type: %s' - % node.__class__.__name__) - - -class SimpleListChecker(nodes.GenericNodeVisitor): - - """ - Raise `nodes.SkipNode` if non-simple list item is encountered. - - Here "simple" means a list item containing nothing other than a single - paragraph, a simple list, or a paragraph followed by a simple list. - """ - - def default_visit(self, node): - raise nodes.NodeFound - - def visit_bullet_list(self, node): - pass - - def visit_enumerated_list(self, node): - pass - - def visit_list_item(self, node): - children = [] - for child in node.get_children(): - if not isinstance(child, nodes.Invisible): - children.append(child) - if (children and isinstance(children[0], nodes.paragraph) - and (isinstance(children[-1], nodes.bullet_list) - or isinstance(children[-1], nodes.enumerated_list))): - children.pop() - if len(children) <= 1: - return - else: - raise nodes.NodeFound - - def invisible_visit(self, node): - """Invisible nodes should be ignored.""" - pass - - visit_comment = invisible_visit - visit_substitution_definition = invisible_visit - visit_target = invisible_visit - visit_pending = invisible_visit - -# vim: set et ts=4 ai : diff --git a/sandbox/grubert/man/__init__.py b/sandbox/grubert/man/__init__.py deleted file mode 100644 index c1ab26a53..000000000 --- a/sandbox/grubert/man/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# python package. diff --git a/sandbox/grubert/pdf1 b/sandbox/grubert/pdf1 deleted file mode 100755 index db5f32d84..000000000 --- a/sandbox/grubert/pdf1 +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -DOCUTILS=../.. -QWRITER=$DOCUTILS/tools/quicktest.py -OUT=test.pdf -TEXT=pdftest_3.txt - -PYTHONPATH=`pwd`:$DOCUTILS:$PYTHONPATH - -if [ -n "$1" -a -e "$1" ] ; then - TEXT=$1 - shift -fi - -if [ -n "$1" ] ; then - echo "-$1-" - if [ $1 == "t" ] ; then - $QWRITER -p $TEXT |less - exit - fi -fi - -./pdf.py $TEXT $OUT - diff --git a/sandbox/grubert/pdftest_1.txt b/sandbox/grubert/pdftest_1.txt deleted file mode 100644 index 3c215d725..000000000 --- a/sandbox/grubert/pdftest_1.txt +++ /dev/null @@ -1,127 +0,0 @@ -Text - -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... - -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... - -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... -Und was ich immer schon einmal sagen wollte ... - - diff --git a/sandbox/grubert/pdftest_2.txt b/sandbox/grubert/pdftest_2.txt deleted file mode 100644 index 9ccd0bef8..000000000 --- a/sandbox/grubert/pdftest_2.txt +++ /dev/null @@ -1,49 +0,0 @@ -.. This is a comment. Note how any initial comments are moved by - transforms to after the document title, subtitle, and docinfo. - -================================ - reStructuredText Test Document -================================ - -.. Above is the document title, and below is the subtitle. - They are transformed from section titles after parsing. - --------------------------------- - Examples of Syntax Constructs --------------------------------- - -.. bibliographic fields (which also require a transform): - -Structural Elements -=================== - -Section Title -------------- - -That's it, the text just above this line. - -Transitions ------------ - -Here's a transition: - ---------- - -It divides the section. - -Body Elements -============= - -Paragraphs ----------- - -A paragraph. - -Inline Markup -````````````` - -Paragraphs contain text and may contain inline markup: *emphasis*, -**strong emphasis**, `interpreted text`, ``inline literals``, -standalone hyperlinks (http://www.python.org), external hyperlinks -(Python_), internal cross-references (example_). - diff --git a/sandbox/grubert/rllicense.txt b/sandbox/grubert/rllicense.txt deleted file mode 100644 index f3825f506..000000000 --- a/sandbox/grubert/rllicense.txt +++ /dev/null @@ -1,29 +0,0 @@ -##################################################################################### -# -# Copyright (c) 2000-2001, ReportLab Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of the company nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE OFFICERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -##################################################################################### diff --git a/sandbox/grubert/rlpdf/README.txt b/sandbox/grubert/rlpdf/README.txt deleted file mode 100644 index 62e31f1ef..000000000 --- a/sandbox/grubert/rlpdf/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -modules from reportlab tools - diff --git a/sandbox/grubert/rlpdf/__init__.py b/sandbox/grubert/rlpdf/__init__.py deleted file mode 100644 index 274814120..000000000 --- a/sandbox/grubert/rlpdf/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# rlpdf subpackage - -from rlpdf import Writer -from stylesheet import getStyleSheet -from rltemplate import RLDocTemplate diff --git a/sandbox/grubert/rlpdf/rlpdf.py b/sandbox/grubert/rlpdf/rlpdf.py deleted file mode 100644 index 781aa0e70..000000000 --- a/sandbox/grubert/rlpdf/rlpdf.py +++ /dev/null @@ -1,671 +0,0 @@ -#! /usr/bin/env python - -""" -:Author: Engelbert Gruber -:Contact: goodger@users.sourceforge.net -:Revision: $Revision$ -:Date: $Date$ -:Copyright: This module has been placed in the public domain. - -Simple pdf writer. - -The output uses reportlabs module. - -Some stylesheet is needed. -""" - -__docformat__ = 'reStructuredText' - - -import time -from types import ListType -from docutils import writers, nodes, languages - -from stylesheet import getStyleSheet -from rltemplate import RLDocTemplate - -from reportlab.lib.styles import ParagraphStyle -from reportlab.lib.enums import * -from reportlab.lib.pagesizes import A4 -from reportlab.platypus import * -from reportlab.lib import colors -from reportlab.lib.units import inch - -class Writer(writers.Writer): - - output = None - """Final translated form of `document`.""" - - def translate(self): - visitor = PDFTranslator(self.document) - self.document.walkabout(visitor) - self.story = visitor.as_what() - - def record(self): - doc = RLDocTemplate(self.destination, pagesize=A4) - doc.build(self.story) - - def lower(self): - return 'pdf' - -class PDFTranslator(nodes.NodeVisitor): - - def __init__(self, doctree): - self.styleSheet = getStyleSheet() - nodes.NodeVisitor.__init__(self, doctree) - self.language = languages.get_language(doctree.settings.language_code) - self.head = [] - self.body = [] - self.foot = [] - self.sectionlevel = 0 - self.context = [] - self.topic_class = '' - self.story = [] - self.bulletText = '\xb7' # maybe move this into stylesheet. - - def as_what(self): - return self.story - - def encode(self, text): - """Encode special characters in `text` & return.""" - text = text.replace("&", "&") - #text = text.replace("<", "(lt)") - #text = text.replace('"', "(quot)") - #text = text.replace(">", "(gt)") - # footnotes have character values above 128 ? - for i in range(len(text)): - if (ord(text[i])>128): - return "ATT" - print "warning: %d %x" % (i,ord(text[i])) - text.replace(text[i],"?") - return text - - def append_styled(self,text,in_style='Normal'): - if self.styleSheet.has_key(in_style): - style = self.styleSheet[in_style] - self.story.append(Paragraph(self.encode(text), style, bulletText=None)) - - def append_normal(self,text): - style = self.styleSheet['Normal'] - self.story.append(Paragraph(self.encode(text), style, bulletText=None)) - - def starttag(self, node, tagname, suffix='\n', **attributes): - atts = {} - for (name, value) in attributes.items(): - atts[name.lower()] = value - for att in ('class',): # append to node attribute - if node.has_key(att): - if atts.has_key(att): - atts[att] = node[att] + ' ' + atts[att] - for att in ('id',): # node attribute overrides - if node.has_key(att): - atts[att] = node[att] - attlist = atts.items() - attlist.sort() - parts = [tagname.upper()] - for name, value in attlist: - if value is None: # boolean attribute - parts.append(name.upper()) - elif isinstance(value, ListType): - values = [str(v) for v in value] - parts.append('%s="%s"' % (name.upper(), - self.encode(' '.join(values)))) - else: - parts.append('%s="%s"' % (name.upper(), - self.encode(str(value)))) - return '<%s>%s' % (' '.join(parts), suffix) - - def visit_Text(self, node): - #self.body.append(self.encode(node.astext())) - # Text is visited for every element ? - #self.append_normal("Text:"+node.astext()) - pass - - def depart_Text(self, node): - pass - - def visit_admonition(self, node, name): - self.body.append(self.starttag(node, 'div', CLASS=name)) - self.body.append('<P CLASS="admonition-title">' + self.language.labels[name] + '</P>\n') - - def depart_admonition(self): - self.body.append('</DIV>\n') - - def visit_attention(self, node): - self.visit_admonition(node, 'attention') - - def depart_attention(self, node): - self.depart_admonition() - - def visit_author(self, node): - self.visit_docinfo_item(node, 'author') - - def depart_author(self, node): - self.depart_docinfo_item() - - def visit_authors(self, node): - pass - - def depart_authors(self, node): - pass - - def visit_block_quote(self, node): - self.body.append(self.starttag(node, 'blockquote')) - - def depart_block_quote(self, node): - self.body.append('</BLOCKQUOTE>\n') - - def visit_bullet_list(self, node): - if self.topic_class == 'contents': - self.body.append(self.starttag(node, 'ul', compact=None)) - else: - style = self.styleSheet['Normal'] - self.story.append(Paragraph(self.encode(node.astext()), - style, bulletText=self.bulletText)) - - def depart_bullet_list(self, node): - pass - - def visit_caption(self, node): - self.body.append(self.starttag(node, 'p', '', CLASS='caption')) - - def depart_caption(self, node): - self.body.append('</P>\n') - - def visit_caution(self, node): - self.visit_admonition(node, 'caution') - - def depart_caution(self, node): - self.depart_admonition() - - def visit_citation(self, node): - self.body.append(self.starttag(node, 'table', CLASS='citation', - frame="void", rules="none")) - self.body.append('<COL CLASS="label">\n' - '<COL>\n' - '<TBODY VALIGN="top">\n' - '<TR><TD>\n') - - def depart_citation(self, node): - self.body.append('</TD></TR>\n' - '</TBODY>\n</TABLE>\n') - - def visit_citation_reference(self, node): - href = '' - if node.has_key('refid'): - href = '#' + node['refid'] - elif node.has_key('refname'): - href = '#' + self.doctree.nameids[node['refname']] - self.body.append(self.starttag(node, 'a', '[', href=href, #node['refid'], - CLASS='citation-reference')) - - def depart_citation_reference(self, node): - self.body.append(']</A>') - - def visit_classifier(self, node): - self.body.append(' <SPAN CLASS="classifier-delimiter">:</SPAN> ') - self.body.append(self.starttag(node, 'span', '', CLASS='classifier')) - - def depart_classifier(self, node): - self.body.append('</SPAN>') - - def visit_colspec(self, node): - atts = {} - #if node.has_key('colwidth'): - # atts['width'] = str(node['colwidth']) + '*' - self.body.append(self.starttag(node, 'col', **atts)) - - def depart_colspec(self, node): - pass - - def visit_comment(self, node): - self.body.append('<!-- ') - - def depart_comment(self, node): - self.body.append(' -->\n') - - def visit_contact(self, node): - self.visit_docinfo_item(node, 'contact') - - def depart_contact(self, node): - self.depart_docinfo_item() - - def visit_copyright(self, node): - self.visit_docinfo_item(node, 'copyright') - - def depart_copyright(self, node): - self.depart_docinfo_item() - - def visit_danger(self, node): - self.visit_admonition(node, 'danger') - - def depart_danger(self, node): - self.depart_admonition() - - def visit_date(self, node): - self.visit_docinfo_item(node, 'date') - - def depart_date(self, node): - self.depart_docinfo_item() - - def visit_definition(self, node): - self.body.append('</DT>\n') - self.body.append(self.starttag(node, 'dd')) - - def depart_definition(self, node): - self.body.append('</DD>\n') - - def visit_definition_list(self, node): - self.body.append(self.starttag(node, 'dl')) - - def depart_definition_list(self, node): - self.body.append('</DL>\n') - - def visit_definition_list_item(self, node): - pass - - def depart_definition_list_item(self, node): - pass - - def visit_description(self, node): - self.body.append('<TD>\n') - - def depart_description(self, node): - self.body.append('</TD>') - - def visit_docinfo(self, node): - self.body.append(self.starttag(node, 'table', CLASS='docinfo', - frame="void", rules="none")) - self.body.append('<COL CLASS="docinfo-name">\n' - '<COL CLASS="docinfo-content">\n' - '<TBODY VALIGN="top">\n') - - def depart_docinfo(self, node): - self.body.append('</TBODY>\n</TABLE>\n') - - def visit_docinfo_item(self, node, name): - self.head.append('<META NAME="%s" CONTENT="%s">\n' - % (name, self.encode(node.astext()))) - self.body.append(self.starttag(node, 'tr', '')) - self.body.append('<TD>\n' - '<P CLASS="docinfo-name">%s:</P>\n' - '</TD><TD>\n' - '<P>' % self.language.labels[name]) - - def depart_docinfo_item(self): - self.body.append('</P>\n</TD></TR>') - - def visit_doctest_block(self, node): - self.body.append(self.starttag(node, 'pre', CLASS='doctest-block')) - - def depart_doctest_block(self, node): - self.body.append('</PRE>\n') - - def visit_document(self, node): - self.body.append(self.starttag(node, 'div', CLASS='document')) - - def depart_document(self, node): - self.body.append('</DIV>\n') - #self.body.append( - # '<P CLASS="credits">HTML generated from <CODE>%s</CODE> on %s ' - # 'by <A HREF="http://docutils.sourceforge.net/">Docutils</A>.' - # '</P>\n' % (node['source'], time.strftime('%Y-%m-%d'))) - - def visit_emphasis(self, node): - self.append_styled(node.astext(),'Italic') - - def depart_emphasis(self, node): - pass - - def visit_entry(self, node): - if isinstance(node.parent.parent, nodes.thead): - tagname = 'th' - else: - tagname = 'td' - atts = {} - if node.has_key('morerows'): - atts['rowspan'] = node['morerows'] + 1 - if node.has_key('morecols'): - atts['colspan'] = node['morecols'] + 1 - self.body.append(self.starttag(node, tagname, **atts)) - self.context.append('</%s>' % tagname.upper()) - if len(node) == 0: # empty cell - self.body.append(' ') - - def depart_entry(self, node): - self.body.append(self.context.pop()) - - def visit_enumerated_list(self, node): - """ - The 'start' attribute does not conform to HTML 4.01's strict.dtd, but - CSS1 doesn't help. CSS2 isn't widely enough supported yet to be - usable. - """ - atts = {} - if node.has_key('start'): - atts['start'] = node['start'] - if node.has_key('enumtype'): - atts['class'] = node['enumtype'] - # @@@ To do: prefix, suffix. How? Change prefix/suffix to a - # single "format" attribute? Use CSS2? - self.body.append(self.starttag(node, 'ol', **atts)) - - def depart_enumerated_list(self, node): - self.body.append('</OL>\n') - - def visit_error(self, node): - self.visit_admonition(node, 'error') - - def depart_error(self, node): - self.depart_admonition() - - def visit_field(self, node): - self.body.append(self.starttag(node, 'tr', CLASS='field')) - - def depart_field(self, node): - self.body.append('</TR>\n') - - def visit_field_argument(self, node): - self.body.append(' ') - self.body.append(self.starttag(node, 'span', '', - CLASS='field-argument')) - - def depart_field_argument(self, node): - self.body.append('</SPAN>') - - def visit_field_body(self, node): - self.body.append(':</P>\n</TD><TD>') - self.body.append(self.starttag(node, 'div', CLASS='field-body')) - - def depart_field_body(self, node): - self.body.append('</DIV></TD>\n') - - def visit_field_list(self, node): - self.body.append(self.starttag(node, 'table', frame='void', - rules='none')) - self.body.append('<COL CLASS="field-name">\n' - '<COL CLASS="field-body">\n' - '<TBODY VALIGN="top">\n') - - def depart_field_list(self, node): - self.body.append('</TBODY>\n</TABLE>\n') - - def visit_field_name(self, node): - self.body.append('<TD>\n') - self.body.append(self.starttag(node, 'p', '', CLASS='field-name')) - - def depart_field_name(self, node): - """ - Leave the end tag to `self.visit_field_body()`, in case there are any - field_arguments. - """ - pass - - def visit_figure(self, node): - self.body.append(self.starttag(node, 'div', CLASS='figure')) - - def depart_figure(self, node): - self.body.append('</DIV>\n') - - def visit_footnote(self, node): - self.body.append(self.starttag(node, 'table', CLASS='footnote', - frame="void", rules="none")) - self.body.append('<COL CLASS="label">\n' - '<COL>\n' - '<TBODY VALIGN="top">\n' - '<TR><TD>\n') - - def depart_footnote(self, node): - self.body.append('</TD></TR>\n' - '</TBODY>\n</TABLE>\n') - - def visit_footnote_reference(self, node): - href = '' - if node.has_key('refid'): - href = '#' + node['refid'] - elif node.has_key('refname'): - href = '#' + self.doctree.nameids[node['refname']] - self.body.append(self.starttag(node, 'a', '', href=href, #node['refid'], - CLASS='footnote-reference')) - - def depart_footnote_reference(self, node): - self.body.append('</A>') - - def visit_hint(self, node): - self.visit_admonition(node, 'hint') - - def depart_hint(self, node): - self.depart_admonition() - - def visit_image(self, node): - atts = node.attributes.copy() - atts['src'] = atts['uri'] - del atts['uri'] - if not atts.has_key('alt'): - atts['alt'] = atts['src'] - self.body.append(self.starttag(node, 'img', '', **atts)) - - def depart_image(self, node): - pass - - def visit_important(self, node): - self.visit_admonition(node, 'important') - - def depart_important(self, node): - self.depart_admonition() - - def visit_interpreted(self, node): - self.body.append('<SPAN class="interpreted">') - - def depart_interpreted(self, node): - self.body.append('</SPAN>') - - def visit_label(self, node): - self.body.append(self.starttag(node, 'p', '[', CLASS='label')) - - def depart_label(self, node): - self.body.append(']</P>\n' - '</TD><TD>\n') - - def visit_legend(self, node): - self.body.append(self.starttag(node, 'div', CLASS='legend')) - - def depart_legend(self, node): - self.body.append('</DIV>\n') - - def visit_list_item(self, node): - self.body.append(self.starttag(node, 'li')) - - def depart_list_item(self, node): - self.body.append('</LI>\n') - - def visit_literal(self, node): - self.body.append('<CODE>') - - def depart_literal(self, node): - self.body.append('</CODE>') - - def visit_literal_block(self, node): - self.body.append(self.starttag(node, 'pre', CLASS='literal-block')) - - def depart_literal_block(self, node): - self.body.append('</PRE>\n') - - def visit_meta(self, node): - self.head.append(self.starttag(node, 'meta', **node.attributes)) - - def depart_meta(self, node): - pass - - def visit_note(self, node): - self.visit_admonition(node, 'note') - - def depart_note(self, node): - self.depart_admonition() - - def visit_option(self, node): - if self.context[-1]: - self.body.append(', ') - - def depart_option(self, node): - self.context[-1] += 1 - - def visit_option_argument(self, node): - self.body.append(node.get('delimiter', ' ')) - self.body.append(self.starttag(node, 'span', '', - CLASS='option-argument')) - - def depart_option_argument(self, node): - self.body.append('</SPAN>') - - def visit_option_group(self, node): - atts = {} - if len(node.astext()) > 14: - atts['colspan'] = 2 - self.context.append('</TR>\n<TR><TD> </TD>') - else: - self.context.append('') - self.body.append(self.starttag(node, 'td', **atts)) - self.body.append('<P><CODE>') - self.context.append(0) - - def depart_option_group(self, node): - self.context.pop() - self.body.append('</CODE></P>\n</TD>') - self.body.append(self.context.pop()) - - def visit_option_list(self, node): - self.body.append( - self.starttag(node, 'table', CLASS='option-list', - frame="void", rules="none", cellspacing=12)) - self.body.append('<COL CLASS="option">\n' - '<COL CLASS="description">\n' - '<TBODY VALIGN="top">\n') - - def depart_option_list(self, node): - self.body.append('</TBODY>\n</TABLE>\n') - - def visit_option_list_item(self, node): - self.body.append(self.starttag(node, 'tr', '')) - - def depart_option_list_item(self, node): - self.body.append('</TR>\n') - - def visit_option_string(self, node): - self.body.append(self.starttag(node, 'span', '', CLASS='option')) - - def depart_option_string(self, node): - self.body.append('</SPAN>') - - def visit_organization(self, node): - self.visit_docinfo_item(node, 'organization') - - def depart_organization(self, node): - self.depart_docinfo_item() - - def visit_paragraph(self, node): - if not self.topic_class == 'contents': - self.append_normal(node.astext()) - - def depart_paragraph(self, node): - if self.topic_class == 'contents': - self.append_normal('\n') - else: - self.append_normal('\n') - - def visit_problematic(self, node): - if node.hasattr('refid'): - self.body.append('<A HREF="#%s">' % node['refid']) - self.context.append('</A>') - else: - self.context.append('') - self.body.append(self.starttag(node, 'span', '', CLASS='problematic')) - - def depart_problematic(self, node): - self.body.append('</SPAN>') - self.body.append(self.context.pop()) - - def visit_raw(self, node): - if node.has_key('format') and node['format'] == 'html': - self.body.append(node.astext()) - raise nodes.SkipNode - - def visit_reference(self, node): - if node.has_key('refuri'): - href = node['refuri'] - elif node.has_key('refid'): - #else: - href = '#' + node['refid'] - elif node.has_key('refname'): - # @@@ Check for non-existent mappings. Here or in a transform? - href = '#' + self.doctree.nameids[node['refname']] - self.body.append(self.starttag(node, 'a', '', href=href, - CLASS='reference')) - - def depart_reference(self, node): - self.body.append('</A>') - - def visit_revision(self, node): - self.visit_docinfo_item(node, 'revision') - - def depart_revision(self, node): - self.depart_docinfo_item() - - def visit_row(self, node): - self.body.append(self.starttag(node, 'tr', '')) - - def depart_row(self, node): - self.body.append('</TR>\n') - - def visit_section(self, node): - self.sectionlevel += 1 - self.body.append(self.starttag(node, 'div', CLASS='section')) - - def depart_section(self, node): - self.sectionlevel -= 1 - self.body.append('</DIV>\n') - - def visit_status(self, node): - self.visit_docinfo_item(node, 'status') - - def depart_status(self, node): - self.depart_docinfo_item() - - def visit_strong(self, node): - self.body.append('<STRONG>') - - def depart_strong(self, node): - self.body.append('</STRONG>') - - def visit_subtitle(self, node): - self.append_styled(node.astext(),'h2') - - def depart_subtitle(self, node): - pass - - def visit_title(self, node): - """Only 6 section levels are supported by HTML.""" - if isinstance(node.parent, nodes.topic): - self.body.append( - self.starttag(node, 'P', '', CLASS='topic-title')) - self.context.append('</P>\n') - elif self.sectionlevel == 0: - self.head.append('<TITLE>%s</TITLE>\n' - % self.encode(node.astext())) - self.body.append(self.starttag(node, 'H1', '', CLASS='title')) - self.context.append('</H1>\n') - self.append_styled(node.astext(),'h1') - else: - self.append_styled(node.astext(), "h%s" % self.sectionlevel ) - context = '' - if node.hasattr('refid'): - self.body.append('<A HREF="#%s">' % node['refid']) - context = '</A>' - self.context.append('%s</H%s>\n' % (context, self.sectionlevel)) - - def depart_title(self, node): - self.body.append(self.context.pop()) - - def unimplemented_visit(self, node): - raise NotImplementedError('visiting unimplemented node type: %s' - % node.__class__.__name__) diff --git a/sandbox/grubert/rlpdf/rltemplate.py b/sandbox/grubert/rlpdf/rltemplate.py deleted file mode 100644 index dc462430f..000000000 --- a/sandbox/grubert/rlpdf/rltemplate.py +++ /dev/null @@ -1,143 +0,0 @@ -#copyright ReportLab Inc. 2000 -#see rllicense.txt for license details -#history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/docs/tools/rltemplate.py?cvsroot=reportlab -#$Header$ -# doc template for RL manuals. Currently YAML is hard-coded -#to use this, which is wrong. - - -from reportlab.platypus import PageTemplate, \ - BaseDocTemplate, SimpleDocTemplate, Frame, Paragraph -from reportlab.lib.units import inch, cm -from reportlab.rl_config import defaultPageSize - - -class FrontCoverTemplate(PageTemplate): - def __init__(self, id, pageSize=defaultPageSize): - self.pageWidth = pageSize[0] - self.pageHeight = pageSize[1] - frame1 = Frame(inch, - 3*inch, - self.pageWidth - 2*inch, - self.pageHeight - 518, id='cover') - PageTemplate.__init__(self, id, [frame1]) # note lack of onPage - - def afterDrawPage(self, canvas, doc): - canvas.saveState() - #canvas.drawImage('../images/replogo.gif',2*inch, 8*inch) - - - canvas.setFont('Times-Roman', 10) - canvas.line(inch, 120, self.pageWidth - inch, 120) - - #canvas.drawString(inch, 100, 'Lombard Business Park') - #canvas.drawString(inch, 88, '8 Lombard Road') - #canvas.drawString(inch, 76, 'Wimbledon') - #canvas.drawString(inch, 64, 'London, ENGLAND SW19 3TZ') - - #canvas.drawRightString(self.pageWidth - inch, 100, '103 Bayard Street') - #canvas.drawRightString(self.pageWidth - inch, 88, 'New Brunswick') - #canvas.drawRightString(self.pageWidth - inch, 76, 'New Jersey, 08904)') - #canvas.drawRightString(self.pageWidth - inch, 64, 'USA') - - canvas.restoreState() - - -class OneColumnTemplate(PageTemplate): - def __init__(self, id, pageSize=defaultPageSize): - self.pageWidth = pageSize[0] - self.pageHeight = pageSize[1] - frame1 = Frame(inch, - inch, - self.pageWidth - 2*inch, - self.pageHeight - 2*inch, - id='normal') - PageTemplate.__init__(self, id, [frame1]) # note lack of onPage - - def afterDrawPage(self, canvas, doc): - y = self.pageHeight - 50 - canvas.saveState() - canvas.setFont('Times-Roman', 10) - canvas.drawString(inch, y+8, doc.title) - canvas.drawRightString(self.pageWidth - inch, y+8, doc.chapter) - canvas.line(inch, y, self.pageWidth - inch, y) - canvas.drawCentredString(doc.pagesize[0] / 2, 0.75*inch, 'Page %d' % canvas.getPageNumber()) - canvas.restoreState() - -class TwoColumnTemplate(PageTemplate): - def __init__(self, id, pageSize=defaultPageSize): - self.pageWidth = pageSize[0] - self.pageHeight = pageSize[1] - colWidth = 0.5 * (self.pageWidth - 2.25*inch) - frame1 = Frame(inch, - inch, - colWidth, - self.pageHeight - 2*inch, - id='leftCol') - frame2 = Frame(0.5 * self.pageWidth + 0.125, - inch, - colWidth, - self.pageHeight - 2*inch, - id='rightCol') - PageTemplate.__init__(self, id, [frame1, frame2]) # note lack of onPage - - def afterDrawPage(self, canvas, doc): - y = self.pageHeight - 50 - canvas.saveState() - canvas.setFont('Times-Roman', 10) - canvas.drawString(inch, y+8, doc.title) - canvas.drawRightString(self.pageWidth - inch, y+8, doc.chapter) - canvas.line(inch, y, self.pageWidth - inch, y*inch) - canvas.drawCentredString(doc.pagesize[0] / 2, 0.75*inch, 'Page %d' % canvas.getPageNumber()) - canvas.restoreState() - - -# class RLDocTemplate(BaseDocTemplate): -class RLDocTemplate(SimpleDocTemplate): - def afterInit(self): - self.addPageTemplates(FrontCoverTemplate('Cover', self.pagesize)) - self.addPageTemplates(OneColumnTemplate('Normal', self.pagesize)) - self.addPageTemplates(TwoColumnTemplate('TwoColumn', self.pagesize)) - self.addPageTemplates(OneColumnTemplate('Cover', self.pagesize)) - - #just playing - self.title = "(Document Title Goes Here)" - self.chapter = "(No chapter yet)" - self.chapterNo = 1 #unique keys - self.sectionNo = 1 # unique keys - -## # AR hack -## self.counter = 1 - def beforeDocument(self): - self.canv.showOutline() - - def afterFlowable(self, flowable): - """Detect Level 1 and 2 headings, build outline, - and track chapter title.""" - if isinstance(flowable, Paragraph): - style = flowable.style.name - -## #AR debug text -## try: -## print '%d: %s...' % (self.counter, flowable.getPlainText()[0:40]) -## except AttributeError: -## print '%d: (something with ABag)' % self.counter -## self.counter = self.counter + 1 - - if style == 'Title': - self.title = flowable.getPlainText() - elif style == 'Heading1': - self.chapter = flowable.getPlainText() - key = 'ch%d' % self.chapterNo - self.canv.bookmarkPage(key) - self.canv.addOutlineEntry(flowable.getPlainText(), - key, 0, 0) - self.chapterNo = self.chapterNo + 1 - self.sectionNo = 1 - elif style == 'Heading2': - self.section = flowable.text - key = 'ch%ds%d' % (self.chapterNo, self.sectionNo) - self.canv.bookmarkPage(key) - self.canv.addOutlineEntry(flowable.getPlainText(), - key, 1, 0) - self.sectionNo = self.sectionNo + 1 diff --git a/sandbox/grubert/rlpdf/stylesheet.py b/sandbox/grubert/rlpdf/stylesheet.py deleted file mode 100644 index 3b7749935..000000000 --- a/sandbox/grubert/rlpdf/stylesheet.py +++ /dev/null @@ -1,158 +0,0 @@ -#copyright ReportLab Inc. 2000 -#see rllicense.txt for license details -#history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/docs/tools/stylesheet.py?cvsroot=reportlab -#$Header$ -#standard stylesheet for our manuals -from reportlab.lib.styles import StyleSheet1, ParagraphStyle -from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT, TA_JUSTIFY -from reportlab.lib import colors - - -def getStyleSheet(): - """Returns a stylesheet object""" - stylesheet = StyleSheet1() - - stylesheet.add(ParagraphStyle(name='Normal', - fontName='Times-Roman', - fontSize=10, - leading=12, - spaceBefore=6) - ) - - stylesheet.add(ParagraphStyle(name='Comment', - fontName='Times-Italic') - ) - - stylesheet.add(ParagraphStyle(name='Indent1', - leftIndent=36, - firstLineIndent=0) - ) - - stylesheet.add(ParagraphStyle(name='BodyText', - parent=stylesheet['Normal'], - spaceBefore=6) - ) - stylesheet.add(ParagraphStyle(name='Italic', - parent=stylesheet['BodyText'], - fontName = 'Times-Italic') - ) - - stylesheet.add(ParagraphStyle(name='Heading1', - parent=stylesheet['Normal'], - fontName = 'Times-Bold', - alignment=TA_CENTER, - fontSize=18, - leading=22, - spaceAfter=6), - alias='h1') - - stylesheet.add(ParagraphStyle(name='Heading2', - parent=stylesheet['Normal'], - fontName = 'Times-Bold', - fontSize=14, - leading=17, - spaceBefore=12, - spaceAfter=6), - alias='h2') - - stylesheet.add(ParagraphStyle(name='Heading3', - parent=stylesheet['Normal'], - fontName = 'Times-BoldItalic', - fontSize=12, - leading=14, - spaceBefore=12, - spaceAfter=6), - alias='h3') - - stylesheet.add(ParagraphStyle(name='Heading4', - parent=stylesheet['Normal'], - fontName = 'Times-BoldItalic', - spaceBefore=10, - spaceAfter=4), - alias='h4') - - stylesheet.add(ParagraphStyle(name='Title', - parent=stylesheet['Normal'], - fontName = 'Times-Bold', - fontSize=48, - leading=56, - spaceAfter=72, - alignment=TA_CENTER - ), - alias='t') - - stylesheet.add(ParagraphStyle(name='Subtitle', - parent=stylesheet['Normal'], - fontName = 'Times-Bold', - fontSize=32, - leading=56, - spaceAfter=72, - alignment=TA_CENTER - ), - alias='subtitle') - - stylesheet.add(ParagraphStyle(name='Bullet', - parent=stylesheet['Normal'], - firstLineIndent=0, - leftIndent=36, - bulletIndent=18, - spaceBefore=0, - bulletFontName='Symbol'), - alias='bu') - - stylesheet.add(ParagraphStyle(name='Definition', - parent=stylesheet['Normal'], - firstLineIndent=0, - leftIndent=36, - bulletIndent=0, - spaceBefore=6, - bulletFontName='Times-BoldItalic'), - alias='df') - - stylesheet.add(ParagraphStyle(name='Code', - parent=stylesheet['Normal'], - fontName='Courier', - textColor=colors.navy, - fontSize=8, - leading=8.8, - leftIndent=36, - firstLineIndent=0)) - - stylesheet.add(ParagraphStyle(name='FunctionHeader', - parent=stylesheet['Normal'], - fontName='Courier-Bold', - fontSize=8, - leading=8.8)) - - stylesheet.add(ParagraphStyle(name='DocString', - parent=stylesheet['Normal'], - fontName='Courier', - fontSize=8, - leftIndent=18, - leading=8.8)) - - stylesheet.add(ParagraphStyle(name='DocStringIndent', - parent=stylesheet['Normal'], - fontName='Courier', - fontSize=8, - leftIndent=36, - leading=8.8)) - - stylesheet.add(ParagraphStyle(name='URL', - parent=stylesheet['Normal'], - fontName='Courier', - textColor=colors.navy, - alignment=TA_CENTER), - alias='u') - - stylesheet.add(ParagraphStyle(name='Centred', - parent=stylesheet['Normal'], - alignment=TA_CENTER - )) - - stylesheet.add(ParagraphStyle(name='Caption', - parent=stylesheet['Centred'], - fontName='Times-Italic' - )) - - return stylesheet diff --git a/sandbox/grubert/runtest b/sandbox/grubert/runtest deleted file mode 100755 index ad23b39a8..000000000 --- a/sandbox/grubert/runtest +++ /dev/null @@ -1,227 +0,0 @@ -#!/bin/sh - -# quick latex writer test runner -# $Id$ - -CHECKS=0 -FAILS=0 -FAIL_QUEUE="" - -function do_diff() { - CHECKS=$((CHECKS + 1)) - diff -q -s $1 $2 - if test $? -gt 0 ; then - FAILS=$((FAILS + 1)) - FAIL_QUEUE="$FAIL_QUEUE,$1" - fi -} - -function report() { - echo "-------------------------------------" - if test $FAILS -eq 0 ; then - echo "OK: all $CHECKS tests passed" - else - echo "ERROR: $FAILS of $CHECKS failed" - echo "Failed tests: $FAIL_QUEUE" - fi -} - -BASE_CMD="../../tools/rst2latex.py" - -CMD="../../tools/rst2latex.py" -if [ -z "$1" ] ; then - FM="*.txt" -else - FM=$1 -fi - - -for INF in `ls test/$FM` ; do - OUTF="$INF.tex" - REFF="$OUTF.ref" - $CMD $2 $3 $INF > $OUTF - do_diff $REFF $OUTF -done - -if [ -n "$1" -a ! "$1" == "-" ] ; then - report - exit -fi - -INF=test/header.txt -for GO in "" auto pdftex dvips,300dpi ; do - OUTF="$INF-graphicx-option-$GO.tex" - REFF="$OUTF.ref" - $CMD --graphicx-option=$GO $2 $3 $INF > $OUTF - do_diff $REFF $OUTF -done - -# font encoding -CMD="../../tools/rst2latex.py" -for FONTENC in "" T1 OT1 ; do - for INF in `ls test/characters.txt` ; do - OUTF="$INF-$FONTENC.tex" - REFF="$OUTF.ref" - if [ -z $FONTENC ] ; then - $CMD $2 $3 $INF > $OUTF - else - $CMD --font-encoding=$FONTENC $2 $3 $INF > $OUTF - fi - do_diff $REFF $OUTF - done -done - -# table-style -CMD="../../tools/rst2latex.py" - -for TABSTYLE in "" standard booktabs nolines ; do - for INF in `ls test/tables.txt` ; do - OUTF="$INF-$TABSTYLE.tex" - REFF="$OUTF.ref" - if [ -z $TABSTYLE ] ; then - $CMD $2 $3 $INF > $OUTF - else - $CMD --table-style=$TABSTYLE $2 $3 $INF > $OUTF - fi - do_diff $REFF $OUTF - done -done - -# rowspan tables -CMD="../../tools/rst2latex.py" -INF=test/tables-multirow.txt -OUTF="$INF.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -# with generated footer -CMD="../../tools/rst2latex.py -gs" -INF=test/docinfo.txt -OUTF="$INF-gs.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -CMD="../../tools/rst2latex.py --documentclass=book" -INF=test/docinfo.txt -OUTF="$INF-book.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -#CMD="../../tools/rst2latex.py --dump-settings" -CMD="../../tools/rst2latex.py --no-doc-info" -INF=test/docinfo.txt -OUTF="$INF-no-info.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -CMD="../../tools/rst2latex.py --no-doc-title" -INF=test/docinfo.txt -OUTF="$INF-no-title.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -CMD="../../tools/rst2latex.py --no-doc-title --no-doc-info" -INF=test/docinfo.txt -OUTF="$INF-no-title-info.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -CMD="$BASE_CMD --use-latex-docinfo" -for F in docinfo docinfo-2 ; do - INF=test/$F.txt - OUTF="$INF-use-latex-docinfo.tex" - REFF="$OUTF.ref" - $CMD $INF > $OUTF - do_diff $REFF $OUTF -done - -CMD="../../tools/rst2latex.py" -# with latex toc -for F in toc ; do - INF=test/$F.txt - OUTF="$INF-use-latex-toc.tex" - REFF="$OUTF.ref" - $CMD --use-latex-toc $INF > $OUTF - do_diff $REFF $OUTF -done - -# german -for F in toc ; do - INF=test/$F.txt - OUTF="$INF-de.tex" - REFF="$OUTF.ref" - $CMD -l de $INF > $OUTF - do_diff $REFF $OUTF -done - -# french -for F in toc ; do - INF=test/$F.txt - OUTF="$INF-fr.tex" - REFF="$OUTF.ref" - $CMD -l fr $INF > $OUTF - do_diff $REFF $OUTF -done - -# use latex footnotes -CMD="../../tools/rst2latex.py --use-latex-footnotes" -INF=test/footnotes.txt -OUTF="$INF-use-latex-footnotes.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -# use latex citations -CMD="../../tools/rst2latex.py --use-latex-citations" -INF=test/footnotes.txt -OUTF="$INF-use-latex-citations.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF -# on a file without citations -INF=test/no-citations.txt -OUTF="$INF-use-latex-citations.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -CMD="../../tools/rst2latex.py --use-verbatim-when-possible" -INF=test/literal.txt -OUTF="$INF-use-verbatim-when-possible.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -report -echo "CHECK: toc with latex toc " - -exit - -# lost test files. - -INF=test/kasten.txt -OUTF="$INF-de.tex" -REFF="$OUTF.ref" -$CMD -l de $INF > $OUTF -do_diff $REFF $OUTF - -CMD="../../tools/rst2latex.py --attribution=parens" -INF=test/attribution.txt -OUTF="$INF-parens-attribution.tex" -REFF="$OUTF.ref" -$CMD $INF > $OUTF -do_diff $REFF $OUTF - -INF=test/iso-8859-15.txt -OUTF="$INF-enc.tex" -REFF="$OUTF.ref" -$CMD --input-encoding=iso-8859-15 --output-encoding=iso-8859-15 $INF > $OUTF -do_diff $REFF $OUTF - - diff --git a/sandbox/grubert/split-test-txt.py b/sandbox/grubert/split-test-txt.py deleted file mode 100644 index 81cb1fd84..000000000 --- a/sandbox/grubert/split-test-txt.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/python - -""" -Author: grubert@users.sourceforge.net -Revision: $Revision$ - -Split docutils/tools/test.txt up to test one by one. -""" - -import sys, os, os.path - -if len(sys.argv)>1: - test_filename = sys.argv[1] -else: - # run from sandbox subdirectory. - test_filename = "../../tools/test.txt" - -if not os.path.exists(test_filename): - print "Testfile not found:", test_filename - sys.exit() - -print "Using file:", test_filename - -class Output: - def __init__(self,test_dir="test"): - self._file = 0 - self._file_cnt = 0 - self._test_dir = test_dir - self._test_file = "from_test_txt" - def close(self): - if self._file: - self._file.close() - def next_file(self): - self.close() - self._file_cnt += 1 - self._file = open("%s/%s-%02d.txt.new" - %(self._test_dir,self._test_file,self._file_cnt),"w") - def write_line(self,str): - self._file.write(str+"\n") - def get_count(self): - return self._file_cnt - -out = Output() -out.next_file() - -line_before = -1 -section_one = 1 # header plus first section into first file -for line in open(test_filename).readlines(): - line = line.rstrip() # remove end of line - # we split on "------" sections. - if ((len(line)>0)and(line == "-"*(len(line)))and(len(line)==len(line_before))): - if not section_one: - out.next_file() - print section_one,line_before,line - section_one = 0 - if not (type(line_before)==type(-1)): - # special treatment of start block - out.write_line(line_before) - line_before = line - -out.close() diff --git a/sandbox/grubert/style.tex b/sandbox/grubert/style.tex deleted file mode 100644 index 6b7348428..000000000 --- a/sandbox/grubert/style.tex +++ /dev/null @@ -1,30 +0,0 @@ -% donot indent first line. -\setlength{\parindent}{0pt} -\setlength{\parskip}{5pt plus 2pt minus 1pt} - -% sloppy -% ------ -% Less strict (opposite to default fussy) space size between words. Therefore -% less hyphenation. -\sloppy - -% fonts -% ----- -% times for pdf generation, gives smaller pdf files. -% -% But in standard postscript fonts: courier and times/helvetica do not fit. -% Maybe use pslatex. -\usepackage{times} - -% pagestyle -\pagestyle{headings} - -% change maketitle -\renewcommand{\maketitle}{ - \begin{titlepage} - \begin{center} - \textsf{TITLE \@title} \\ - Date: \today - \end{center} - \end{titlepage} -} diff --git a/sandbox/grubert/test/README.txt b/sandbox/grubert/test/README.txt deleted file mode 100644 index 4b8f93664..000000000 --- a/sandbox/grubert/test/README.txt +++ /dev/null @@ -1,332 +0,0 @@ -================== - README: Docutils -================== - -:Author: David Goodger -:Contact: goodger@users.sourceforge.net -:Date: $Date$ -:Web site: http://docutils.sourceforge.net/ -:Copyright: This document has been placed in the public domain. - -.. contents:: - - -Thank you for downloading the Python Docutils project archive. As -this is a work in progress, please check the project website for -updated working files (snapshots). This project should be considered -highly experimental; APIs are subject to change at any time. - - -Quick-Start -=========== - -This is for those who want to get up & running quickly. Read on for -complete details. - -1. Get and install the latest release of Python, available from - - http://www.python.org/ - - Python 2.2 or later [#py21]_ is required; Python 2.2.2 or later is - recommended. - -2. Use the latest Docutils code. Get the code from CVS or from the - snapshot: - - http://docutils.sf.net/docutils-snapshot.tgz - - See `Releases & Snapshots`_ below for details. - -3. Unpack the tarball in a temporary directory (**not** directly in - Python's ``site-packages``) and install with the standard :: - - python setup.py install - - See Installation_ below for details. - -4. Use a front-end tool from the "tools" subdirectory of the same - directory as in step 3. For example:: - - cd tools - html.py test.txt test.html - - See Usage_ below for details. - - -Purpose -======= - -The purpose of the Docutils project is to create a set of tools for -processing plaintext documentation into useful formats, such as HTML, -XML, and TeX. Support for the following sources has been implemented: - -* Standalone files. - -* `PEPs (Python Enhancement Proposals)`_. - -Support for the following sources is planned: - -* Inline documentation from Python modules and packages, extracted - with namespace context. **This is the focus of the current - development effort.** - -* Email (RFC-822 headers, quoted excerpts, signatures, MIME parts). - -* Wikis, with global reference lookups of "wiki links". - -* Compound documents, such as multiple chapter files merged into a - book. - -* And others as discovered. - -.. _PEPs (Python Enhancement Proposals): - http://www.python.org/peps/pep-0012.html - - -Releases & Snapshots -==================== - -Putting together an official "Release" of Docutils is a significant -effort, so it isn't done that often. In the meantime, the CVS -snapshots always contain the latest code and documentation, usually -updated within an hour of changes being committed to the repository, -and usually bug-free: - -* Snapshot of Docutils code, front-end tools, tests, documentation, - and specifications: http://docutils.sf.net/docutils-snapshot.tgz - -* Snapshot of the Sandbox (experimental, contributed code): - http://docutils.sf.net/docutils-sandbox-snapshot.tgz - -* Snapshot of web files (the files that generate the web site): - http://docutils.sf.net/docutils-web-snapshot.tgz - -To keep up to date on the latest developments, download fresh copies -of the snapshots regularly. New functionality is being added weekly, -sometimes daily. (There's also the CVS repository, and a mailing list -for CVS messages. See the web site [address above] or spec/notes.txt -for details.) - - -Requirements -============ - -To run the code, Python 2.2 or later [#py21]_ must already be -installed. The latest release is recommended (2.2.2 as of this -writing). Python is available from http://www.python.org/. - -.. [#py21] Python 2.1 may be used providing the compiler package is - installed. The compiler package can be found in the Tools/ - directory of Python 2.1's source distribution. - - -Project Files & Directories -=========================== - -* README.txt: You're reading it. - -* COPYING.txt: Public Domain Dedication and copyright details for - non-public-domain files (most are PD). - -* FAQ.txt: Docutils Frequently Asked Questions. - -* HISTORY.txt: Release notes for the current and previous project - releases. - -* setup.py: Installation script. See "Installation" below. - -* install.py: Quick & dirty installation script. Just run it. - -* docutils: The project source directory, installed as a Python - package. - -* extras: Directory for third-party modules that Docutils depends on. - These are only installed if they're not already present. - -* docs: The project user documentation directory. Contains the - following documents: - - - docs/tools.txt: Docutils Front-End Tools - - docs/latex.txt: Docutils LaTeX Writer - - docs/rst/quickstart.txt: A ReStructuredText Primer - - docs/rst/quickref.html: Quick reStructuredText (HTML only) - -* licenses: Directory containing copies of license files for - non-public-domain files. - -* spec: The project specification directory. Contains PEPs (Python - Enhancement Proposals), XML DTDs (document type definitions), and - other documents. The ``spec/rst`` directory contains the - reStructuredText specification. The ``spec/howto`` directory - contains How-To documents for developers. - -* tools: Directory for Docutils front-end tools. See docs/tools.txt - for documentation. - -* test: Unit tests. Not required to use the software, but very useful - if you're planning to modify it. See `Running the Test Suite`_ - below. - - -Installation -============ - -The first step is to expand the ``.tar.gz`` or ``.tgz`` archive in a -temporary directory (**not** directly in Python's ``site-packages``). -It contains a distutils setup file "setup.py". OS-specific -installation instructions follow. - - -GNU/Linux, BSDs, Unix, Mac OS X, etc. -------------------------------------- - -1. Open a shell. - -2. Go to the directory created by expanding the archive:: - - cd <archive_directory_path> - -3. Install the package:: - - python setup.py install - - If the python executable isn't on your path, you'll have to specify - the complete path, such as /usr/local/bin/python. You may need - root permissions to complete this step. - -You can also just run install.py; it does the same thing. - - -Windows -------- - -1. Open a DOS box (Command Shell, MSDOS Prompt, or whatever they're - calling it these days). - -2. Go to the directory created by expanding the archive:: - - cd <archive_directory_path> - -3. Install the package:: - - <path_to_python.exe>\python setup.py install - -If your system is set up to run Python when you double-click on .py -files, you can run install.py to do the same as the above. - - -Mac OS 8/9 ----------- - -1. Open the folder containing the expanded archive. - -2. Double-click on the file "setup.py", which should be a "Python - module" file. - - If the file isn't a "Python module", the line endings are probably - also wrong, and you will need to set up your system to recognize - ".py" file extensions as Python files. See - http://gotools.sourceforge.net/mac/python.html for detailed - instructions. Once set up, it's easiest to start over by expanding - the archive again. - -3. The distutils options window will appear. From the "Command" popup - list choose "install", click "Add", then click "OK". - -If install.py is a "Python module" (see step 2 above if it isn't), you -can run it (double-click) instead of the above. The distutils options -window will not appear. - - -Usage -===== - -After unpacking and installing the Docutils package, the following -shell commands will generate HTML for all included documentation:: - - cd <archive_directory_path>/tools - buildhtml.py ../ - -The final directory name of the ``<archive_directory_path>`` is -"docutils" for snapshots. For official releases, the directory may be -called "docutils-X.Y", where "X.Y" is the release version. -Alternatively:: - - cd <archive_directory_path> - tools/buildhtml.py --config=tools/docutils.conf - -Some files may generate system messages (warnings and errors). The -``tools/test.txt`` file (under the archive directory) contains 5 -intentional errors. (They test the error reporting mechanism!) - -There are many front-end tools in the unpacked "tools" subdirectory. -You may want to begin with the "html.py" front-end tool. Most tools -take up to two arguments, the source path and destination path, with -STDIN and STDOUT being the defaults. Use the "--help" option to the -front-end tools for details on options and arguments. See `Docutils -Front-End Tools`_ (``docs/tools.txt``) for full documentation. - -The package modules are continually growing and evolving. The -``docutils.statemachine`` module is usable independently. It contains -extensive inline documentation (in reStructuredText format of course). - -Contributions are welcome! - -.. _Docutils Front-End Tools: docs/tools.html - - -Running the Test Suite -====================== - -To run the entire test suite, after installation_ open a shell and use -the following commands:: - - cd <archive_directory_path>/test - ./alltests.py - -You should see a long line of periods, one for each test, and then a -summary like this:: - - Ran 518 tests in 24.653s - - OK - Elapsed time: 26.189 seconds - -The number of tests will grow over time, and the times reported will -depend on the computer running the tests. The difference between the -two times represents the time required to set up the tests (import -modules, create data structures, etc.). - -If any of the tests fail, please `open a bug report`_ or `send -email`_. Please include all relevant output, information about your -operating system, Python version, and Docutils version. To see the -Docutils version, use these commands:: - - cd ../tools - ./quicktest.py --version - -.. _open a bug report: - http://sourceforge.net/tracker/?group_id=38414&atid=422030 -.. _send email: mailto:docutils-users@lists.sourceforge.net - ?subject=Docutils%20test%20suite%20failure - - -Getting Help -============ - -If you have questions or need assistance with Docutils or -reStructuredText, please `post a message`_ to the `Docutils-Users -mailing list`_. - -.. _post a message: mailto:docutils-users@lists.sourceforge.net -.. _Docutils-Users mailing list: - http://lists.sourceforge.net/lists/listinfo/docutils-users - - -.. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - End: diff --git a/sandbox/grubert/test/characters.txt b/sandbox/grubert/test/characters.txt deleted file mode 100644 index 6094896b2..000000000 --- a/sandbox/grubert/test/characters.txt +++ /dev/null @@ -1,76 +0,0 @@ -Character tests -=============== - -bracketts in lists ------------------- - -LaTeX has some special characters in certain cases, e.g. # is LaTeX's macro -argument chracter. - -Bracketts also have some meaning in macros, but need(ed) no special treatment -up to now. - -1. [Advanced] test from dave. - - - 1. The bracketts don't show up. - They are in TeX file, but they're missing in PDF and DVI. - - Probably because in LaTeX :: - - \begin{itemize} - \item one is plain. - \item [two] two becomes bold. - \end{itemize} - - 2. Numbering [is] also missing for the "Advanced" test case above, not - here in this line. - - 3. Simply escaping the []'s with a backslash in the LaTeX file puts - "Advanced" centered emphasized on a separate line. But the "1." is - displayed then. - - 4. Using LaTeX's enumerate environment instead of docutils's custom - list environment for the list does not work too. - -*Fix* append "{}" to the item command, i.e. :: - - - - \item {} [Advanced] - -double back qoutes field list names ------------------------------------ - -The *double back qoutes* in the follwing example are ignored, i.e. -they are still *double back quotes* in TeX. - -Example - - - :The ``lambda`` Operator: A metafunction which transforms a lambda - expression into a corresponding metafunction class. - -This is not writer but reader specific. - -hash # in section title ------------------------ - -with pdflatex. - -fontencodings -------------- - -In T1 literal text double hyphens and angle bracketts need help -to remain two characters:: - - << -- >> - -non literal "<< -- >>". - - - - - - - diff --git a/sandbox/grubert/test/docinfo-2.txt b/sandbox/grubert/test/docinfo-2.txt deleted file mode 100644 index 2509b6bf2..000000000 --- a/sandbox/grubert/test/docinfo-2.txt +++ /dev/null @@ -1,24 +0,0 @@ -================== - README: Docutils -================== - -:Authors: David, Laurel, Hardy -:Contact: goodger@users.sourceforge.net -:Date: $Date$ -:Web site: http://docutils.sourceforge.net/ -:Copyright: This document has been placed in the public domain. - -.. contents:: - - -Thank you for downloading the Python Docutils project archive. As -this is a work in progress, please check the project website for -updated working files (snapshots). This project should be considered -highly experimental; APIs are subject to change at any time. - - -Quick-Start -=========== - -This is for tests with docinfo and latex header settings. - diff --git a/sandbox/grubert/test/docinfo.txt b/sandbox/grubert/test/docinfo.txt deleted file mode 100644 index 2d1fc2b53..000000000 --- a/sandbox/grubert/test/docinfo.txt +++ /dev/null @@ -1,24 +0,0 @@ -================== - README: Docutils -================== - -:Author: David Goodger -:Contact: goodger@users.sourceforge.net -:Date: $Date$ -:Web site: http://docutils.sourceforge.net/ -:Copyright: This document has been placed in the public domain. - -.. contents:: - - -Thank you for downloading the Python Docutils project archive. As -this is a work in progress, please check the project website for -updated working files (snapshots). This project should be considered -highly experimental; APIs are subject to change at any time. - - -Quick-Start -=========== - -This is for tests with docinfo and latex header settings. - diff --git a/sandbox/grubert/test/footnotes.txt b/sandbox/grubert/test/footnotes.txt deleted file mode 100644 index f25bc7824..000000000 --- a/sandbox/grubert/test/footnotes.txt +++ /dev/null @@ -1,69 +0,0 @@ -Footnote testing -================ - - -Paragraphs contain text and may contain inline markup: *emphasis*, -**strong emphasis**, -footnote references (manually numbered [1]_, -anonymous auto-numbered [#]_, labeled auto-numbered [#label]_, or -symbolic [*]_), citation references ([CIT2002]_), and ... - -Footnotes ---------- - -.. [1] A footnote contains body elements, consistently indented by at - least 3 spaces. - - This is the footnote's second paragraph. - -.. [#label] Footnotes may be numbered, either manually (as in [1]_) or - automatically using a "#"-prefixed label. This footnote has a - label so it can be referred to from multiple places, both as a - footnote reference ([#label]_) and as a hyperlink reference - (label_). - -.. [#] This footnote is numbered automatically and anonymously using a - label of "#" only. - -.. [*] Footnotes may also use symbols, specified with a "*" label. - Here's a reference to the next footnote: [*]_. - -.. [*] This footnote shows the next symbol in the sequence. - -.. [4] Here's a footnote, with a reference to a footnote: [5]_. - - - -Citations ---------- - -.. [CIT2002] Citations are text-labeled footnotes. They may be - rendered separately and differently from footnotes. - -Here's a reference to the above, [CIT2002]_ citation. - - -.. [5] We need a lot to trigger the "too many floats". - - -Footnote with bullet list -------------------------- - -.. [#value_initialized] The concept of value-initialization was - added to the C++ standard in the first "Technical Corrigendum". - - To value-initialize an object of type T means: - - - if T is a class type (clause 9) with a user-declared constructor - (12.1), then the default constructor for T is - called (and the initialization is ill-formed if T has no - accessible default constructor); - - - if T is a non-union class type without a user-declared - constructor, then every non-static data member - and base-class component of T is value-initialized; - - - if T is an array type, then each element is value-initialized; - - - otherwise, the object is zero-initialized - diff --git a/sandbox/grubert/test/from_test_txt-01.txt b/sandbox/grubert/test/from_test_txt-01.txt deleted file mode 100644 index ff9599d60..000000000 --- a/sandbox/grubert/test/from_test_txt-01.txt +++ /dev/null @@ -1,66 +0,0 @@ -.. This is a comment. Note how any initial comments are moved by - transforms to after the document title, subtitle, and docinfo. - -================================ - reStructuredText Test Document -================================ - -.. Above is the document title, and below is the subtitle. - They are transformed from section titles after parsing. - --------------------------------- - Examples of Syntax Constructs --------------------------------- - -.. bibliographic fields (which also require a transform): - -:Author: David Goodger -:Address: 123 Example Street - Example, EX Canada - A1B 2C3 -:Contact: goodger@users.sourceforge.net -:Authors: Me; Myself; I -:organization: humankind -:date: $Date$ -:status: This is a "work in progress" -:revision: $Revision$ -:version: 1 -:copyright: This document has been placed in the public domain. You - may do with it as you wish. You may copy, modify, - redistribute, reattribute, sell, buy, rent, lease, - destroy, or improve it, quote it at length, excerpt, - incorporate, collate, fold, staple, or mutilate it, or do - anything else to it that your or anyone else's heart - desires. -:field name: This is a generic bibliographic field. -:field name 2: - Generic bibliographic fields may contain multiple body elements. - - Like this. - -:Dedication: - - For Docutils users & co-developers. - -:abstract: - - This is a test document, containing at least one example of each - reStructuredText construct. - -.. meta:: - :keywords: reStructuredText, test, parser - :description lang=en: A test document, containing at least one - example of each reStructuredText construct. - -.. contents:: Table of Contents -.. section-numbering:: - - -Structural Elements -=================== - -Section Title -------------- - -That's it, the text just above this line. - diff --git a/sandbox/grubert/test/from_test_txt-02.txt b/sandbox/grubert/test/from_test_txt-02.txt deleted file mode 100644 index dcb1bccf6..000000000 --- a/sandbox/grubert/test/from_test_txt-02.txt +++ /dev/null @@ -1,12 +0,0 @@ -Transitions ------------ - -Here's a transition: - ---------- - -It divides the section. - -Body Elements -============= - diff --git a/sandbox/grubert/test/from_test_txt-03.txt b/sandbox/grubert/test/from_test_txt-03.txt deleted file mode 100644 index 4b3ee3c85..000000000 --- a/sandbox/grubert/test/from_test_txt-03.txt +++ /dev/null @@ -1,40 +0,0 @@ -Paragraphs ----------- - -A paragraph. - -Inline Markup -````````````` - -Paragraphs contain text and may contain inline markup: *emphasis*, -**strong emphasis**, ``inline literals``, standalone hyperlinks -(http://www.python.org), external hyperlinks (Python_), internal -cross-references (example_), external hyperlinks with embedded URIs -(`Python web site <http://www.python.org>`__), footnote references -(manually numbered [1]_, anonymous auto-numbered [#]_, labeled -auto-numbered [#label]_, or symbolic [*]_), citation references -([CIT2002]_), substitution references (|example|), and _`inline -hyperlink targets` (see Targets_ below for a reference back to here). -Character-level inline markup is also possible (although exceedingly -ugly!) in *re*\ ``Structured``\ *Text*. Problems are indicated by -|problematic| text (generated by processing errors; this one is -intentional). - -The default role for interpreted text is `Title Reference`. Here are -some explicit interpreted text roles: a PEP reference (:PEP:`287`); an -RFC reference (:RFC:`2822`); a :sub:`subscript`; a :sup:`superscript`; -and explicit roles for :emphasis:`standard` :strong:`inline` -:literal:`markup`. - -.. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! - -Let's test wrapping and whitespace significance in inline literals: -``This is an example of --inline-literal --text, --including some-- -strangely--hyphenated-words. Adjust-the-width-of-your-browser-window -to see how the text is wrapped. -- ---- -------- Now note the -spacing between the words of this sentence (words -should be grouped in pairs).`` - -If the ``--pep-references`` option was supplied, there should be a -live link to PEP 258 here. - diff --git a/sandbox/grubert/test/from_test_txt-04.txt b/sandbox/grubert/test/from_test_txt-04.txt deleted file mode 100644 index 0914ee8cb..000000000 --- a/sandbox/grubert/test/from_test_txt-04.txt +++ /dev/null @@ -1,20 +0,0 @@ -Bullet Lists ------------- - -- A bullet list - - + Nested bullet list. - + Nested item 2. - -- Item 2. - - Paragraph 2 of item 2. - - * Nested bullet list. - * Nested item 2. - - - Third level. - - Item 2. - - * Nested item 3. - diff --git a/sandbox/grubert/test/from_test_txt-05.txt b/sandbox/grubert/test/from_test_txt-05.txt deleted file mode 100644 index adefeb187..000000000 --- a/sandbox/grubert/test/from_test_txt-05.txt +++ /dev/null @@ -1,27 +0,0 @@ -Enumerated Lists ----------------- - -1. Arabic numerals. - - a) lower alpha) - - (i) (lower roman) - - A. upper alpha. - - I) upper roman) - -2. Lists that don't start at 1: - - 3. Three - - 4. Four - - C. C - - D. D - - iii. iii - - iv. iv - diff --git a/sandbox/grubert/test/from_test_txt-06.txt b/sandbox/grubert/test/from_test_txt-06.txt deleted file mode 100644 index d36a5b6a2..000000000 --- a/sandbox/grubert/test/from_test_txt-06.txt +++ /dev/null @@ -1,12 +0,0 @@ -Definition Lists ----------------- - -Term - Definition -Term : classifier - Definition paragraph 1. - - Definition paragraph 2. -Term - Definition - diff --git a/sandbox/grubert/test/from_test_txt-07.txt b/sandbox/grubert/test/from_test_txt-07.txt deleted file mode 100644 index 7ac6deb36..000000000 --- a/sandbox/grubert/test/from_test_txt-07.txt +++ /dev/null @@ -1,14 +0,0 @@ -Field Lists ------------ - -:what: Field lists map field names to field bodies, like database - records. They are often part of an extension syntax. They are - an unambiguous variant of RFC 2822 fields. - -:how arg1 arg2: - - The field marker is a colon, the field name, and a colon. - - The field body may contain one or more body elements, indented - relative to the field marker. - diff --git a/sandbox/grubert/test/from_test_txt-08.txt b/sandbox/grubert/test/from_test_txt-08.txt deleted file mode 100644 index 130d4307e..000000000 --- a/sandbox/grubert/test/from_test_txt-08.txt +++ /dev/null @@ -1,27 +0,0 @@ -Option Lists ------------- - -For listing command-line options: - --a command-line option "a" --b file options can have arguments - and long descriptions ---long options can be long also ---input=file long options can also have - arguments - ---very-long-option - The description can also start on the next line. - - The description may contain multiple body elements, - regardless of where it starts. - --x, -y, -z Multiple options are an "option group". --v, --verbose Commonly-seen: short & long options. --1 file, --one=file, --two file - Multiple options with arguments. -/V DOS/VMS-style options too - -There must be at least two spaces between the option and the -description. - diff --git a/sandbox/grubert/test/from_test_txt-09.txt b/sandbox/grubert/test/from_test_txt-09.txt deleted file mode 100644 index 4921e3a87..000000000 --- a/sandbox/grubert/test/from_test_txt-09.txt +++ /dev/null @@ -1,17 +0,0 @@ -Literal Blocks --------------- - -Literal blocks are indicated with a double-colon ("::") at the end of -the preceding paragraph (over there ``-->``). They can be indented:: - - if literal_block: - text = 'is left as-is' - spaces_and_linebreaks = 'are preserved' - markup_processing = None - -Or they can be quoted without indentation:: - ->> Great idea! -> -> Why didn't I think of that? - diff --git a/sandbox/grubert/test/from_test_txt-10.txt b/sandbox/grubert/test/from_test_txt-10.txt deleted file mode 100644 index ff08006e3..000000000 --- a/sandbox/grubert/test/from_test_txt-10.txt +++ /dev/null @@ -1,13 +0,0 @@ -Block Quotes ------------- - -Block quotes consist of indented body elements: - - My theory by A. Elk. Brackets Miss, brackets. This theory goes - as follows and begins now. All brontosauruses are thin at one - end, much much thicker in the middle and then thin again at the - far end. That is my theory, it is mine, and belongs to me and I - own it, and what it is too. - - -- Anne Elk (Miss) - diff --git a/sandbox/grubert/test/from_test_txt-11.txt b/sandbox/grubert/test/from_test_txt-11.txt deleted file mode 100644 index 8069fb9a2..000000000 --- a/sandbox/grubert/test/from_test_txt-11.txt +++ /dev/null @@ -1,8 +0,0 @@ -Doctest Blocks --------------- - ->>> print 'Python-specific usage examples; begun with ">>>"' -Python-specific usage examples; begun with ">>>" ->>> print '(cut and pasted from interactive Python sessions)' -(cut and pasted from interactive Python sessions) - diff --git a/sandbox/grubert/test/from_test_txt-12.txt b/sandbox/grubert/test/from_test_txt-12.txt deleted file mode 100644 index dca95c50a..000000000 --- a/sandbox/grubert/test/from_test_txt-12.txt +++ /dev/null @@ -1,32 +0,0 @@ -Tables ------- - -Here's a grid table followed by a simple table: - -+------------------------+------------+----------+----------+ -| Header row, column 1 | Header 2 | Header 3 | Header 4 | -| (header rows optional) | | | | -+========================+============+==========+==========+ -| body row 1, column 1 | column 2 | column 3 | column 4 | -+------------------------+------------+----------+----------+ -| body row 2 | Cells may span columns. | -+------------------------+------------+---------------------+ -| body row 3 | Cells may | - Table cells | -+------------------------+ span rows. | - contain | -| body row 4 | | - body elements. | -+------------------------+------------+----------+----------+ -| body row 5 | Cells may also be | | -| | empty: ``-->`` | | -+------------------------+-----------------------+----------+ - -===== ===== ====== - Inputs Output ------------- ------ - A B A or B -===== ===== ====== -False False False -True False True -False True True -True True True -===== ===== ====== - diff --git a/sandbox/grubert/test/from_test_txt-13.txt b/sandbox/grubert/test/from_test_txt-13.txt deleted file mode 100644 index e9b5f8b8d..000000000 --- a/sandbox/grubert/test/from_test_txt-13.txt +++ /dev/null @@ -1,25 +0,0 @@ -Footnotes ---------- - -.. [1] A footnote contains body elements, consistently indented by at - least 3 spaces. - - This is the footnote's second paragraph. - -.. [#label] Footnotes may be numbered, either manually (as in [1]_) or - automatically using a "#"-prefixed label. This footnote has a - label so it can be referred to from multiple places, both as a - footnore reference ([#label]_) and as a hyperlink reference - (label_). - -.. [#] This footnote is numbered automatically and anonymously using a - label of "#" only. - -.. [*] Footnotes may also use symbols, specified with a "*" label. - Here's a reference to the next footnote: [*]_. - -.. [*] This footnote shows the next symbol in the sequence. - -.. [4] Here's an unreferenced footnote, with a reference to a - nonexistent footnote: [5]_. - diff --git a/sandbox/grubert/test/from_test_txt-14.txt b/sandbox/grubert/test/from_test_txt-14.txt deleted file mode 100644 index 214f12b9a..000000000 --- a/sandbox/grubert/test/from_test_txt-14.txt +++ /dev/null @@ -1,9 +0,0 @@ -Citations ---------- - -.. [CIT2002] Citations are text-labeled footnotes. They may be - rendered separately and differently from footnotes. - -Here's a reference to the above, [CIT2002]_, and a [nonexistent]_ -citation. - diff --git a/sandbox/grubert/test/from_test_txt-15.txt b/sandbox/grubert/test/from_test_txt-15.txt deleted file mode 100644 index b4dcfb1cc..000000000 --- a/sandbox/grubert/test/from_test_txt-15.txt +++ /dev/null @@ -1,39 +0,0 @@ -Targets -------- - -.. _example: - -This paragraph is pointed to by the explicit "example" target. A -reference can be found under `Inline Markup`_, above. `Inline -hyperlink targets`_ are also possible. - -Section headers are implicit targets, referred to by name. See -Targets_, which is a subsection of `Body Elements`_. - -Explicit external targets are interpolated into references such as -"Python_". - -.. _Python: http://www.python.org/ - -Targets may be indirect and anonymous. Thus `this phrase`__ may also -refer to the Targets_ section. - -__ Targets_ - -Here's a `hyperlink reference without a target`_, which generates an -error. - -Duplicate Target Names -`````````````````````` - -Duplicate names in section headers or other implicit targets will -generate "info" (level-1) system messages. Duplicate names in -explicit targets will generate "warning" (level-2) system messages. - -Duplicate Target Names -`````````````````````` - -Since there are two "Duplicate Target Names" section headers, we -cannot uniquely refer to either of them by name. If we try to (like -this: `Duplicate Target Names`_), an error is generated. - diff --git a/sandbox/grubert/test/from_test_txt-16.txt b/sandbox/grubert/test/from_test_txt-16.txt deleted file mode 100644 index 634e1e0fd..000000000 --- a/sandbox/grubert/test/from_test_txt-16.txt +++ /dev/null @@ -1,124 +0,0 @@ -Directives ----------- - -.. contents:: :local: - -These are just a sample of the many reStructuredText Directives. For -others, please see http://docutils.sf.net/spec/rst/directives.html. - -Document Parts -`````````````` - -An example of the "contents" directive can be seen above this section -(a local, untitled table of contents_) and at the beginning of the -document (a document-wide `table of contents`_). - -Images -`````` - -An image directive: - -.. image:: images/title.png - -A figure directive: - -.. figure:: images/title.png - :alt: reStructuredText, the markup syntax - - A figure is an image with a caption and/or a legend: - - +------------+-----------------------------------------------+ - | re | Revised, revisited, based on 're' module. | - +------------+-----------------------------------------------+ - | Structured | Structure-enhanced text, structuredtext. | - +------------+-----------------------------------------------+ - | Text | Well it is, isn't it? | - +------------+-----------------------------------------------+ - - This paragraph is also part of the legend. - -Admonitions -``````````` - -.. Attention:: Directives at large. - -.. Caution:: - - Don't take any wooden nickels. - -.. DANGER:: Mad scientist at work! - -.. Error:: Does not compute. - -.. Hint:: It's bigger than a bread box. - -.. Important:: - - Wash behind your ears. - - Clean up your room. - - Call your mother. - - Back up your data. - -.. Note:: This is a note. - -.. Tip:: 15% if the service is good. - -.. WARNING:: Strong prose may provoke extreme mental exertion. - Reader discretion is strongly advised. - -.. admonition:: And, by the way... - - You can make up your own admonition too. - -Topics, Sidebars, and Rubrics -````````````````````````````` - -.. sidebar:: Sidebar Title - :subtitle: Optional Subtitle - - This is a sidebar. It is for text outside the flow of the main - text. - - .. rubric:: This is a rubric inside a sidebar - - Sidebars often appears beside the main text with a border and - background color. - -.. topic:: Topic Title - - This is a topic. - -.. rubric:: This is a rubric - -Target Footnotes -```````````````` - -.. target-notes:: - -Line Blocks -``````````` - -Take it away, Eric the Orchestra Leader! - -.. line-block:: - - A one, two, a one two three four - - Half a bee, philosophically, - must, *ipso facto*, half not be. - But half the bee has got to be, - *vis a vis* its entity. D'you see? - - But can a bee be said to be - or not to be an entire bee, - when half the bee is not a bee, - due to some ancient injury? - - Singing... - -Replacement Text -```````````````` - -I recommend you try |Python|_. - -.. |Python| replace:: Python, *the* best language around - diff --git a/sandbox/grubert/test/from_test_txt-17.txt b/sandbox/grubert/test/from_test_txt-17.txt deleted file mode 100644 index f63901a43..000000000 --- a/sandbox/grubert/test/from_test_txt-17.txt +++ /dev/null @@ -1,9 +0,0 @@ -Substitution Definitions ------------------------- - -An inline image (|example|) example: - -.. |EXAMPLE| image:: ../docs/rst/images/biohazard.png - -(Substitution definitions are not visible in the HTML source.) - diff --git a/sandbox/grubert/test/from_test_txt-18.txt b/sandbox/grubert/test/from_test_txt-18.txt deleted file mode 100644 index 974f91cb6..000000000 --- a/sandbox/grubert/test/from_test_txt-18.txt +++ /dev/null @@ -1,21 +0,0 @@ -Comments --------- - -Here's one: - -.. Comments begin with two dots and a space. Anything may - follow, except for the syntax of footnotes, hyperlink - targets, directives, or substitution definitions. - - Double-dashes -- "--" -- must be escaped somehow in HTML output. - -(View the HTML source to see the comment.) - -Error Handling -============== - -Any errors caught during processing will generate system messages. - -There should be five messages in the following, auto-generated -section, "Docutils System Messages": - diff --git a/sandbox/grubert/test/from_test_txt-19.txt b/sandbox/grubert/test/from_test_txt-19.txt deleted file mode 100644 index 974f91cb6..000000000 --- a/sandbox/grubert/test/from_test_txt-19.txt +++ /dev/null @@ -1,21 +0,0 @@ -Comments --------- - -Here's one: - -.. Comments begin with two dots and a space. Anything may - follow, except for the syntax of footnotes, hyperlink - targets, directives, or substitution definitions. - - Double-dashes -- "--" -- must be escaped somehow in HTML output. - -(View the HTML source to see the comment.) - -Error Handling -============== - -Any errors caught during processing will generate system messages. - -There should be five messages in the following, auto-generated -section, "Docutils System Messages": - diff --git a/sandbox/grubert/test/images.txt b/sandbox/grubert/test/images.txt deleted file mode 100644 index 050d46042..000000000 --- a/sandbox/grubert/test/images.txt +++ /dev/null @@ -1,25 +0,0 @@ -Testing image attributes ------------------------- - -the unscaled image - -.. image:: biohazard.png - -scaled 200 - -.. image:: biohazard.png - :scale: 200 - -center and scale - -.. image:: biohazard.png - :scale: 200 - :align: center - - -an image with a web target - -.. image:: debian.png - :target: http://www.debian.org - - diff --git a/sandbox/grubert/test/internal_href.txt b/sandbox/grubert/test/internal_href.txt deleted file mode 100644 index edb6793a7..000000000 --- a/sandbox/grubert/test/internal_href.txt +++ /dev/null @@ -1,14 +0,0 @@ -see below__ for a bang. - -__ `xxx`_ - -.. parsed-literal:: - - see below__ for a bang from literal. - -__ `xxx`_ - -.. _xxx: - -Bang! - diff --git a/sandbox/grubert/test/links.txt b/sandbox/grubert/test/links.txt deleted file mode 100644 index 5db35c7b1..000000000 --- a/sandbox/grubert/test/links.txt +++ /dev/null @@ -1,14 +0,0 @@ -Link formatting ---------------- - -especially the hash "#" character is problematic for LaTeX as it is -used in LaTeX's macro language. - -Contributed by d.abrahams - -.. Sidebar:: ``const`` and an iterator's ``value_type`` - - argument will be correct for all `lvalue iterators`_. - -.. _`lvalue iterators`: new-iter-concepts.html#lvalue-iterators-lib-lvalue-iterators - diff --git a/sandbox/grubert/test/literal.txt b/sandbox/grubert/test/literal.txt deleted file mode 100644 index 2d771ac82..000000000 --- a/sandbox/grubert/test/literal.txt +++ /dev/null @@ -1,91 +0,0 @@ -Literal Blocks --------------- - -Literal blocks are indented, and indicated with a double-colon ("::") -at the end of the preceding paragraph (right here ``-->``):: - - if literal_block: - text = 'is left as-is' - spaces_and_linebreaks = 'are preserved' - markup_processing = None - -Or some code formatting :: - - typedef - - mpl::push_back< // >----------------+ - // | - mpl::push_back< // >--------------+ | - // | | - mpl::push_back< // >------------+ | | - mpl::vector<> // | | | - , int // | | | - >::type // first step <-+ | | - , long // | | - >::type // second step <--+ | - , double // | - >::type // third step <-----+ - - vec; - -The central makefile construct is called a *rule*, and is described -with the following syntax: - -.. parsed-literal:: - - *dependent-target* : *prerequisites* - *commands* - - -parsed literal with markup spanning lines. should produce valid LaTeX -code, but the indentation is ragged. - -.. parsed-literal:: - - Hey! - *this is some emphasized text - that spans two lines* and - this is **some more bold text - spanning two lines** - - - -a literal block with underscores and markup - -.. parsed-literal:: - - mpl::push_back< // >----------------+ - // | - mpl::push_back< // >--------------+ | - // <- *end* ------+-+ - - -inline ``literal`` with double hyphen ``two hyphens: --`` and tripplets -``three hyphens: ---``. - -Special characters ------------------- - -lele needed a patch to process the italian ZopeBook, because -of the tilde ~ and the backquote chars. - -1. scaricarlo anche usando un browser web:: - - lele:~/zope $ wget http://zope.org/Products/Zope/2.7.0/Zope-2.7.0-linux-x86.tgz - --00:49:51-- http://zope.org/Products/Zope/2.7.0/Zope-2.7.0-linux-x86.tgz - => `Zope-2.7.0-linux-x86.tgz' - - -this works as long as the document is not italian. - -bracketts at line start and empty lines - -.. parsed-literal:: - - with - [ - _Container=std::map<std::string,std::string>, - _InIt=std::list<std::string>::iterator - ] - *messages continue...* - diff --git a/sandbox/grubert/test/no-citations.txt b/sandbox/grubert/test/no-citations.txt deleted file mode 100644 index 6e73b5c84..000000000 --- a/sandbox/grubert/test/no-citations.txt +++ /dev/null @@ -1,9 +0,0 @@ -LaTeX writer test no citations ------------------------------- - -This file is used to verify that no bibliography is inserted -when ``use-latex-citations`` is specified if there are no -citations [1]_ in the document. - -.. [1] footnotes are allowed. - diff --git a/sandbox/grubert/test/tables-multirow.txt b/sandbox/grubert/test/tables-multirow.txt deleted file mode 100644 index 40ad6906d..000000000 --- a/sandbox/grubert/test/tables-multirow.txt +++ /dev/null @@ -1,60 +0,0 @@ -Multirows dont work. - -Attention ---------- - -* cell spanning in multirow table is missing ! -* blank lines in multirows are not alloed - -.. table:: row on left side - - +------+-------+ - | left | right | - | span +-------+ - | | single| - +------+-------+ - | belo | b too | - +------+-------+ - -.. table:: row on right side - - +------+------+ - | abov | e | - +------+------+ - | left | right| - +------+ right| - | left | right| - +------+------+ - -.. table:: row in the midle - - +------+------+------+ - | left | mid | right| - +------+ mid +------+ - | left | mid | right| - +------+------+------+ - -.. table:: row left and right - - +------+------+-------+ - | left | mid | right | - | left +------+ 2 | - | | mid | right | - +------+------+-------+ - -.. table:: row on left side - - +------+---+-------+ - | left | 1 | right | - | span | +-------+ - | | | secnd | - | +---+-------+ - | | | 3rd | - | | +-------+ - | | | single| - +------+---+-------+ - | belo | 3 | b too | - +------+---+-------+ - - - diff --git a/sandbox/grubert/test/tables.txt b/sandbox/grubert/test/tables.txt deleted file mode 100644 index c6e2b5ab2..000000000 --- a/sandbox/grubert/test/tables.txt +++ /dev/null @@ -1,159 +0,0 @@ -Tables ------- - -Here's a grid table followed by a simple table: - -+------------------------+------------+----------+----------+ -| Header row, column 1 | Header 2 | Header 3 | Header 4 | -| (header rows optional) | | | | -+========================+============+==========+==========+ -| body row 1, column 1 | column 2 | column 3 | column 4 | -+------------------------+------------+----------+----------+ -| body row 2 | Cells may span columns. | -+------------------------+------------+----------+----------+ -| body row 5 | Cells may also be | | -| | empty: ``-->`` | | -+------------------------+-----------------------+----------+ - -===== ===== ====== - Inputs Output ------------- ------ - A B A or B -===== ===== ====== -False False False -True False True -False True True -True True True -===== ===== ====== - -a table without head - -.. table:: Foo - - +-----+-----+ - | | | - +-----+-----+ - | | | - +-----+-----+ - -a narrow table - -=== === -CL1 CL2 -=== === -ys asd ---- --- -sda ase -=== === - -poses problems - -=== === - A B -=== === - 0 0 - 1 0 -=== === - -=== === === - A B -=== === === - 0 0 0 - 1 0 1 -=== === === - - -============================ ==================================== =========================================== - a wide table poses other problems . -============================ ==================================== =========================================== - as reST assumes the the LaTeX writer assumes if the actual table is wider - the documents being line length being 80 chars - readable before it must be scaled down - processing ----------------------------- ------------------------------------ ------------------------------------------- - narrow ones need a little amplification as TeX's proportional fonts seem to need more - horizontal space. -============================ ==================================== =========================================== - -+--------------------------+----------------------------+ -|:: |:: | -| | | -| mpl::plus<_,_> | mpl::plus<_1,_2> | -+--------------------------+----------------------------+ -|:: |:: | -| | | -| boost::is_same< | boost::is_same< | -| _ | _1 | -| , add_pointer<_> | , add_pointer<_1> | -| > | > | -+--------------------------+----------------------------+ - -a longer and complicated table thanks to dave abrahams - -+--------------------------+----------------------------+-------------------------+ -|Metafunction |Result `` ::type`` |Complexity | -+==========================+============================+=========================+ -|``find<seq, T>`` |An iterator to the first |Linear | -| |occurrence of ``T`` in | | -| |``seq``, or | | -| |``end<seq>::type`` if not | | -| |found. | | -+--------------------------+----------------------------+-------------------------+ -|``find_if<seq, T, pred>`` |An iterator to the first |Linear | -| |element of ``seq`` that | | -| |satisfies predicate | | -| |``pred``, or | | -| |``end<seq>::type`` if not | | -| |found. | | -+--------------------------+----------------------------+-------------------------+ -|``contains<seq, T>`` |True iff ``seq`` contains |Linear | -| |``T``. | | -+--------------------------+----------------------------+-------------------------+ -|``count<seq, T>`` |The number of occurences of |Linear | -| |``T`` in ``seq``. | | -+--------------------------+----------------------------+-------------------------+ -|``count_if<seq, pred>`` |The number of elements in |Linear | -| |``seq`` that satisfy | | -| |predicate ``pred``. | | -+--------------------------+----------------------------+-------------------------+ -|``equal<seq1, seq2>`` |True iff ``seq1`` and |Linear | -| |``seq2`` contain the same | | -| |elements in the same order. | | -+--------------------------+----------------------------+-------------------------+ -|:: |The earliest |Logarithmic in | -| |order-preserving position at|invocations to | -| lower_bound< |which ``T`` could be |``compare``. Logarithmic | -| seq, T |inserted in a sequence |traversal of | -| , compare = less<_,_> |``seq`` sorted according to |random-access | -| > |comparison ``compare``. |sequences. Linear | -| | |traversal otherwise. | -+--------------------------+----------------------------+-------------------------+ -|:: |The latest order-preserving |Logarithmic in | -| |position at which ``T`` |invocations to | -| upper_bound< |could be inserted in a |``compare``. Logarithmic | -| seq, T |sequence ``seq`` sorted |traversal of | -| , compare = less<_,_> |according to comparison |random-access | -| > |``compare``. |sequences. Linear | -| | |traversal otherwise. | -+--------------------------+----------------------------+-------------------------+ -|:: |The first position ``i`` in |Linear | -| |``seq`` such that for all | | -| max_element< |positions ``j``:: | | -| seq | | | -| , compare = less<_,_> | apply< | | -| > | compare | | -| | , deref<i>::type | | -| | , deref<j>::type | | -| | >::type::value == false | | -+--------------------------+----------------------------+-------------------------+ -|:: |The first position ``i`` in |Linear | -| |``seq`` such that for all | | -| min_element< |positions ``j``:: | | -| seq | | | -| , compare = less<_,_> | apply< | | -| > | compare | | -| | , deref<j>::type | | -| | , deref<i>::type | | -| | >::type::value == false | | -+--------------------------+----------------------------+-------------------------+ - diff --git a/sandbox/grubert/test/toc.txt b/sandbox/grubert/test/toc.txt deleted file mode 100644 index e479de52a..000000000 --- a/sandbox/grubert/test/toc.txt +++ /dev/null @@ -1,24 +0,0 @@ -=================== - table of contents -=================== - -.. contents:: - -Quick-Start -=========== - -Test latex table of contents usage. - -Sub section ------------ - -Needs some content - -A section -========= - -Subsection again ----------------- - -This should do it. - diff --git a/sandbox/grubert/tools/pdf.py b/sandbox/grubert/tools/pdf.py deleted file mode 100755 index de89e44d5..000000000 --- a/sandbox/grubert/tools/pdf.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -""" -:Author: Engelbert Gruber -:Contact: grubert@users.sourceforge.net -:Revision: $Revision$ -:Date: $Date$ -:Copyright: This module has been placed in the public domain. - -A minimal front-end to the Docutils Publisher, producing PDF via ReportLabs. -""" - -from docutils.core import publish_cmdline -try: - from docutils.writers.rlpdf import Writer -except ImportError: - from rlpdf import Writer - - -usage = 'usage:\n %prog [options] [source [destination]]' - -publish_cmdline(writer=Writer(), usage=usage) |