Commit 5e4ad732 authored by Dmitry Shachnev's avatar Dmitry Shachnev 🐧

Convert from git-dpm to patches unapplied format.

parent 958e6d40
......@@ -11,19 +11,8 @@
.. contents::
Quick-Start on Debian systems
=============================
The reStructuredText tools are installed in the normal system path by the
Debian ``python-docutils`` package. To convert reStructuredText to another
format, use a shell command like::
rst2html /usr/share/doc/python-docutils/FAQ.txt ./FAQ.html
See Usage_ below for details.
Quick-Start on other systems
============================
Quick-Start
===========
This is for those who want to get up & running quickly.
......@@ -294,12 +283,6 @@ 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/user/tools.txt``) for full documentation.
On a Debian system the included tools (with the exception of quicktest.py
and the development tools in the dev/ directory) are installed into the
normal system path, so you can run ``rst2html.py`` with a command like::
rst2html example.txt example.html
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).
......
# see git-dpm(1) from git-dpm package
a2af4ee3e032e26da1e478a4e807213ff15a48ed
a2af4ee3e032e26da1e478a4e807213ff15a48ed
1ec3fef1ee31a7ccdb2f806ac1857c32227eef8f
1ec3fef1ee31a7ccdb2f806ac1857c32227eef8f
python-docutils_0.13.1+dfsg.orig.tar.gz
83cb392ab8679602851d329cb9e77a7970854cc8
1739290
debianTag="debian/%e%v"
patchedTag="patched/%e%v"
upstreamTag="upstream/%e%u"
[DEFAULT]
debian-branch=debian/master
......@@ -39,10 +39,6 @@ one argument (source) is specified, the standard output (stdout) is
used for the destination. If no arguments are specified, the standard
input (stdin) is used for the source.
In Debian these tools are installed in the normal system path, without the
``.py`` extension, according to Debian policy.
buildhtml.py_ is installed as rst-buildhtml.
Getting Help
============
......@@ -70,15 +66,13 @@ buildhtml.py
:Parser: reStructuredText
:Writers: html_, pep_html_
In Debian this tool is installed under the name rst-buildhtml.
Use ``buildhtml.py`` to generate ``*.html`` from all the ``*.txt`` files
(including PEPs) in each <directory> given, and their subdirectories
too. (Use the ``--local`` option to skip subdirectories.)
Usage::
rst-buildhtml [options] [<directory> ...]
buildhtml.py [options] [<directory> ...]
After unpacking the Docutils package, the following shell commands
will generate HTML for all included documentation::
......@@ -109,8 +103,6 @@ rst2html.py
:Parser: reStructuredText
:Writer: html_
In Debian this front end is installed as rst2html.
`rst2html.py` is the front-end for the default Docutils HTML writer.
The default writer may change with the development of HTML, browsers,
Docutils, and the web. Currently, it is html4css1_.
......@@ -129,8 +121,6 @@ rst2html4.py
:Parser: reStructuredText
:Writer: html4css1_
In Debian this front end is installed as rst2html4.
The ``rst2html.py`` front end reads standalone reStructuredText source
files and produces `XHTML 1.0 Transitional`_ output.
A CSS stylesheet is required for proper rendering; a simple but
......@@ -140,13 +130,13 @@ below).
For example, to process a reStructuredText file "``test.txt``" into
HTML::
rst2html test.txt test.html
rst2html.py test.txt test.html
Now open the "``test.html``" file in your favorite browser to see the
results. To get a footer with a link to the source file, date & time
of processing, and links to the Docutils project, add some options::
rst2html -stg test.txt test.html
rst2html.py -stg test.txt test.html
Stylesheets
......@@ -176,8 +166,6 @@ rst2html5.py
:Parser: reStructuredText
:Writer: html5 (html5_polyglot_)
In Debian this front end is installed as rst2html5.
The ``rst2html5.py`` front end reads standalone reStructuredText source
files and produces `HTML 5`_ output.
Correct rendering of elements not directly supported by HTML depends on a
......@@ -193,8 +181,6 @@ rstpep2html.py
:Parser: reStructuredText
:Writer: pep_html_
In Debian this front end is installed as rstpep2html.
``rstpep2html.py`` reads a new-style PEP (marked up with reStructuredText)
and produces `XHTML 1.0 Transitional`_. It requires a template file and a
stylesheet. By default, it makes use of a "``pep-html-template``" file and
......@@ -205,7 +191,7 @@ configuration files.
For example, to process a PEP into HTML::
cd <path-to-docutils>/docs/peps
rstpep2html pep-0287.txt pep-0287.html
rstpep2html.py pep-0287.txt pep-0287.html
.. _pep_html: html.html#pep-html
......@@ -216,8 +202,6 @@ rst2s5.py
:Parser: reStructuredText
:Writer: s5_html_
In Debian this is installed as rst2s5.
The ``rst2s5.py`` front end reads standalone reStructuredText source
files and produces (X)HTML output compatible with S5_, the "Simple
Standards-based Slide Show System" by Eric Meyer. A theme is required
......@@ -227,7 +211,7 @@ are available; see Themes_ below.
For example, to process a reStructuredText file "``slides.txt``" into
S5/HTML::
rst2s5 slides.txt slides.html
rst2s5.py slides.txt slides.html
Now open the "``slides.html``" file in your favorite browser, switch
to full-screen mode, and enjoy the results.
......@@ -245,7 +229,7 @@ using the "``--theme``" option (for themes that come with Docutils) or
the "``--theme-url``" option (for themes anywhere). For example, the
"medium-black" theme can be specified as follows::
rst2s5 --theme medium-black slides.txt slides.html
rst2s5.py --theme medium-black slides.txt slides.html
The theme will be copied to the ``ui/medium-black`` directory.
......@@ -334,13 +318,11 @@ rst2latex.py
:Parser: reStructuredText
:Writer: latex2e
In Debian this is installed as rst2latex.
The ``rst2latex.py`` front end reads standalone reStructuredText
source files and produces LaTeX_ output. For example, to process a
reStructuredText file "``test.txt``" into LaTeX::
rst2latex test.txt test.tex
rst2latex.py test.txt test.tex
The output file "``test.tex``" should then be processed with ``latex``
or ``pdflatex`` to get a document in DVI, PostScript or PDF format for
......@@ -355,8 +337,6 @@ rst2xetex.py
:Parser: reStructuredText
:Writer: xetex
On Debian this front end is installed as rst2xetex.
The ``rst2xetex.py`` front end reads standalone reStructuredText source
files and produces `LaTeX` output for processing with unicode-aware
TeX engines (`LuaTeX`_ or `XeTeX`_). For example, to process a
......@@ -385,8 +365,6 @@ rst2xml.py
:Parser: reStructuredText
:Writer: XML (Docutils native)
In Debian this is installed as rst2xml.
The ``rst2xml.py`` front end produces Docutils-native XML output.
This can be transformed with standard XML tools such as XSLT
processors into arbitrary final forms. An example is the xml2rst_ processor
......@@ -405,8 +383,6 @@ rst2odt.py
:Parser: reStructuredText
:Writer: ODF/.odt
In Debian this front end is installed as rst2odt.
The ``rst2odt.py`` front end reads standalone reStructuredText
source files and produces ODF/.odt files that can be read, edited,
printed, etc with OpenOffice ``oowriter``
......@@ -437,8 +413,6 @@ rst2pseudoxml.py
:Parser: reStructuredText
:Writer: Pseudo-XML
In Debian this is installed as rst2pseudoxml.
``rst2pseudoxml.py`` is used for debugging the Docutils "Reader to
Transform to Writer" pipeline. It produces a compact pretty-printed
"pseudo-XML", where nesting is indicated by indentation (no end-tags).
......@@ -453,9 +427,6 @@ quicktest.py
:Parser: reStructuredText
:Writer: N/A
This tool is not currently installed by the Debian package;
``apt-get source python-docutils`` if you need it.
The ``quicktest.py`` tool is used for testing the reStructuredText
parser. It does not use a Docutils Reader or Writer or the standard
Docutils command-line options. Rather, it does its own I/O and calls
......
......@@ -215,18 +215,3 @@ class Component(SettingsSpec, TransformSpec):
a certain input context or output format.
"""
return format in self.supported
import os
_debian_package = 0
if _debian_package:
def _datadir(path):
dirname = os.path.dirname(path)
prefix = os.path.join(os.path.dirname(__file__), '') # _datadir
assert path.startswith(prefix), "%r doesn't start with %r" % (path, prefix)
suffix = dirname[len(prefix):]
return os.path.join('/usr/share/docutils/', suffix)
else:
def _datadir(path):
return os.path.dirname(path)
......@@ -482,8 +482,8 @@ class OptionParser(optparse.OptionParser, docutils.SettingsSpec):
['--output-encoding-error-handler'],
{'default': 'strict', 'validator': validate_encoding_error_handler}),
('Specify text encoding and error handler for error output. '
'Default text encoding: system encoding. Default error handler: %s.'
% default_error_encoding_error_handler,
'Default: %s:%s.'
% (default_error_encoding, default_error_encoding_error_handler),
['--error-encoding', '-e'],
{'metavar': '<name[:handler]>', 'default': default_error_encoding,
'validator': validate_encoding_and_error_handler}),
......
......@@ -10,7 +10,6 @@ import sys
import os.path
import re
import time
import docutils
from docutils import io, nodes, statemachine, utils
from docutils.utils.error_reporting import SafeString, ErrorString
from docutils.utils.error_reporting import locale_encoding
......@@ -48,7 +47,7 @@ class Include(Directive):
'class': directives.class_option,
'name': directives.unchanged}
standard_include_path = os.path.join(docutils._datadir(states.__file__),
standard_include_path = os.path.join(os.path.dirname(states.__file__),
'include')
def run(self):
......
......@@ -112,7 +112,13 @@ class Table(Directive):
'No table data detected in CSV file.', nodes.literal_block(
self.block_text, self.block_text), line=self.lineno)
raise SystemMessagePropagation(error)
return col_widths
if self.widths == 'auto':
widths = 'auto'
elif self.widths: # "grid" or list of integers
widths = 'given'
else:
widths = self.widths
return widths, col_widths
def extend_short_rows_with_empty_cells(self, columns, parts):
for part in parts:
......@@ -247,7 +253,7 @@ class CSVTable(Table):
self.check_table_dimensions(rows, header_rows, stub_columns)
table_head.extend(rows[:header_rows])
table_body = rows[header_rows:]
col_widths = self.get_column_widths(max_cols)
widths, col_widths = self.get_column_widths(max_cols)
self.extend_short_rows_with_empty_cells(max_cols,
(table_head, table_body))
except SystemMessagePropagation, detail:
......@@ -263,7 +269,7 @@ class CSVTable(Table):
return [error]
table = (col_widths, table_head, table_body)
table_node = self.state.build_table(table, self.content_offset,
stub_columns, widths=self.widths)
stub_columns, widths=widths)
table_node['classes'] += self.options.get('class', [])
if 'align' in self.options:
table_node['align'] = self.options.get('align')
......@@ -407,7 +413,7 @@ class ListTable(Table):
node = nodes.Element() # anonymous container for parsing
self.state.nested_parse(self.content, self.content_offset, node)
try:
num_cols, col_widths = self.check_list_content(node)
num_cols, widths, col_widths = self.check_list_content(node)
table_data = [[item.children for item in row_list[0]]
for row_list in node[0]]
header_rows = self.options.get('header-rows', 0)
......@@ -415,7 +421,7 @@ class ListTable(Table):
self.check_table_dimensions(table_data, header_rows, stub_columns)
except SystemMessagePropagation, detail:
return [detail.args[0]]
table_node = self.build_table_from_list(table_data, col_widths,
table_node = self.build_table_from_list(table_data, widths, col_widths,
header_rows, stub_columns)
if 'align' in self.options:
table_node['align'] = self.options.get('align')
......@@ -461,15 +467,14 @@ class ListTable(Table):
raise SystemMessagePropagation(error)
else:
num_cols = len(item[0])
col_widths = self.get_column_widths(num_cols)
return num_cols, col_widths
widths, col_widths = self.get_column_widths(num_cols)
return num_cols, widths, col_widths
def build_table_from_list(self, table_data, col_widths, header_rows, stub_columns):
def build_table_from_list(self, table_data, widths, col_widths, header_rows,
stub_columns):
table = nodes.table()
if self.widths == 'auto':
table['classes'] += ['colwidths-auto']
elif self.widths: # "grid" or list of integers
table['classes'] += ['colwidths-given']
if widths:
table['classes'] += ['colwidths-%s' % widths]
tgroup = nodes.tgroup(cols=len(col_widths))
table += tgroup
for col_width in col_widths:
......
......@@ -116,8 +116,7 @@ import docutils.parsers.rst
from docutils.parsers.rst import directives, languages, tableparser, roles
from docutils.parsers.rst.languages import en as _fallback_language_module
from docutils.utils import escape2null, unescape, column_width
from docutils.utils import punctuation_chars, urischemes
import roman
from docutils.utils import punctuation_chars, roman, urischemes
class MarkupError(DataError): pass
class UnknownInterpretedRoleError(DataError): pass
......@@ -1768,10 +1767,8 @@ class Body(RSTState):
def build_table(self, tabledata, tableline, stub_columns=0, widths=None):
colwidths, headrows, bodyrows = tabledata
table = nodes.table()
if widths == 'auto':
table['classes'] += ['colwidths-auto']
elif widths: # "grid" or list of integers
table['classes'] += ['colwidths-given']
if widths:
table['classes'] += ['colwidths-%s' % widths]
tgroup = nodes.tgroup(cols=len(colwidths))
table += tgroup
for colwidth in colwidths:
......
......@@ -27,16 +27,15 @@ class Writer(writers._html_base.Writer):
default_stylesheets = ['html4css1.css']
default_stylesheet_dirs = ['.',
docutils._datadir(os.path.abspath(__file__)),
os.path.abspath(os.path.dirname(__file__)),
# for math.css
os.path.join(
docutils._datadir(os.path.dirname(os.path.abspath(__file__))),
'html5_polyglot')
os.path.abspath(os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'html5_polyglot'))
]
default_template = 'template.txt'
default_template_path = os.path.join(
docutils._datadir(os.path.abspath(__file__)), default_template)
os.path.dirname(os.path.abspath(__file__)), default_template)
settings_spec = (
'HTML-Specific Options',
......
......@@ -40,11 +40,11 @@ class Writer(writers._html_base.Writer):
"""Formats this writer supports."""
default_stylesheets = ['minimal.css','plain.css']
default_stylesheet_dirs = ['.', docutils._datadir(os.path.abspath(__file__))]
default_stylesheet_dirs = ['.', os.path.abspath(os.path.dirname(__file__))]
default_template = 'template.txt'
default_template_path = os.path.join(
docutils._datadir(os.path.abspath(__file__)), default_template)
os.path.dirname(os.path.abspath(__file__)), default_template)
settings_spec = (
'HTML-Specific Options',
......
......@@ -23,7 +23,6 @@ try:
import roman
except ImportError:
import docutils.utils.roman as roman
import docutils
from docutils import frontend, nodes, languages, writers, utils, io
from docutils.utils.error_reporting import SafeString
from docutils.transforms import writer_aux
......@@ -35,7 +34,7 @@ class Writer(writers.Writer):
"""Formats this writer supports."""
default_template = 'default.tex'
default_template_path = docutils._datadir(os.path.abspath(__file__))
default_template_path = os.path.dirname(os.path.abspath(__file__))
default_preamble = '\n'.join([r'% PDF Standard Fonts',
r'\usepackage{mathptmx} % Times',
r'\usepackage[scaled=.90]{helvet}',
......
......@@ -399,13 +399,13 @@ class Writer(writers.Writer):
default_stylesheet_path = utils.relative_path(
os.path.join(os.getcwd(), 'dummy'),
os.path.join(docutils._datadir(__file__), default_stylesheet))
os.path.join(os.path.dirname(__file__), default_stylesheet))
default_template = 'template.txt'
default_template_path = utils.relative_path(
os.path.join(os.getcwd(), 'dummy'),
os.path.join(docutils._datadir(__file__), default_template))
os.path.join(os.path.dirname(__file__), default_template))
settings_spec = (
'ODF-Specific Options',
......
......@@ -24,13 +24,13 @@ class Writer(html4css1.Writer):
default_stylesheet_path = utils.relative_path(
os.path.join(os.getcwd(), 'dummy'),
os.path.join(docutils._datadir(__file__), default_stylesheet))
os.path.join(os.path.dirname(__file__), default_stylesheet))
default_template = 'template.txt'
default_template_path = utils.relative_path(
os.path.join(os.getcwd(), 'dummy'),
os.path.join(docutils._datadir(__file__), default_template))
os.path.join(os.path.dirname(__file__), default_template))
settings_spec = html4css1.Writer.settings_spec + (
'PEP/HTML-Specific Options',
......
......@@ -21,7 +21,7 @@ from docutils._compat import b
themes_dir_path = utils.relative_path(
os.path.join(os.getcwd(), 'dummy'),
os.path.join(docutils._datadir(__file__), 'themes'))
os.path.join(os.path.dirname(__file__), 'themes'))
def find_theme(name):
# Where else to look for a theme?
......
......@@ -4,7 +4,7 @@
<script>
// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
// This is licensed under the GNU LGPL, version 2.1 or later.
// Free usage permitted as long as this notice remains intact.
// This must be a path to a blank image. That's all the configuration you need here.
var blankImg = 'ui/default/blank.gif';
......
......@@ -24,18 +24,6 @@ except ImportError:
if sys.version_info >= (3,):
num_processes = 1
for option in os.environ.get('DEB_BUILD_OPTIONS', '').split():
if option.startswith('parallel='):
num_processes = int(option.split('=', 1)[1])
if num_processes > 1:
import lib2to3.refactor
class RefactoringTool(lib2to3.refactor.MultiprocessRefactoringTool):
def refactor(self, items, write=False):
return lib2to3.refactor.MultiprocessRefactoringTool.refactor(self, items, write=write, num_processes=num_processes)
lib2to3.refactor.RefactoringTool = RefactoringTool
# copy-convert auxiliary python sources
class copy_build_py_2to3(build_py_2to3):
"""Copy/convert Python source files in given directories recursively.
......
......@@ -52,9 +52,12 @@ testroot = os.path.abspath(os.path.dirname(__file__) or os.curdir)
os.chdir(testroot)
if sys.version_info >= (3,0):
sys.path.insert(0, os.path.normpath(os.path.join(testroot,
'..', 'build', 'py3')))
'..', 'build', 'lib')))
sys.path.append(os.path.normpath(os.path.join(testroot, '..',
'build', 'lib', 'extras')))
else:
sys.path.insert(0, os.path.normpath(os.path.join(testroot, '..', 'build', 'py2')))
sys.path.insert(0, os.path.normpath(os.path.join(testroot, '..')))
sys.path.append(os.path.normpath(os.path.join(testroot, '..', 'extras')))
sys.path.insert(0, testroot)
try:
......
......@@ -69,6 +69,9 @@ def suite():
sys.stdout.flush()
return suite
# must redirect stderr *before* first import of unittest
sys.stdout = sys.stderr = Tee('alltests.out')
import package_unittest
......
......@@ -4,7 +4,7 @@
<script>
// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
// This is licensed under the GNU LGPL, version 2.1 or later.
// Free usage permitted as long as this notice remains intact.
// This must be a path to a blank image. That's all the configuration you need here.
var blankImg = 'ui/default/blank.gif';
......
......@@ -4,7 +4,7 @@
<script>
// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
// This is licensed under the GNU LGPL, version 2.1 or later.
// Free usage permitted as long as this notice remains intact.
// This must be a path to a blank image. That's all the configuration you need here.
var blankImg = 'ui/small-black/blank.gif';
......
......@@ -11,7 +11,6 @@ Tests for misc.py "include" directive.
import os.path
import sys
from __init__ import DocutilsTestSupport
import docutils
from docutils.parsers.rst import states
from docutils._compat import b
from docutils.utils.code_analyzer import with_pygments
......@@ -48,7 +47,7 @@ if sys.version_info < (3,0):
utf_16_error_str = ("UnicodeError: Unable to decode input data. "
"Tried the following encodings: 'ascii'.\n"
" (%s)" % utf_16_error_str)
nonexistent = os.path.join(docutils._datadir(states.__file__),
nonexistent = os.path.join(os.path.dirname(states.__file__),
'include', 'nonexistent')
nonexistent_rel = DocutilsTestSupport.utils.relative_path(
os.path.join(DocutilsTestSupport.testroot, 'dummy'), nonexistent)
......
......@@ -72,7 +72,6 @@ class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
from elementtree import ElementTree as etree
WhichElementTree = 'elementtree'
except ImportError, e:
raise
s1 = '\nSkipped test of odf_odt writer. ' \
'In order to test odf_odt writer ' \
'must install either a version of Python containing ' \
......
......@@ -4425,7 +4425,7 @@ buffer, if the region is not selected."
;; FIXME: Should be integrated in `rst-compile-toolsets' defaulting to
;; something like `browse-url'.
(defvar rst-slides-program "sensible-browser"
(defvar rst-slides-program "firefox"
"Program used to preview S5 slides.")
(defun rst-compile-slides-preview ()
......
......@@ -12,15 +12,7 @@ specifications from styles.xml in STYLE_FILE.odt.
#
# Author: Michael Schutte <michi@uiae.at>
try:
from xml.etree import ElementTree as etree
except ImportError:
try:
from elementtree import ElementTree as etree
except ImportError:
raise ImportError('Missing an implementation of ElementTree. ' \
'Please install either Python >= 2.5 or ElementTree.')
from lxml import etree
import sys
import zipfile
from tempfile import mkstemp
......@@ -35,22 +27,12 @@ NAMESPACES = {
def prepstyle(filename):
zin = zipfile.ZipFile(filename)
styles = zin.open("styles.xml")
root = None
# some extra effort to preserve namespace prefixes
for event, elem in etree.iterparse(styles, events=("start", "start-ns")):
if event == "start-ns":
etree.register_namespace(elem[0], elem[1])
elif event == "start":
if root is None:
root = elem
styles.close()
for el in root.findall(".//style:page-layout-properties",
namespaces=NAMESPACES):
for attr in el.attrib.keys():
styles = zin.read("styles.xml")
root = etree.fromstring(styles)
for el in root.xpath("//style:page-layout-properties",
namespaces=NAMESPACES):
for attr in el.attrib:
if attr.startswith("{%s}" % NAMESPACES["fo"]):
del el.attrib[attr]
......@@ -60,7 +42,7 @@ def prepstyle(filename):
for item in zin.infolist():
if item.filename == "styles.xml":
zout.writestr(item, etree.tostring(root, encoding="UTF-8"))
zout.writestr(item, etree.tostring(root))
else:
zout.writestr(item, zin.read(item.filename))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment