├── test ├── data │ ├── stylesheet.txt │ ├── raw.txt │ ├── csv_data.txt │ ├── include.txt │ ├── ham.tex │ ├── csv_dep.txt │ ├── ham.css │ ├── config_error_handler.txt │ ├── latin1.txt │ ├── config_list_2.txt │ ├── config_2.txt │ ├── config_old.txt │ ├── config_list.txt │ ├── config_1.txt │ ├── dependencies.txt │ └── full-template.txt ├── functional │ ├── input │ │ ├── simple.txt │ │ ├── data │ │ │ ├── header_footer.txt │ │ │ ├── errors.txt │ │ │ ├── table_colspan.txt │ │ │ ├── nonalphanumeric.txt │ │ │ ├── option_lists.txt │ │ │ ├── section_titles.txt │ │ │ ├── table_rowspan.txt │ │ │ ├── swf_images.txt │ │ │ ├── list_table.txt │ │ │ ├── hyperlinking.txt │ │ │ ├── table_complex.txt │ │ │ ├── custom_roles.txt │ │ │ ├── latex_encoding.txt │ │ │ ├── unicode.txt │ │ │ ├── custom_roles_latex.txt │ │ │ └── urls.txt │ │ ├── odt_no_class.txt │ │ ├── odt_unnested_class.txt │ │ ├── odt_basic.txt │ │ ├── odt_nested_class.txt │ │ ├── field_list.txt │ │ ├── odt_custom_headfoot.txt │ │ ├── standalone_rst_docutils_xml.txt │ │ ├── standalone_rst_pseudoxml.txt │ │ ├── latex_docinfo.txt │ │ ├── dangerous.txt │ │ ├── footnotes.txt │ │ ├── link_in_substitution.txt │ │ ├── pep_html.txt │ │ ├── cyrillic.txt │ │ ├── standalone_rst_html4css1.txt │ │ ├── compact_lists.txt │ │ ├── standalone_rst_latex.txt │ │ ├── latex_babel.txt │ │ └── standalone_rst_xetex.txt │ ├── expected │ │ ├── odt_basic.odt │ │ ├── odt_tables1.odt │ │ ├── odt_no_class.odt │ │ ├── odt_nested_class.odt │ │ ├── ui │ │ │ ├── default │ │ │ │ ├── blank.gif │ │ │ │ ├── opera.css │ │ │ │ ├── slides.css │ │ │ │ ├── s5-core.css │ │ │ │ ├── outline.css │ │ │ │ ├── print.css │ │ │ │ ├── framing.css │ │ │ │ └── iepngfix.htc │ │ │ └── small-black │ │ │ │ ├── blank.gif │ │ │ │ ├── opera.css │ │ │ │ ├── slides.css │ │ │ │ ├── s5-core.css │ │ │ │ ├── outline.css │ │ │ │ ├── print.css │ │ │ │ ├── framing.css │ │ │ │ └── iepngfix.htc │ │ ├── odt_unnested_class.odt │ │ ├── odt_custom_headfoot.odt │ │ ├── latex_docinfo.tex │ │ ├── misc_rst_html4css1.html │ │ ├── field_name_limit.html │ │ ├── compact_lists.html │ │ └── cyrillic.tex │ ├── output │ │ └── README.txt │ ├── README.txt │ └── tests │ │ ├── _standalone_rst_defaults.py │ │ ├── _default.py │ │ ├── latex_babel.py │ │ ├── standalone_rst_manpage.py │ │ ├── latex_cornercases.py │ │ ├── standalone_rst_s5_html_2.py │ │ ├── latex_docinfo.py │ │ ├── standalone_rst_latex.py │ │ ├── standalone_rst_xetex.py │ │ ├── compact_lists.py │ │ ├── latex_literal_block.py │ │ ├── standalone_rst_pseudoxml.py │ │ ├── latex_literal_block_fancyvrb.py │ │ ├── latex_literal_block_verbatim.py │ │ ├── latex_literal_block_verbatimtab.py │ │ ├── math_output_latex.py │ │ ├── misc_rst_html4css1.py │ │ ├── dangerous.py │ │ ├── math_output_html.py │ │ ├── math_output_mathjax.py │ │ ├── standalone_rst_html4css1.py │ │ ├── field_name_limit.py │ │ ├── math_output_mathml.py │ │ ├── standalone_rst_docutils_xml.py │ │ ├── footnotes_html5.py │ │ ├── standalone_rst_html5.py │ │ ├── latex_cyrillic.py │ │ ├── xetex_cyrillic.py │ │ ├── pep_html.py │ │ └── latex_literal_block_listings.py ├── test_parsers │ ├── test_rst │ │ ├── test_directives │ │ │ ├── empty.txt │ │ │ ├── include 11.txt │ │ │ ├── raw1.txt │ │ │ ├── includes │ │ │ │ ├── sibling │ │ │ │ │ └── include7.txt │ │ │ │ ├── include5.txt │ │ │ │ ├── more │ │ │ │ │ └── include6.txt │ │ │ │ ├── include14.txt │ │ │ │ └── include4.txt │ │ │ ├── include3.txt │ │ │ ├── include8.txt │ │ │ ├── include1.txt │ │ │ ├── utf-16.csv │ │ │ ├── include2.txt │ │ │ ├── include_literal.txt │ │ │ ├── include12.txt │ │ │ ├── include13.txt │ │ │ ├── __init__.py │ │ │ ├── test_title.py │ │ │ ├── include10.txt │ │ │ ├── test_class.py │ │ │ ├── test_sectnum.py │ │ │ ├── test_block_quotes.py │ │ │ ├── test_math.py │ │ │ ├── test_date.py │ │ │ ├── test_parsed_literals.py │ │ │ ├── test_code_none.py │ │ │ └── test_target_notes.py │ │ ├── includes │ │ │ └── include9.txt │ │ ├── __init__.py │ │ ├── test_interpreted_fr.py │ │ ├── test_doctest_blocks.py │ │ └── test_paragraphs.py │ ├── __init__.py │ ├── test_get_parser_class.py │ └── test_parser.py ├── test_readers │ ├── __init__.py │ ├── test_pep │ │ └── __init__.py │ └── test_get_reader_class.py ├── test_writers │ ├── __init__.py │ ├── test_null.py │ ├── test_get_writer_class.py │ └── test_pseudoxml.py ├── test_transforms │ ├── __init__.py │ ├── test_filter.py │ ├── test_strip_comments.py │ ├── test_expose_internals.py │ ├── test___init__.py │ ├── test_strip_elements_with_class.py │ └── test_peps.py ├── docutils.conf ├── local-reader.py ├── local-parser.py ├── test_pickle.py ├── local-writer.py ├── coverage.sh └── test_command_line.py ├── tools ├── dev │ ├── README.txt │ └── profile_docutils.py ├── editors │ ├── emacs │ │ ├── docutils.conf │ │ ├── IDEAS.rst │ │ ├── tests │ │ │ ├── README.txt │ │ │ ├── Makefile │ │ │ └── init.el │ │ └── README.txt │ └── README.txt ├── docutils.conf ├── rst2html.py ├── rst2xml.py ├── rst2pseudoxml.py ├── rst2man.py ├── rst2s5.py ├── rstpep2html.py ├── rst2html4.py ├── rst2odt.py ├── rst2latex.py ├── rst2xetex.py ├── rst2html5.py └── rst2odt_prepstyles.py ├── README.md ├── docutils ├── writers │ ├── s5_html │ │ └── themes │ │ │ ├── big-black │ │ │ ├── __base__ │ │ │ └── framing.css │ │ │ ├── medium-black │ │ │ └── __base__ │ │ │ ├── small-black │ │ │ └── __base__ │ │ │ ├── default │ │ │ ├── blank.gif │ │ │ ├── opera.css │ │ │ ├── slides.css │ │ │ ├── s5-core.css │ │ │ ├── outline.css │ │ │ ├── print.css │ │ │ ├── framing.css │ │ │ └── iepngfix.htc │ │ │ ├── README.txt │ │ │ ├── big-white │ │ │ └── framing.css │ │ │ ├── small-white │ │ │ └── framing.css │ │ │ └── medium-white │ │ │ └── framing.css │ ├── odf_odt │ │ └── styles.odt │ ├── html4css1 │ │ └── template.txt │ ├── html5_polyglot │ │ └── template.txt │ ├── latex2e │ │ ├── default.tex │ │ ├── titlepage.tex │ │ └── xelatex.tex │ ├── null.py │ ├── pseudoxml.py │ └── pep_html │ │ └── template.txt ├── docutils.conf ├── parsers │ ├── rst │ │ ├── include │ │ │ ├── isogrk4.txt │ │ │ ├── isomfrk.txt │ │ │ ├── isomopf.txt │ │ │ ├── README.txt │ │ │ ├── isomscr.txt │ │ │ ├── isodia.txt │ │ │ ├── s5defs.txt │ │ │ ├── isogrk2.txt │ │ │ ├── isoamsc.txt │ │ │ ├── isocyr2.txt │ │ │ └── isomopf-wide.txt │ │ ├── directives │ │ │ └── references.py │ │ └── languages │ │ │ └── __init__.py │ ├── null.py │ └── __init__.py ├── _compat.py ├── languages │ ├── __init__.py │ ├── de.py │ ├── ko.py │ ├── ja.py │ ├── it.py │ └── af.py ├── readers │ ├── pep.py │ └── doctree.py └── utils │ └── math │ └── __init__.py ├── docs └── user │ ├── images │ ├── big-black.png │ ├── big-white.png │ ├── default.png │ ├── rsp-all.png │ ├── rsp-cuts.png │ ├── rsp-empty.png │ ├── s5-files.png │ ├── rsp-breaks.png │ ├── rsp-covers.png │ ├── rsp-objects.png │ ├── small-black.png │ ├── small-white.png │ ├── happy_monkey.png │ ├── medium-black.png │ └── medium-white.png │ ├── rst │ └── images │ │ ├── title.png │ │ ├── biohazard.png │ │ ├── biohazard.swf │ │ ├── biohazard-bitmap.svg │ │ └── biohazard-bitmap-scaling.svg │ └── Makefile.docutils-update ├── licenses ├── docutils.conf └── BSD-2-Clause.txt ├── MANIFEST.in ├── setup.cfg └── install.py /test/data/stylesheet.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/data/raw.txt: -------------------------------------------------------------------------------- 1 | Raw text. 2 | -------------------------------------------------------------------------------- /test/data/csv_data.txt: -------------------------------------------------------------------------------- 1 | foo, bar 2 | -------------------------------------------------------------------------------- /test/data/include.txt: -------------------------------------------------------------------------------- 1 | Some include text. 2 | -------------------------------------------------------------------------------- /tools/dev/README.txt: -------------------------------------------------------------------------------- 1 | Tools for developers. 2 | -------------------------------------------------------------------------------- /test/functional/input/simple.txt: -------------------------------------------------------------------------------- 1 | simple input 2 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/empty.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/data/ham.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\ham}{wonderful ham} 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docutils-mirror 2 | A mirror for docutils code 3 | -------------------------------------------------------------------------------- /test/data/csv_dep.txt: -------------------------------------------------------------------------------- 1 | .. csv-table:: 2 | :file: csv_data.txt 3 | -------------------------------------------------------------------------------- /test/data/ham.css: -------------------------------------------------------------------------------- 1 | dl.docutils dd { 2 | margin-bottom: 0.5em } 3 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include 11.txt: -------------------------------------------------------------------------------- 1 | some text 2 | -------------------------------------------------------------------------------- /tools/editors/emacs/docutils.conf: -------------------------------------------------------------------------------- 1 | [general] 2 | input_encoding: latin-1 3 | -------------------------------------------------------------------------------- /test/data/config_error_handler.txt: -------------------------------------------------------------------------------- 1 | [general] 2 | error_encoding: ascii:strict 3 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/big-black/__base__: -------------------------------------------------------------------------------- 1 | # base theme of this theme: 2 | big-white 3 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/medium-black/__base__: -------------------------------------------------------------------------------- 1 | # base theme of this theme: 2 | medium-white 3 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/small-black/__base__: -------------------------------------------------------------------------------- 1 | # base theme of this theme: 2 | small-white 3 | -------------------------------------------------------------------------------- /test/data/latin1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/data/latin1.txt -------------------------------------------------------------------------------- /test/functional/input/data/header_footer.txt: -------------------------------------------------------------------------------- 1 | .. header:: Document header 2 | .. footer:: Document footer 3 | -------------------------------------------------------------------------------- /test/functional/input/odt_no_class.txt: -------------------------------------------------------------------------------- 1 | .. role:: action 2 | 3 | Hello... `(beat)`:action: ...there! 4 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/raw1.txt: -------------------------------------------------------------------------------- 1 |

This file is used by test_raw.py.

2 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/includes/sibling/include7.txt: -------------------------------------------------------------------------------- 1 | In includes/sibling/include7.txt 2 | -------------------------------------------------------------------------------- /docs/user/images/big-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/big-black.png -------------------------------------------------------------------------------- /docs/user/images/big-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/big-white.png -------------------------------------------------------------------------------- /docs/user/images/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/default.png -------------------------------------------------------------------------------- /docs/user/images/rsp-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/rsp-all.png -------------------------------------------------------------------------------- /docs/user/images/rsp-cuts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/rsp-cuts.png -------------------------------------------------------------------------------- /docs/user/images/rsp-empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/rsp-empty.png -------------------------------------------------------------------------------- /docs/user/images/s5-files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/s5-files.png -------------------------------------------------------------------------------- /docs/user/rst/images/title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/rst/images/title.png -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include3.txt: -------------------------------------------------------------------------------- 1 | In include3.txt 2 | 3 | .. include:: includes/include4.txt 4 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include8.txt: -------------------------------------------------------------------------------- 1 | In include8.txt 2 | 3 | .. include:: ../includes/include9.txt 4 | -------------------------------------------------------------------------------- /tools/editors/emacs/IDEAS.rst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/tools/editors/emacs/IDEAS.rst -------------------------------------------------------------------------------- /docs/user/images/rsp-breaks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/rsp-breaks.png -------------------------------------------------------------------------------- /docs/user/images/rsp-covers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/rsp-covers.png -------------------------------------------------------------------------------- /docs/user/images/rsp-objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/rsp-objects.png -------------------------------------------------------------------------------- /docs/user/images/small-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/small-black.png -------------------------------------------------------------------------------- /docs/user/images/small-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/small-white.png -------------------------------------------------------------------------------- /docs/user/images/happy_monkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/happy_monkey.png -------------------------------------------------------------------------------- /docs/user/images/medium-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/medium-black.png -------------------------------------------------------------------------------- /docs/user/images/medium-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/images/medium-white.png -------------------------------------------------------------------------------- /docs/user/rst/images/biohazard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/rst/images/biohazard.png -------------------------------------------------------------------------------- /docs/user/rst/images/biohazard.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docs/user/rst/images/biohazard.swf -------------------------------------------------------------------------------- /docutils/writers/odf_odt/styles.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docutils/writers/odf_odt/styles.odt -------------------------------------------------------------------------------- /test/functional/input/odt_unnested_class.txt: -------------------------------------------------------------------------------- 1 | .. role:: action 2 | :class: action 3 | 4 | Hello... `(beat)`:action: ...there! 5 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/includes/include5.txt: -------------------------------------------------------------------------------- 1 | In includes/include5.txt 2 | 3 | .. include:: more/include6.txt 4 | -------------------------------------------------------------------------------- /test/data/config_list_2.txt: -------------------------------------------------------------------------------- 1 | [general] 2 | expose_internals: f 3 | strip-classes: ham, eggs 4 | strip-elements-with-classes: eggs,salt 5 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/includes/include9.txt: -------------------------------------------------------------------------------- 1 | In ../includes/include9.txt. 2 | 3 | .. include:: ../test_directives/include2.txt 4 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include1.txt: -------------------------------------------------------------------------------- 1 | Inclusion 1 2 | ----------- 3 | 4 | This file is used by ``test_include.py``. 5 | -------------------------------------------------------------------------------- /test/functional/expected/odt_basic.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/odt_basic.odt -------------------------------------------------------------------------------- /test/functional/expected/odt_tables1.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/odt_tables1.odt -------------------------------------------------------------------------------- /test/functional/input/odt_basic.txt: -------------------------------------------------------------------------------- 1 | ===== 2 | Test 3 | ===== 4 | 5 | Basic # 1 6 | ========== 7 | 8 | A *simple* test. 9 | 10 | -------------------------------------------------------------------------------- /test/functional/expected/odt_no_class.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/odt_no_class.odt -------------------------------------------------------------------------------- /test/functional/expected/odt_nested_class.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/odt_nested_class.odt -------------------------------------------------------------------------------- /test/functional/expected/ui/default/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/ui/default/blank.gif -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/includes/more/include6.txt: -------------------------------------------------------------------------------- 1 | In includes/more/include6.txt 2 | 3 | .. include:: ../sibling/include7.txt 4 | -------------------------------------------------------------------------------- /test/functional/expected/odt_unnested_class.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/odt_unnested_class.odt -------------------------------------------------------------------------------- /test/functional/input/odt_nested_class.txt: -------------------------------------------------------------------------------- 1 | .. role:: action 2 | :class: action parenthetical direction 3 | 4 | Hello... `(beat)`:action: ...there! 5 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/docutils/writers/s5_html/themes/default/blank.gif -------------------------------------------------------------------------------- /test/functional/expected/odt_custom_headfoot.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/odt_custom_headfoot.odt -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/functional/expected/ui/small-black/blank.gif -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/utf-16.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/docutils-mirror/master/test/test_parsers/test_rst/test_directives/utf-16.csv -------------------------------------------------------------------------------- /test/functional/output/README.txt: -------------------------------------------------------------------------------- 1 | This is the directory where the actual output is stored. 2 | 3 | This README.txt is just a placeholder to make CVS create the directory. 4 | -------------------------------------------------------------------------------- /docutils/writers/html4css1/template.txt: -------------------------------------------------------------------------------- 1 | %(head_prefix)s 2 | %(head)s 3 | %(stylesheet)s 4 | %(body_prefix)s 5 | %(body_pre_docinfo)s 6 | %(docinfo)s 7 | %(body)s 8 | %(body_suffix)s 9 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include2.txt: -------------------------------------------------------------------------------- 1 | Here are some paragraphs 2 | that can appear at any level. 3 | 4 | This file (include2.txt) is used by 5 | ``test_include.py``. 6 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include_literal.txt: -------------------------------------------------------------------------------- 1 | Literal included this should **not** be *marked* `up`. 2 | <- leading raw tab. 3 | 4 | Newlines 5 | are 6 | normalized. 7 | -------------------------------------------------------------------------------- /docutils/docutils.conf: -------------------------------------------------------------------------------- 1 | # This configuration file is to prevent tools/buildhtml.py from 2 | # processing text files in and below this directory. 3 | 4 | [buildhtml application] 5 | prune: . 6 | -------------------------------------------------------------------------------- /docutils/writers/html5_polyglot/template.txt: -------------------------------------------------------------------------------- 1 | %(head_prefix)s 2 | %(head)s 3 | %(stylesheet)s 4 | %(body_prefix)s 5 | %(body_pre_docinfo)s 6 | %(docinfo)s 7 | %(body)s 8 | %(body_suffix)s 9 | -------------------------------------------------------------------------------- /licenses/docutils.conf: -------------------------------------------------------------------------------- 1 | # This configuration file is to prevent tools/buildhtml.py from 2 | # processing text files in and below this directory. 3 | 4 | [buildhtml application] 5 | prune: . 6 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/includes/include14.txt: -------------------------------------------------------------------------------- 1 | Including more/include6.txt as rst-code from includes/include14.txt: 2 | 3 | .. include:: more/include6.txt 4 | :code: rst 5 | -------------------------------------------------------------------------------- /test/functional/README.txt: -------------------------------------------------------------------------------- 1 | This directory stores data files for functional tests. 2 | 3 | Please see the documentation on `functional testing`__ for details. 4 | 5 | __ ../../docs/dev/testing.html#functional 6 | -------------------------------------------------------------------------------- /test/data/config_2.txt: -------------------------------------------------------------------------------- 1 | # Test config file (new format) 2 | 3 | [general] 4 | 5 | generator: no 6 | 7 | 8 | [html4css1 writer] 9 | 10 | footnote-references: superscript 11 | stylesheet-path: test.css 12 | -------------------------------------------------------------------------------- /test/functional/input/field_list.txt: -------------------------------------------------------------------------------- 1 | :short: This field's name is short. 2 | :medium-length: This field's name is medium-length. 3 | :long field name: This field's name is long. 4 | :very very long field name: 5 | This field's name is quite long. 6 | -------------------------------------------------------------------------------- /test/functional/input/odt_custom_headfoot.txt: -------------------------------------------------------------------------------- 1 | ============================ 2 | Custom Headers and Footers 3 | ============================ 4 | 5 | Test for custom headers and footers and for page numbers, date, 6 | time, etc. 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include12.txt: -------------------------------------------------------------------------------- 1 | In include12.txt (but before "start here") 2 | 3 | .. start here 4 | 5 | In include12.txt (after "start here", before "stop here") 6 | 7 | .. stop here 8 | 9 | In include12.txt (after "stop here") 10 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/includes/include4.txt: -------------------------------------------------------------------------------- 1 | In includes/include4.txt 2 | 3 | .. include:: include5.txt 4 | 5 | .. include:: include5.txt 6 | :literal: 7 | 8 | .. csv-table:: 9 | :file: sibling/include7.txt 10 | :delim: space 11 | -------------------------------------------------------------------------------- /test/functional/tests/_standalone_rst_defaults.py: -------------------------------------------------------------------------------- 1 | # Keyword parameters passed to publish_file. 2 | reader_name = "standalone" 3 | parser_name = "rst" 4 | 5 | # Settings. 6 | settings_overrides['sectsubtitle_xform'] = 1 7 | settings_overrides['syntax_highlight'] = 'none' 8 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include13.txt: -------------------------------------------------------------------------------- 1 | In include13.txt (but before header) 2 | 3 | From: me 4 | To: you 5 | 6 | In include13.txt (between header and signature) 7 | 8 | ------- 9 | -- mork of ork 10 | 11 | In include13.txt (after signature) 12 | -------------------------------------------------------------------------------- /test/functional/tests/_default.py: -------------------------------------------------------------------------------- 1 | # Default settings for all tests. 2 | 3 | settings_overrides['report_level'] = 2 4 | settings_overrides['halt_level'] = 5 5 | settings_overrides['warning_stream'] = '' 6 | settings_overrides['input_encoding'] = 'utf-8' 7 | settings_overrides['embed_stylesheet'] = False 8 | -------------------------------------------------------------------------------- /test/functional/input/standalone_rst_docutils_xml.txt: -------------------------------------------------------------------------------- 1 | .. include:: data/standard.txt 2 | .. include:: data/header_footer.txt 3 | .. include:: data/table_colspan.txt 4 | .. include:: data/table_rowspan.txt 5 | .. include:: data/table_complex.txt 6 | .. include:: data/list_table.txt 7 | .. include:: data/errors.txt 8 | -------------------------------------------------------------------------------- /test/functional/input/standalone_rst_pseudoxml.txt: -------------------------------------------------------------------------------- 1 | .. include:: data/standard.txt 2 | .. include:: data/header_footer.txt 3 | .. include:: data/table_colspan.txt 4 | .. include:: data/table_rowspan.txt 5 | .. include:: data/table_complex.txt 6 | .. include:: data/list_table.txt 7 | .. include:: data/errors.txt 8 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.txt 2 | include *.py 3 | include setup.cfg 4 | include MANIFEST 5 | include MANIFEST.in 6 | recursive-include docutils * 7 | recursive-include docs * 8 | recursive-include licenses * 9 | recursive-include test * 10 | recursive-include tools * 11 | recursive-exclude * *.pyc *~ .DS_Store 12 | -------------------------------------------------------------------------------- /test/functional/tests/latex_babel.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_babel.txt" 3 | test_destination = "latex_babel.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | -------------------------------------------------------------------------------- /test/functional/expected/ui/default/opera.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* DO NOT CHANGE THESE unless you really want to break Opera Show */ 3 | .slide { 4 | visibility: visible !important; 5 | position: static !important; 6 | page-break-before: always; 7 | } 8 | #slide0 {page-break-before: avoid;} 9 | -------------------------------------------------------------------------------- /test/functional/input/data/errors.txt: -------------------------------------------------------------------------------- 1 | Error Handling 2 | ============== 3 | 4 | Any errors caught during processing will generate system messages. 5 | 6 | There should be five messages in the following, auto-generated 7 | section, "Docutils System Messages": 8 | 9 | .. section should be added by Docutils automatically 10 | -------------------------------------------------------------------------------- /test/functional/input/latex_docinfo.txt: -------------------------------------------------------------------------------- 1 | :Author: Foo Fred 2 | :Organization: Food Foomatics & Friends 3 | :Contact: foo@food.example.info 4 | :Address: Fox St 13 5 | Foowood 6 | :Author: Bar Barney 7 | :Organization: Bar-BQ Bar 8 | :Contact: 1-800-BARBQBAR 9 | :Address: Barbara St 16 10 | South Barwell 11 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/opera.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* DO NOT CHANGE THESE unless you really want to break Opera Show */ 3 | .slide { 4 | visibility: visible !important; 5 | position: static !important; 6 | page-break-before: always; 7 | } 8 | #slide0 {page-break-before: avoid;} 9 | -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/opera.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* DO NOT CHANGE THESE unless you really want to break Opera Show */ 3 | .slide { 4 | visibility: visible !important; 5 | position: static !important; 6 | page-break-before: always; 7 | } 8 | #slide0 {page-break-before: avoid;} 9 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_manpage.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "standalone_rst_manpage.txt" 5 | test_destination = "standalone_rst_manpage.man" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "manpage" 9 | -------------------------------------------------------------------------------- /test/functional/tests/latex_cornercases.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_cornercases.txt" 3 | test_destination = "latex_cornercases.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | -------------------------------------------------------------------------------- /test/data/config_old.txt: -------------------------------------------------------------------------------- 1 | # Test config file (old format) 2 | 3 | [options] 4 | 5 | source-link: 1 6 | datestamp: %Y-%m-%d %H:%M UTC 7 | generator: 1 8 | 9 | stylesheet-path: stylesheets/default.css 10 | 11 | pep-template: pep-html-template 12 | pep-stylesheet-path: stylesheets/pep.css 13 | python-home: http://www.python.org 14 | no-random: 1 15 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/README.txt: -------------------------------------------------------------------------------- 1 | Except where otherwise noted (default/iepngfix.htc), all files in this 2 | directory have been released into the Public Domain. 3 | 4 | These files are based on files from S5 1.1, released into the Public 5 | Domain by Eric Meyer. For further details, please see 6 | http://www.meyerweb.com/eric/tools/s5/credits.html. 7 | -------------------------------------------------------------------------------- /test/functional/expected/ui/default/slides.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | 3 | /* required to make the slide show run at all */ 4 | @import url(s5-core.css); 5 | 6 | /* sets basic placement and size of slide components */ 7 | @import url(framing.css); 8 | 9 | /* styles that make the slides look good */ 10 | @import url(pretty.css); 11 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/slides.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | 3 | /* required to make the slide show run at all */ 4 | @import url(s5-core.css); 5 | 6 | /* sets basic placement and size of slide components */ 7 | @import url(framing.css); 8 | 9 | /* styles that make the slides look good */ 10 | @import url(pretty.css); 11 | -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/slides.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | 3 | /* required to make the slide show run at all */ 4 | @import url(s5-core.css); 5 | 6 | /* sets basic placement and size of slide components */ 7 | @import url(framing.css); 8 | 9 | /* styles that make the slides look good */ 10 | @import url(pretty.css); 11 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_s5_html_2.py: -------------------------------------------------------------------------------- 1 | # initialize with the settings & definitions from test 1: 2 | exec(open('functional/tests/standalone_rst_s5_html_1.py').read()) 3 | 4 | # overrides specific to this test: 5 | test_destination = 'standalone_rst_s5_html_2.html' 6 | del settings_overrides['theme'] # use the default 7 | settings_overrides['current_slide'] = 1 8 | -------------------------------------------------------------------------------- /test/functional/tests/latex_docinfo.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_docinfo.txt" 3 | test_destination = "latex_docinfo.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | 12 | settings_overrides['use_latex_docinfo'] = 1 13 | -------------------------------------------------------------------------------- /docs/user/Makefile.docutils-update: -------------------------------------------------------------------------------- 1 | slide-shows.s5.html: slide-shows.txt 2 | rst2s5.py slide-shows.txt slide-shows.s5.html \ 3 | --config ../../tools/docutils.conf \ 4 | --overwrite-theme-files \ 5 | --link-stylesheet \ 6 | --no-generator --no-datestamp --no-source-link 7 | 8 | smartquotes.html: smartquotes.txt 9 | rst2html.py smartquotes.txt smartquotes.html --smart-quotes=true 10 | -------------------------------------------------------------------------------- /test/data/config_list.txt: -------------------------------------------------------------------------------- 1 | [general] 2 | expose_internals: a 3 | strip-classes: spam 4 | strip-elements-with-classes: sugar, flour 5 | 6 | [html4css1 writer] 7 | expose_internals: b:c:d 8 | strip-classes: pan, 9 | fun, 10 | strip-elements-with-classes: milk 11 | 12 | [pep_html writer] 13 | expose_internals: e 14 | strip-classes: parrot 15 | strip-elements-with-classes: safran 16 | -------------------------------------------------------------------------------- /test/functional/input/data/table_colspan.txt: -------------------------------------------------------------------------------- 1 | Colspanning tables 2 | ------------------ 3 | 4 | This table has a cell spanning two columns: 5 | 6 | ===== ===== ====== 7 | Inputs Output 8 | ------------ ------ 9 | A B A or B 10 | ===== ===== ====== 11 | False False False 12 | True False True 13 | False True True 14 | True True True 15 | ===== ===== ====== 16 | -------------------------------------------------------------------------------- /test/test_parsers/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | import sys 4 | 5 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 6 | prev = '' 7 | while sys.path[0] != prev: 8 | try: 9 | import DocutilsTestSupport 10 | break 11 | except ImportError: 12 | prev = sys.path[0] 13 | sys.path[0] = os.path.dirname(prev) 14 | sys.path.pop(0) 15 | -------------------------------------------------------------------------------- /test/test_readers/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | import sys 4 | 5 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 6 | prev = '' 7 | while sys.path[0] != prev: 8 | try: 9 | import DocutilsTestSupport 10 | break 11 | except ImportError: 12 | prev = sys.path[0] 13 | sys.path[0] = os.path.dirname(prev) 14 | sys.path.pop(0) 15 | -------------------------------------------------------------------------------- /test/test_writers/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | import sys 4 | 5 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 6 | prev = '' 7 | while sys.path[0] != prev: 8 | try: 9 | import DocutilsTestSupport 10 | break 11 | except ImportError: 12 | prev = sys.path[0] 13 | sys.path[0] = os.path.dirname(prev) 14 | sys.path.pop(0) 15 | -------------------------------------------------------------------------------- /tools/docutils.conf: -------------------------------------------------------------------------------- 1 | # These entries affect all processing: 2 | [general] 3 | source-link: yes 4 | datestamp: %Y-%m-%d %H:%M UTC 5 | generator: on 6 | 7 | # These entries affect HTML output: 8 | [html4css1 writer] 9 | # Required for docutils-update, the website build system: 10 | stylesheet-path: ../docutils/writers/html4css1/html4css1.css 11 | embed-stylesheet: no 12 | field-name-limit: 20 13 | -------------------------------------------------------------------------------- /test/test_transforms/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | import sys 4 | 5 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 6 | prev = '' 7 | while sys.path[0] != prev: 8 | try: 9 | import DocutilsTestSupport 10 | break 11 | except ImportError: 12 | prev = sys.path[0] 13 | sys.path[0] = os.path.dirname(prev) 14 | sys.path.pop(0) 15 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_rpm] 2 | doc_files = BUGS.txt 3 | COPYING.txt 4 | FAQ.txt 5 | HISTORY.txt 6 | README.txt 7 | RELEASE-NOTES.txt 8 | THANKS.txt 9 | docs/ 10 | licenses/ 11 | 12 | # [build] 13 | # executable = /usr/bin/env python 14 | # Uncomment to keep unchanged in the "shebang line" of front-end scripts 15 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | import sys 4 | 5 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 6 | prev = '' 7 | while sys.path[0] != prev: 8 | try: 9 | import DocutilsTestSupport 10 | break 11 | except ImportError: 12 | prev = sys.path[0] 13 | sys.path[0] = os.path.dirname(prev) 14 | sys.path.pop(0) 15 | -------------------------------------------------------------------------------- /test/test_readers/test_pep/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | import sys 4 | 5 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 6 | prev = '' 7 | while sys.path[0] != prev: 8 | try: 9 | import DocutilsTestSupport 10 | break 11 | except ImportError: 12 | prev = sys.path[0] 13 | sys.path[0] = os.path.dirname(prev) 14 | sys.path.pop(0) 15 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import os.path 3 | import sys 4 | 5 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 6 | prev = '' 7 | while sys.path[0] != prev: 8 | try: 9 | import DocutilsTestSupport 10 | break 11 | except ImportError: 12 | prev = sys.path[0] 13 | sys.path[0] = os.path.dirname(prev) 14 | sys.path.pop(0) 15 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isogrk4.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |b.Gammad| unicode:: U+003DC .. GREEK LETTER DIGAMMA 8 | .. |b.gammad| unicode:: U+003DD .. GREEK SMALL LETTER DIGAMMA 9 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_latex.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "standalone_rst_latex.txt" 5 | test_destination = "standalone_rst_latex.tex" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "latex" 9 | 10 | # Settings 11 | # use "smartquotes" transition: 12 | settings_overrides['smart_quotes'] = True 13 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_xetex.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "standalone_rst_xetex.txt" 5 | test_destination = "standalone_rst_xetex.tex" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "xetex" 9 | 10 | # Settings 11 | # use "smartquotes" transition: 12 | settings_overrides['smart_quotes'] = True 13 | -------------------------------------------------------------------------------- /test/docutils.conf: -------------------------------------------------------------------------------- 1 | [general] 2 | # This tests the test framework; this config file should *not* be read 3 | # when testing. 4 | source-link: yes 5 | datestamp: %Y-%m-%d %H:%M UTC (If you see this in test output, there's a bug in the test code!) 6 | generator: on 7 | 8 | [buildhtml application] 9 | # This part is not for testing, but to prevent tools/buildhtml.py from 10 | # processing text files in and below this directory. 11 | prune: . 12 | -------------------------------------------------------------------------------- /test/functional/tests/compact_lists.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "compact_lists.txt" 3 | test_destination = "compact_lists.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html" 9 | 10 | # Settings 11 | # local copy of default stylesheet: 12 | settings_overrides['stylesheet_path'] = ( 13 | 'functional/input/data/html4css1.css') 14 | -------------------------------------------------------------------------------- /test/functional/input/dangerous.txt: -------------------------------------------------------------------------------- 1 | Potentially dangerous features (security holes): 2 | 3 | .. include:: /etc/passwd 4 | .. raw:: html 5 | :file: /etc/passwd 6 | .. raw:: html 7 | :url: file:///etc/passwd 8 | .. raw:: html 9 | 10 | 13 | .. csv-table:: :file: /etc/passwd 14 | .. csv-table:: :url: file:///etc/passwd 15 | .. figure:: picture.png 16 | :figwidth: image 17 | -------------------------------------------------------------------------------- /test/functional/tests/latex_literal_block.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_literal_block.txt" 3 | test_destination = "latex_literal_block.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | # settings_overrides['literal_block_env'] = 'verbatim' 12 | settings_overrides['syntax_highlight'] = 'none' 13 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_pseudoxml.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "standalone_rst_pseudoxml.txt" 5 | test_destination = "standalone_rst_pseudoxml.txt" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "pseudoxml" 9 | 10 | # Settings 11 | # enable INFO-level system messages in this test: 12 | settings_overrides['report_level'] = 1 13 | -------------------------------------------------------------------------------- /test/functional/tests/latex_literal_block_fancyvrb.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_literal_block.txt" 3 | test_destination = "latex_literal_block_fancyvrb.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | settings_overrides['literal_block_env'] = 'Verbatim' 12 | settings_overrides['syntax_highlight'] = 'none' 13 | -------------------------------------------------------------------------------- /test/functional/tests/latex_literal_block_verbatim.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_literal_block.txt" 3 | test_destination = "latex_literal_block_verbatim.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | settings_overrides['literal_block_env'] = 'verbatim' 12 | settings_overrides['syntax_highlight'] = 'none' 13 | -------------------------------------------------------------------------------- /test/functional/tests/latex_literal_block_verbatimtab.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_literal_block.txt" 3 | test_destination = "latex_literal_block_verbatimtab.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | settings_overrides['literal_block_env'] = 'verbatimtab' 12 | settings_overrides['syntax_highlight'] = 'none' 13 | -------------------------------------------------------------------------------- /test/functional/input/data/nonalphanumeric.txt: -------------------------------------------------------------------------------- 1 | Monospaced non-alphanumeric characters 2 | -------------------------------------- 3 | 4 | These are all ASCII characters except a-zA-Z0-9 and space: 5 | 6 | ``!!!"""###$$$%%%&&&'''((()))***+++,,,---...///:::`` 7 | 8 | ``;;;<<<===>>>???@@@[[[\\\]]]^^^___```{{{|||}}}~~~`` 9 | 10 | ``xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`` 11 | 12 | The two lines of non-alphanumeric characters should both have the same 13 | width as the third line. 14 | -------------------------------------------------------------------------------- /test/functional/tests/math_output_latex.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "data/math.txt" 3 | test_destination = "math_output_latex.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html" 9 | 10 | # Settings 11 | settings_overrides['math_output'] = 'latex' 12 | # local copy of default stylesheet: 13 | settings_overrides['stylesheet_path'] = ( 14 | 'functional/input/data/html4css1.css') 15 | 16 | 17 | -------------------------------------------------------------------------------- /docutils/writers/latex2e/default.tex: -------------------------------------------------------------------------------- 1 | $head_prefix% generated by Docutils 2 | \usepackage{cmap} % fix search and cut-and-paste in Acrobat 3 | $requirements 4 | %%% Custom LaTeX preamble 5 | $latex_preamble 6 | %%% User specified packages and stylesheets 7 | $stylesheet 8 | %%% Fallback definitions for Docutils-specific commands 9 | $fallbacks 10 | $pdfsetup 11 | %%% Body 12 | \begin{document} 13 | $titledata$body_pre_docinfo$docinfo$dedication$abstract$body 14 | \end{document} 15 | -------------------------------------------------------------------------------- /test/functional/tests/misc_rst_html4css1.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "link_in_substitution.txt" 3 | test_destination = "misc_rst_html4css1.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html4css1" 9 | 10 | # Settings 11 | # test for encoded attribute value: 12 | settings_overrides['stylesheet'] = 'foo&bar.css' 13 | settings_overrides['stylesheet_path'] = '' 14 | settings_overrides['embed_stylesheet'] = False 15 | -------------------------------------------------------------------------------- /test/data/config_1.txt: -------------------------------------------------------------------------------- 1 | # Test config file (new format) 2 | 3 | [general] 4 | 5 | source-link: on 6 | datestamp: %Y-%m-%d %H:%M UTC 7 | generator: true 8 | raw-enabled: off 9 | 10 | [restructuredtext parser] 11 | 12 | trim-footnote-reference-space: 1 13 | tab-width = 8 14 | 15 | 16 | [html4css1 writer] 17 | 18 | stylesheet-path: stylesheets/default.css 19 | 20 | 21 | [pep_html writer] 22 | 23 | template: pep-html-template 24 | stylesheet-path: stylesheets/pep.css 25 | python-home: http://www.python.org 26 | no-random: yes 27 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/s5-core.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* Do not edit or override these styles! 3 | The system will likely break if you do. */ 4 | 5 | div#header, div#footer, div#controls, .slide {position: absolute;} 6 | html>body div#header, html>body div#footer, 7 | html>body div#controls, html>body .slide {position: fixed;} 8 | .handout {display: none;} 9 | .layout {display: block;} 10 | .slide, .hideme, .incremental {visibility: hidden;} 11 | #slide0 {visibility: visible;} 12 | -------------------------------------------------------------------------------- /test/functional/expected/ui/default/s5-core.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* Do not edit or override these styles! 3 | The system will likely break if you do. */ 4 | 5 | div#header, div#footer, div#controls, .slide {position: absolute;} 6 | html>body div#header, html>body div#footer, 7 | html>body div#controls, html>body .slide {position: fixed;} 8 | .handout {display: none;} 9 | .layout {display: block;} 10 | .slide, .hideme, .incremental {visibility: hidden;} 11 | #slide0 {visibility: visible;} 12 | -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/s5-core.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* Do not edit or override these styles! 3 | The system will likely break if you do. */ 4 | 5 | div#header, div#footer, div#controls, .slide {position: absolute;} 6 | html>body div#header, html>body div#footer, 7 | html>body div#controls, html>body .slide {position: fixed;} 8 | .handout {display: none;} 9 | .layout {display: block;} 10 | .slide, .hideme, .incremental {visibility: hidden;} 11 | #slide0 {visibility: visible;} 12 | -------------------------------------------------------------------------------- /test/functional/tests/dangerous.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "dangerous.txt" 3 | test_destination = "dangerous.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html" 9 | 10 | # Settings 11 | settings_overrides['file_insertion_enabled'] = False 12 | settings_overrides['raw_enabled'] = False 13 | # local copy of default stylesheet: 14 | settings_overrides['stylesheet_path'] = ( 15 | 'functional/input/data/html4css1.css') 16 | -------------------------------------------------------------------------------- /test/functional/tests/math_output_html.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "data/math.txt" 3 | test_destination = "math_output_html.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html" 9 | 10 | # Extra settings 11 | settings_overrides['math_output'] = 'HTML' 12 | # stylesheets: 13 | settings_overrides['stylesheet_path'] = ( 14 | 'functional/input/data/html4css1.css,' 15 | 'functional/input/data/math.css') 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/functional/tests/math_output_mathjax.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "data/math.txt" 3 | test_destination = "math_output_mathjax.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html" 9 | 10 | # Settings 11 | settings_overrides['math_output'] = 'MathJax /usr/share/javascript/mathjax/MathJax.js' 12 | # local copy of default stylesheet: 13 | settings_overrides['stylesheet_path'] = ( 14 | 'functional/input/data/html4css1.css') 15 | -------------------------------------------------------------------------------- /docutils/parsers/null.py: -------------------------------------------------------------------------------- 1 | # $Id: null.py 4564 2006-05-21 20:44:42Z wiemann $ 2 | # Author: Martin Blais 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """A do-nothing parser.""" 6 | 7 | from docutils import parsers 8 | 9 | 10 | class Parser(parsers.Parser): 11 | 12 | """A do-nothing parser.""" 13 | 14 | supported = ('null',) 15 | 16 | config_section = 'null parser' 17 | config_section_dependencies = ('parsers',) 18 | 19 | def parse(self, inputstring, document): 20 | pass 21 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_html4css1.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "standalone_rst_html4css1.txt" 5 | test_destination = "standalone_rst_html4css1.html" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "html4css1" 9 | 10 | # Settings: 11 | # local copy of stylesheets: 12 | # (Test runs in ``docutils/test/``, we need relative path from there.) 13 | settings_overrides['stylesheet_dirs'] = ('.', 'functional/input/data') 14 | -------------------------------------------------------------------------------- /test/functional/tests/field_name_limit.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "field_list.txt" 3 | test_destination = "field_name_limit.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html" 9 | 10 | # Settings 11 | settings_overrides['field_name_limit'] = 0 # no limit 12 | settings_overrides['docinfo_xform'] = False 13 | # local copy of default stylesheet: 14 | settings_overrides['stylesheet_path'] = ( 15 | 'functional/input/data/html4css1.css') 16 | -------------------------------------------------------------------------------- /test/functional/tests/math_output_mathml.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "data/math.txt" 3 | test_destination = "math_output_mathml.xhtml" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "html5" 9 | 10 | # Settings 11 | settings_overrides['math_output'] = 'MathML' 12 | # local copy of default stylesheet: 13 | # (test runs in ``docutils/test/``, we need relative path from there.) 14 | settings_overrides['stylesheet_dirs'] = ('.','functional/input/data') 15 | -------------------------------------------------------------------------------- /docutils/writers/null.py: -------------------------------------------------------------------------------- 1 | # $Id: null.py 4564 2006-05-21 20:44:42Z wiemann $ 2 | # Author: David Goodger 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """ 6 | A do-nothing Writer. 7 | """ 8 | 9 | from docutils import writers 10 | 11 | 12 | class Writer(writers.UnfilteredWriter): 13 | 14 | supported = ('null',) 15 | """Formats this writer supports.""" 16 | 17 | config_section = 'null writer' 18 | config_section_dependencies = ('writers',) 19 | 20 | def translate(self): 21 | pass 22 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_docutils_xml.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "standalone_rst_docutils_xml.txt" 5 | test_destination = "standalone_rst_docutils_xml.xml" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "docutils_xml" 9 | 10 | # Settings 11 | # enable INFO-level system messages in this test: 12 | settings_overrides['report_level'] = 1 13 | 14 | # format output with indents and newlines 15 | settings_overrides['indents'] = True 16 | -------------------------------------------------------------------------------- /test/functional/tests/footnotes_html5.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "footnotes.txt" 5 | test_destination = "footnotes_html5.html" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "html5" 9 | 10 | # Settings: 11 | settings_overrides['footnote_references']='superscript' 12 | # local copy of stylesheets: 13 | # (Test runs in ``docutils/test/``, we need relative path from there.) 14 | settings_overrides['stylesheet_dirs'] = ('.', 'functional/input/data') 15 | -------------------------------------------------------------------------------- /test/functional/input/data/option_lists.txt: -------------------------------------------------------------------------------- 1 | .. This file is used by the standalone_rst_latex test. 2 | 3 | Option lists 4 | ------------ 5 | 6 | The LaTeX-2e description environment is used for definition lists. 7 | The definition is continued on the same line as the term, this should 8 | not happen if a option-list is at the top of the definition. 9 | 10 | If the option list is not at the first element in the definition, it 11 | is contained in a quote 12 | 13 | --help show help 14 | -v verbose 15 | 16 | In a definition list: 17 | --help show help 18 | -v verbose 19 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isomfrk.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |Cfr| unicode:: U+0212D .. BLACK-LETTER CAPITAL C 8 | .. |Hfr| unicode:: U+0210C .. BLACK-LETTER CAPITAL H 9 | .. |Ifr| unicode:: U+02111 .. BLACK-LETTER CAPITAL I 10 | .. |Rfr| unicode:: U+0211C .. BLACK-LETTER CAPITAL R 11 | .. |Zfr| unicode:: U+02128 .. BLACK-LETTER CAPITAL Z 12 | -------------------------------------------------------------------------------- /test/functional/tests/standalone_rst_html5.py: -------------------------------------------------------------------------------- 1 | exec(open('functional/tests/_standalone_rst_defaults.py').read()) 2 | 3 | # Source and destination file names. 4 | test_source = "standalone_rst_html5.txt" 5 | test_destination = "standalone_rst_html5.html" 6 | 7 | # Keyword parameters passed to publish_file. 8 | writer_name = "html5" 9 | 10 | # Settings: 11 | # "smart" quotes: 12 | # settings_overrides['smart_quotes']='yes' 13 | # local copy of stylesheets: 14 | # (Test runs in ``docutils/test/``, we need relative path from there.) 15 | settings_overrides['stylesheet_dirs'] = ('.', 'functional/input/data') 16 | -------------------------------------------------------------------------------- /test/local-reader.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # $Id: local-reader.py 7504 2012-08-27 07:55:20Z grubert $ 3 | # Authors: Engelbert Gruber 4 | # Toshio Kuratomi 5 | # Copyright: This module is put into the public domain. 6 | 7 | """ 8 | mini-reader to test get_reader_class with local reader 9 | """ 10 | 11 | import docutils 12 | from docutils import readers 13 | 14 | class Reader(readers.Reader): 15 | 16 | supported = ('dummy',) 17 | """Formats this reader supports.""" 18 | 19 | document = None 20 | """A document tree.""" 21 | -------------------------------------------------------------------------------- /test/functional/tests/latex_cyrillic.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "cyrillic.txt" 3 | test_destination = "cyrillic.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | 12 | settings_overrides['hyperref_options'] = 'unicode=true' 13 | settings_overrides['font_encoding'] = 'T1,T2A' 14 | settings_overrides['stylesheet'] = 'cmlgc' 15 | settings_overrides['language_code'] = 'ru' 16 | 17 | # use "smartquotes" transition: 18 | settings_overrides['smart_quotes'] = True 19 | -------------------------------------------------------------------------------- /test/functional/input/data/section_titles.txt: -------------------------------------------------------------------------------- 1 | Section titles with `inline markup`_ 2 | ------------------------------------ 3 | 4 | *emphasized*, H\ :sub:`2`\ O and :math:`x^2` 5 | ```````````````````````````````````````````` 6 | Substitutions |fail| 7 | ```````````````````` 8 | .. |fail| replace:: work 9 | 10 | Deeply nested sections 11 | ---------------------- 12 | In LaTeX and HTML, 13 | 14 | Level 3 15 | ``````` 16 | nested sections 17 | 18 | level 4 19 | ^^^^^^^ 20 | reach at some level 21 | 22 | level 5 23 | ::::::: 24 | (depending on the document class) 25 | 26 | level 6 27 | +++++++ 28 | an unsupported level. 29 | -------------------------------------------------------------------------------- /test/functional/tests/xetex_cyrillic.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "cyrillic.txt" 3 | test_destination = "xetex-cyrillic.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | writer_name = "xetex" 7 | 8 | # Settings 9 | settings_overrides['language_code'] = 'ru' 10 | # Override the automatic addition of "unicode" option for "russian" 11 | # language to work around a problem with cyrillic in PDF-bookmarks in 12 | # hyperref versions < v6.79g 2009/11/20 13 | settings_overrides['hyperref_options'] = 'unicode=false' 14 | # use "smartquotes" transition: 15 | settings_overrides['smart_quotes'] = True 16 | -------------------------------------------------------------------------------- /docutils/writers/latex2e/titlepage.tex: -------------------------------------------------------------------------------- 1 | % generated by Docutils 2 | $head_prefix 3 | \usepackage{fixltx2e} % LaTeX patches, \textsubscript 4 | \usepackage{cmap} % fix search and cut-and-paste in Acrobat 5 | $requirements 6 | %%% Custom LaTeX preamble 7 | $latex_preamble 8 | %%% User specified packages and stylesheets 9 | $stylesheet 10 | %%% Fallback definitions for Docutils-specific commands 11 | $fallbacks$pdfsetup 12 | $titledata 13 | %%% Body 14 | \begin{document} 15 | \begin{titlepage} 16 | $body_pre_docinfo$docinfo$dedication$abstract 17 | \thispagestyle{empty} 18 | \end{titlepage} 19 | $body 20 | \end{document} 21 | -------------------------------------------------------------------------------- /test/functional/tests/pep_html.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "pep_html.txt" 3 | test_destination = "pep_html.html" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "pep" 7 | parser_name = "rst" 8 | writer_name = "pep_html" 9 | 10 | # Settings 11 | settings_overrides['python_home'] = "http://www.python.org" 12 | settings_overrides['pep_home'] = "http://www.python.org/peps" 13 | settings_overrides['no_random'] = 1 14 | settings_overrides['cloak_email_addresses'] = 1 15 | # local copy of default stylesheet: 16 | settings_overrides['stylesheet_path'] = ( 17 | 'functional/input/data/html4css1.css') 18 | -------------------------------------------------------------------------------- /tools/editors/emacs/tests/README.txt: -------------------------------------------------------------------------------- 1 | ==================== 2 | Tests for rst.el 3 | ==================== 4 | 5 | :Author: Martin Blais , Stefan Merten 6 | 7 | The tests are using ERT_. You need to install ERT_ for to run them. If 8 | you did you should change the path to the library contained in the 9 | variable `ERT` in `Makefile`. 10 | 11 | To run the tests in Emacs use the facilities provided by ERT_. Namely 12 | evaluate the buffer containing the tests and do:: 13 | 14 | M-x ert [RETURN] [RETURN] 15 | 16 | To run the tests by `make` use :: 17 | 18 | make ert-tests 19 | 20 | .. _ERT: http://www.emacswiki.org/emacs/ErtTestLibrary 21 | -------------------------------------------------------------------------------- /test/functional/input/footnotes.txt: -------------------------------------------------------------------------------- 1 | Test footnote and citation rendering 2 | ************************************ 3 | 4 | Paragraphs may contain footnote references (manually numbered 5 | [1]_, anonymous auto-numbered [#]_, labeled auto-numbered [#label]_, or 6 | symbolic [*]_) or citation references ([CIT2002]_, [DU2015]_). 7 | 8 | .. include:: data/standard.txt 9 | :start-after: Footnotes 10 | --------- 11 | :end-before: Here's a reference to the above, [CIT2002]_, 12 | 13 | .. [DU2015] `Example document`, Hometown: 2015. 14 | 15 | Here's a reference to the above, [CIT2002]_. 16 | 17 | .. [5] this footnote is missing in the standard example document. 18 | -------------------------------------------------------------------------------- /test/test_writers/test_null.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: test_null.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Test for Null writer. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.PublishTestSuite('null') 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['basic'] = [ 21 | ["""\ 22 | This is a paragraph. 23 | """, 24 | None] 25 | ] 26 | 27 | if __name__ == '__main__': 28 | import unittest 29 | unittest.main(defaultTest='suite') 30 | -------------------------------------------------------------------------------- /test/local-parser.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # $Id: local-parser.py 7504 2012-08-27 07:55:20Z grubert $ 3 | # Authors: Engelbert Gruber 4 | # Toshio Kuratomi 5 | # Copyright: This module is put into the public domain. 6 | 7 | """ 8 | mini-reader to test get_reader_class with local reader 9 | """ 10 | 11 | from docutils import parsers 12 | 13 | class Parser(parsers.Parser): 14 | 15 | supported = ('dummy',) 16 | """Formats this reader supports.""" 17 | 18 | def parser(self, inputstring, document): 19 | self.setup_parse(inputstring, document) 20 | document = dict() 21 | self.finish_parse() 22 | -------------------------------------------------------------------------------- /test/functional/input/link_in_substitution.txt: -------------------------------------------------------------------------------- 1 | Test the interaction of transforms.references.Substitutions and 2 | transforms.references.ExternalLinks. 3 | 4 | |rest| is cool! 5 | 6 | .. |rest| replace:: reStructuredText_ 7 | 8 | .. _reStructuredText: http://docutils.sourceforge.net/rst.html 9 | 10 | There is a preferred alternative: 11 | 12 | |rst|_ is cool! 13 | 14 | .. |rst| replace:: reStructuredText 15 | .. _rst: http://docutils.sourceforge.net/rst.html 16 | 17 | This only works for the case where the entire substitution is a 18 | reference, not when the reference is embedded as part of the 19 | substitution: 20 | 21 | |urst| is uncool! 22 | 23 | .. |urst| replace:: unstructured reStructuredText_ 24 | -------------------------------------------------------------------------------- /tools/rst2html.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing HTML. 9 | """ 10 | 11 | try: 12 | import locale 13 | locale.setlocale(locale.LC_ALL, '') 14 | except: 15 | pass 16 | 17 | from docutils.core import publish_cmdline, default_description 18 | 19 | 20 | description = ('Generates (X)HTML documents from standalone reStructuredText ' 21 | 'sources. ' + default_description) 22 | 23 | publish_cmdline(writer_name='html', description=description) 24 | -------------------------------------------------------------------------------- /tools/rst2xml.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing Docutils XML. 9 | """ 10 | 11 | try: 12 | import locale 13 | locale.setlocale(locale.LC_ALL, '') 14 | except: 15 | pass 16 | 17 | from docutils.core import publish_cmdline, default_description 18 | 19 | 20 | description = ('Generates Docutils-native XML from standalone ' 21 | 'reStructuredText sources. ' + default_description) 22 | 23 | publish_cmdline(writer_name='xml', description=description) 24 | -------------------------------------------------------------------------------- /tools/rst2pseudoxml.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2pseudoxml.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing pseudo-XML. 9 | """ 10 | 11 | try: 12 | import locale 13 | locale.setlocale(locale.LC_ALL, '') 14 | except: 15 | pass 16 | 17 | from docutils.core import publish_cmdline, default_description 18 | 19 | 20 | description = ('Generates pseudo-XML from standalone reStructuredText ' 21 | 'sources (for testing purposes). ' + default_description) 22 | 23 | publish_cmdline(description=description) 24 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isomopf.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |Copf| unicode:: U+02102 .. DOUBLE-STRUCK CAPITAL C 8 | .. |Hopf| unicode:: U+0210D .. DOUBLE-STRUCK CAPITAL H 9 | .. |Nopf| unicode:: U+02115 .. DOUBLE-STRUCK CAPITAL N 10 | .. |Popf| unicode:: U+02119 .. DOUBLE-STRUCK CAPITAL P 11 | .. |Qopf| unicode:: U+0211A .. DOUBLE-STRUCK CAPITAL Q 12 | .. |Ropf| unicode:: U+0211D .. DOUBLE-STRUCK CAPITAL R 13 | .. |Zopf| unicode:: U+02124 .. DOUBLE-STRUCK CAPITAL Z 14 | -------------------------------------------------------------------------------- /test/functional/input/pep_html.txt: -------------------------------------------------------------------------------- 1 | PEP: 100 2 | Title: Test PEP 3 | Version: 42 4 | Last-Modified: A long time ago. 5 | Author: John Doe 6 | Discussions-To: 7 | Status: Draft 8 | Type: Standards Track 9 | Content-Type: text/x-rst 10 | Created: 01-Jun-2001 11 | Post-History: 13-Jun-2001 12 | 13 | 14 | Abstract 15 | ======== 16 | 17 | This is just a test [#]_. See the `PEP repository`_ for the real 18 | thing. 19 | 20 | .. _PEP repository: http://www.python.org/peps/ 21 | 22 | 23 | Copyright 24 | ========= 25 | 26 | This document has been placed in the public domain. 27 | 28 | 29 | References and Footnotes 30 | ======================== 31 | 32 | .. [#] PEP editors: peps@python.org 33 | -------------------------------------------------------------------------------- /tools/rst2man.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Author: 4 | # Contact: grubert@users.sf.net 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | man.py 9 | ====== 10 | 11 | This module provides a simple command line interface that uses the 12 | man page writer to output from ReStructuredText source. 13 | """ 14 | 15 | import locale 16 | try: 17 | locale.setlocale(locale.LC_ALL, '') 18 | except: 19 | pass 20 | 21 | from docutils.core import publish_cmdline, default_description 22 | from docutils.writers import manpage 23 | 24 | description = ("Generates plain unix manual documents. " + default_description) 25 | 26 | publish_cmdline(writer=manpage.Writer(), description=description) 27 | -------------------------------------------------------------------------------- /tools/editors/emacs/tests/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env make 2 | 3 | EMACS = /usr/bin/emacs 4 | ERT = ~/lib/emacs/ert 5 | RST_EL = ../rst.el 6 | 7 | EMACS_ERT_PFX = $(EMACS) --batch --quick --directory=$(ERT) --load=ert.el 8 | EMACS_ERT_SFX = --funcall=ert-run-tests-batch-and-exit 9 | 10 | ERT_TESTS := $(filter-out ert-%,$(wildcard *.el)) 11 | 12 | EMACS_COMPILE_PFX = $(EMACS) --batch --quick --eval '(progn \ 13 | (setq byte-compile-error-on-warn t) \ 14 | (kill-emacs (if (byte-compile-file 15 | EMACS_COMPILE_SFX = ) 0 1)))' 16 | 17 | all: compile tests 18 | 19 | tests: 20 | $(EMACS_ERT_PFX) $(addprefix -l ,$(ERT_TESTS)) $(EMACS_ERT_SFX) 21 | 22 | compile: 23 | $(EMACS_COMPILE_PFX) "$(RST_EL)" $(EMACS_COMPILE_SFX) 24 | 25 | clean: 26 | -------------------------------------------------------------------------------- /test/functional/expected/ui/default/outline.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* Don't change this unless you want the layout stuff to show up in the 3 | outline view! */ 4 | 5 | .layout div, #footer *, #controlForm * {display: none;} 6 | #footer, #controls, #controlForm, #navLinks, #toggle { 7 | display: block; visibility: visible; margin: 0; padding: 0;} 8 | #toggle {float: right; padding: 0.5em;} 9 | html>body #toggle {position: fixed; top: 0; right: 0;} 10 | 11 | /* making the outline look pretty-ish */ 12 | 13 | #slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;} 14 | #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} 15 | 16 | .outline {display: inline ! important;} 17 | -------------------------------------------------------------------------------- /tools/rst2s5.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2s5.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: Chris Liechti 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing HTML slides using 9 | the S5 template system. 10 | """ 11 | 12 | try: 13 | import locale 14 | locale.setlocale(locale.LC_ALL, '') 15 | except: 16 | pass 17 | 18 | from docutils.core import publish_cmdline, default_description 19 | 20 | 21 | description = ('Generates S5 (X)HTML slideshow documents from standalone ' 22 | 'reStructuredText sources. ' + default_description) 23 | 24 | publish_cmdline(writer_name='s5', description=description) 25 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/outline.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* Don't change this unless you want the layout stuff to show up in the 3 | outline view! */ 4 | 5 | .layout div, #footer *, #controlForm * {display: none;} 6 | #footer, #controls, #controlForm, #navLinks, #toggle { 7 | display: block; visibility: visible; margin: 0; padding: 0;} 8 | #toggle {float: right; padding: 0.5em;} 9 | html>body #toggle {position: fixed; top: 0; right: 0;} 10 | 11 | /* making the outline look pretty-ish */ 12 | 13 | #slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;} 14 | #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} 15 | 16 | .outline {display: inline ! important;} 17 | -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/outline.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* Don't change this unless you want the layout stuff to show up in the 3 | outline view! */ 4 | 5 | .layout div, #footer *, #controlForm * {display: none;} 6 | #footer, #controls, #controlForm, #navLinks, #toggle { 7 | display: block; visibility: visible; margin: 0; padding: 0;} 8 | #toggle {float: right; padding: 0.5em;} 9 | html>body #toggle {position: fixed; top: 0; right: 0;} 10 | 11 | /* making the outline look pretty-ish */ 12 | 13 | #slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;} 14 | #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} 15 | 16 | .outline {display: inline ! important;} 17 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/README.txt: -------------------------------------------------------------------------------- 1 | ============================================ 2 | ``docutils/parsers/rst/include`` Directory 3 | ============================================ 4 | 5 | This directory contains standard data files intended for inclusion in 6 | reStructuredText documents. To access these files, use the "include" 7 | directive with the special syntax for standard "include" data files, 8 | angle brackets around the file name:: 9 | 10 | .. include:: 11 | 12 | See the documentation for the `"include" directive`__ and 13 | `reStructuredText Standard Substitution Definition Sets`__ for 14 | details. 15 | 16 | __ http://docutils.sf.net/docs/ref/rst/directives.html#include 17 | __ http://docutils.sf.net/docs/ref/rst/substitutions.html 18 | -------------------------------------------------------------------------------- /test/functional/input/data/table_rowspan.txt: -------------------------------------------------------------------------------- 1 | Rowspanning tables 2 | ------------------ 3 | 4 | Here's a table with cells spanning several rows: 5 | 6 | +------------------------+------------+------------------+ 7 | | Header row, column 1 | Header 2 | Header 3 | 8 | | (header rows optional) | | | 9 | +========================+============+==================+ 10 | | body row 1, column 1 | column 2 | column 3 | 11 | +------------------------+------------+------------------+ 12 | | body row 2 | Cells may | Another | 13 | +------------------------+ span rows. | rowspanning | 14 | | body row 3 | | cell. | 15 | +------------------------+------------+------------------+ 16 | -------------------------------------------------------------------------------- /test/functional/input/data/swf_images.txt: -------------------------------------------------------------------------------- 1 | SWF Images 2 | ---------- 3 | 4 | Shockwave Flash is an image/movie format that most modern web browsers 5 | support via a plugin. It is sometimes blocked due to privacy/security 6 | concerns. 7 | 8 | Images with extension ``.swf`` are placed inside elements. 9 | For complete control over display options use raw HTML. 10 | 11 | .. image:: ../../../docs/user/rst/images/biohazard.swf 12 | :alt: [biohazard.swf] 13 | :width: 4 cm 14 | :height: 2 em 15 | :align: left 16 | 17 | An SWF image in a 4 cm x 2 em box, left aligned. 18 | 19 | .. |inline-swf| image:: ../../../docs/user/rst/images/biohazard.swf 20 | :width: 0.8 em 21 | :height: 0.8 em 22 | 23 | An inline SWF image |inline-swf| scaled to 0.8 em x 0.8 em. 24 | -------------------------------------------------------------------------------- /docutils/writers/latex2e/xelatex.tex: -------------------------------------------------------------------------------- 1 | $head_prefix% generated by Docutils 2 | % rubber: set program xelatex 3 | \usepackage{fontspec} 4 | % \defaultfontfeatures{Scale=MatchLowercase} 5 | % straight double quotes (defined T1 but missing in TU): 6 | \ifdefined \UnicodeEncodingName 7 | \DeclareTextCommand{\textquotedbl}{\UnicodeEncodingName}{% 8 | {\addfontfeatures{RawFeature=-tlig,Mapping=}\char34}}% 9 | \fi 10 | $requirements 11 | %%% Custom LaTeX preamble 12 | $latex_preamble 13 | %%% User specified packages and stylesheets 14 | $stylesheet 15 | %%% Fallback definitions for Docutils-specific commands 16 | $fallbacks$pdfsetup 17 | $titledata 18 | %%% Body 19 | \begin{document} 20 | $body_pre_docinfo$docinfo$dedication$abstract$body 21 | \end{document} 22 | -------------------------------------------------------------------------------- /tools/rstpep2html.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rstpep2html.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing HTML from PEP 9 | (Python Enhancement Proposal) documents. 10 | """ 11 | 12 | try: 13 | import locale 14 | locale.setlocale(locale.LC_ALL, '') 15 | except: 16 | pass 17 | 18 | from docutils.core import publish_cmdline, default_description 19 | 20 | 21 | description = ('Generates (X)HTML from reStructuredText-format PEP files. ' 22 | + default_description) 23 | 24 | publish_cmdline(reader_name='pep', writer_name='pep_html', 25 | description=description) 26 | -------------------------------------------------------------------------------- /install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # $Id: install.py 2428 2004-07-13 15:57:13Z goodger $ 3 | # Copyright: This file has been placed in the public domain. 4 | 5 | """ 6 | This is a quick & dirty installation shortcut. It is equivalent to the 7 | command:: 8 | 9 | python setup.py install 10 | 11 | However, the shortcut lacks error checking and command-line option 12 | processing. If you need any kind of customization or help, please use 13 | one of:: 14 | 15 | python setup.py install --help 16 | python setup.py --help 17 | """ 18 | 19 | from distutils import core 20 | from setup import do_setup 21 | 22 | if __name__ == '__main__' : 23 | print __doc__ 24 | core._setup_stop_after = 'config' 25 | dist = do_setup() 26 | dist.commands = ['install'] 27 | dist.run_commands() 28 | -------------------------------------------------------------------------------- /docutils/_compat.py: -------------------------------------------------------------------------------- 1 | # $Id: _compat.py 8164 2017-08-14 11:28:48Z milde $ 2 | # Author: Georg Brandl 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """ 6 | Python 2/3 compatibility definitions. 7 | 8 | This module currently provides the following helper symbols: 9 | 10 | * u_prefix (unicode repr prefix: 'u' in 2.x, '' in 3.x) 11 | (Required in docutils/test/test_publisher.py) 12 | * BytesIO (a StringIO class that works with bytestrings) 13 | """ 14 | 15 | import sys 16 | 17 | if sys.version_info < (3,0): 18 | u_prefix = 'u' 19 | from StringIO import StringIO as BytesIO 20 | else: 21 | u_prefix = b'' 22 | # using this hack since 2to3 "fixes" the relative import 23 | # when using ``from io import BytesIO`` 24 | BytesIO = __import__('io').BytesIO 25 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_title.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_title.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the 'title' directive. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['title'] = [ 21 | ["""\ 22 | .. title:: This is the document title. 23 | """, 24 | """\ 25 | 26 | """], 27 | ] 28 | 29 | 30 | if __name__ == '__main__': 31 | import unittest 32 | unittest.main(defaultTest='suite') 33 | -------------------------------------------------------------------------------- /test/functional/tests/latex_literal_block_listings.py: -------------------------------------------------------------------------------- 1 | # Source and destination file names. 2 | test_source = "latex_literal_block.txt" 3 | test_destination = "latex_literal_block_listings.tex" 4 | 5 | # Keyword parameters passed to publish_file. 6 | reader_name = "standalone" 7 | parser_name = "rst" 8 | writer_name = "latex" 9 | 10 | # Extra setting we need 11 | settings_overrides['literal_block_env'] = 'lstlisting' 12 | settings_overrides['syntax_highlight'] = 'none' 13 | settings_overrides['latex_preamble'] = r""" 14 | % PDF Standard Fonts 15 | \usepackage{mathptmx} % Times 16 | \usepackage[scaled=.90]{helvet} 17 | \usepackage{courier} 18 | % LaTeX syntax highlight with "listings": 19 | \lstloadlanguages{[LaTeX]TeX} % comma separated list of languages 20 | \newcommand{\DUCLASSlatex}{\lstset{language=[LaTeX]TeX}} 21 | """ 22 | -------------------------------------------------------------------------------- /test/functional/input/data/list_table.txt: -------------------------------------------------------------------------------- 1 | List Tables 2 | ----------- 3 | 4 | Here's a list table exercising all features: 5 | 6 | .. list-table:: list table with integral header 7 | :class: test 8 | :width: 40em 9 | :widths: 10 20 30 10 | :header-rows: 1 11 | :stub-columns: 1 12 | 13 | * - Treat 14 | - Quantity 15 | - Description 16 | * - Albatross 17 | - 2.99 18 | - On a stick! 19 | * - Crunchy Frog 20 | - 1.49 21 | - If we took the bones out, it wouldn't be 22 | crunchy, now would it? 23 | * - Gannet Ripple 24 | - 1.99 25 | - On a stick! 26 | 27 | .. list-table:: center aligned list table 28 | :align: center 29 | :widths: auto 30 | 31 | * - Albatross 32 | - 2.99 33 | * - Crunchy Frog 34 | - 1.49 35 | * - Gannet Ripple 36 | - 1.99 37 | -------------------------------------------------------------------------------- /tools/rst2html4.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2html4.py 7994 2016-12-10 17:41:45Z milde $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing (X)HTML. 9 | 10 | The output conforms to XHTML 1.0 transitional 11 | and almost to HTML 4.01 transitional (except for closing empty tags). 12 | """ 13 | 14 | try: 15 | import locale 16 | locale.setlocale(locale.LC_ALL, '') 17 | except: 18 | pass 19 | 20 | from docutils.core import publish_cmdline, default_description 21 | 22 | 23 | description = ('Generates (X)HTML documents from standalone reStructuredText ' 24 | 'sources. ' + default_description) 25 | 26 | publish_cmdline(writer_name='html4', description=description) 27 | -------------------------------------------------------------------------------- /test/functional/input/cyrillic.txt: -------------------------------------------------------------------------------- 1 | Заголовок 2 | --------- 3 | 4 | первый пример: "Здравствуй, мир!" 5 | 6 | Title 7 | ----- 8 | 9 | .. class:: language-en 10 | 11 | first example: "Hello world". 12 | 13 | Notes 14 | ----- 15 | 16 | .. class:: language-en 17 | 18 | This example tests rendering of Latin and Cyrillic characters by the LaTeX 19 | and XeTeX writers. Check the compiled PDF for garbage characters in text and 20 | bookmarks. 21 | 22 | .. class:: language-en 23 | 24 | To work around a problem with Cyrillic in PDF-bookmarks in `hyperref` 25 | versions older than v6.79g 2009/11/20, the test caller ``latex_cyrillic.py`` 26 | sets ``hyperref_options`` to ``'unicode=true'`` while ``xetex_cyrillic.py`` 27 | sets it to ``'unicode=false'``. The recommended option for current 28 | (2011-08-24) hyperref versions is ``'pdfencoding=auto'``. 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isomscr.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |Bscr| unicode:: U+0212C .. SCRIPT CAPITAL B 8 | .. |Escr| unicode:: U+02130 .. SCRIPT CAPITAL E 9 | .. |escr| unicode:: U+0212F .. SCRIPT SMALL E 10 | .. |Fscr| unicode:: U+02131 .. SCRIPT CAPITAL F 11 | .. |gscr| unicode:: U+0210A .. SCRIPT SMALL G 12 | .. |Hscr| unicode:: U+0210B .. SCRIPT CAPITAL H 13 | .. |Iscr| unicode:: U+02110 .. SCRIPT CAPITAL I 14 | .. |Lscr| unicode:: U+02112 .. SCRIPT CAPITAL L 15 | .. |Mscr| unicode:: U+02133 .. SCRIPT CAPITAL M 16 | .. |oscr| unicode:: U+02134 .. SCRIPT SMALL O 17 | .. |Rscr| unicode:: U+0211B .. SCRIPT CAPITAL R 18 | -------------------------------------------------------------------------------- /test/functional/input/standalone_rst_html4css1.txt: -------------------------------------------------------------------------------- 1 | .. include:: data/standard.txt 2 | .. include:: data/header_footer.txt 3 | .. include:: data/table_colspan.txt 4 | .. include:: data/table_rowspan.txt 5 | .. include:: data/table_complex.txt 6 | .. include:: data/list_table.txt 7 | .. include:: data/custom_roles.txt 8 | .. include:: data/svg_images.txt 9 | .. include:: data/swf_images.txt 10 | .. include:: data/errors.txt 11 | 12 | .. footer:: |valid-xhtml10| |valid-CSS2| 13 | 14 | .. |valid-xhtml10| image:: http://www.w3.org/Icons/valid-xhtml10 15 | :height: 31 16 | :width: 88 17 | :alt: Valid XHTML 1.0! 18 | :target: http://validator.w3.org/check?uri=referer 19 | 20 | .. |valid-CSS2| image:: http://jigsaw.w3.org/css-validator/images/vcss 21 | :height: 31 22 | :width: 88 23 | :alt: Valid CSS 2.1! 24 | :target: http://jigsaw.w3.org/css-validator/check/referer 25 | -------------------------------------------------------------------------------- /test/test_pickle.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # $Id: test_pickle.py 7539 2012-11-26 13:50:06Z milde $ 3 | # Author: David Goodger 4 | # Copyright: This module has been placed in the public domain. 5 | 6 | """ 7 | Tests of document tree pickling. 8 | """ 9 | 10 | import unittest 11 | import DocutilsTestSupport # must be imported before docutils 12 | import pickle 13 | from docutils import core 14 | 15 | 16 | class PickleTests(unittest.TestCase): 17 | 18 | def test_pickle(self): 19 | doctree = core.publish_doctree( 20 | source='Title\n=====\n\nparagraph\n', 21 | settings_overrides={'_disable_config': True}) 22 | dill = pickle.dumps(doctree) 23 | reconstituted = pickle.loads(dill) 24 | self.assertEqual(doctree.pformat(), reconstituted.pformat()) 25 | 26 | 27 | if __name__ == '__main__': 28 | unittest.main() 29 | -------------------------------------------------------------------------------- /tools/rst2odt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2odt.py 5839 2009-01-07 19:09:28Z dkuhlman $ 4 | # Author: Dave Kuhlman 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A front end to the Docutils Publisher, producing OpenOffice documents. 9 | """ 10 | 11 | import sys 12 | try: 13 | import locale 14 | locale.setlocale(locale.LC_ALL, '') 15 | except: 16 | pass 17 | 18 | from docutils.core import publish_cmdline_to_binary, default_description 19 | from docutils.writers.odf_odt import Writer, Reader 20 | 21 | 22 | description = ('Generates OpenDocument/OpenOffice/ODF documents from ' 23 | 'standalone reStructuredText sources. ' + default_description) 24 | 25 | 26 | writer = Writer() 27 | reader = Reader() 28 | output = publish_cmdline_to_binary(reader=reader, writer=writer, 29 | description=description) 30 | 31 | -------------------------------------------------------------------------------- /tools/rst2latex.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2latex.py 5905 2009-04-16 12:04:49Z milde $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing LaTeX. 9 | """ 10 | 11 | try: 12 | import locale 13 | locale.setlocale(locale.LC_ALL, '') 14 | except: 15 | pass 16 | 17 | from docutils.core import publish_cmdline 18 | 19 | description = ('Generates LaTeX documents from standalone reStructuredText ' 20 | 'sources. ' 21 | 'Reads from (default is stdin) and writes to ' 22 | ' (default is stdout). See ' 23 | ' for ' 24 | 'the full reference.') 25 | 26 | publish_cmdline(writer_name='latex', description=description) 27 | -------------------------------------------------------------------------------- /docutils/writers/pseudoxml.py: -------------------------------------------------------------------------------- 1 | # $Id: pseudoxml.py 7320 2012-01-19 22:33:02Z milde $ 2 | # Author: David Goodger 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """ 6 | Simple internal document tree Writer, writes indented pseudo-XML. 7 | """ 8 | 9 | __docformat__ = 'reStructuredText' 10 | 11 | 12 | from docutils import writers 13 | 14 | 15 | class Writer(writers.Writer): 16 | 17 | supported = ('pprint', 'pformat', 'pseudoxml') 18 | """Formats this writer supports.""" 19 | 20 | config_section = 'pseudoxml writer' 21 | config_section_dependencies = ('writers',) 22 | 23 | output = None 24 | """Final translated form of `document`.""" 25 | 26 | def translate(self): 27 | self.output = self.document.pformat() 28 | 29 | def supports(self, format): 30 | """This writer supports all format-specific elements.""" 31 | return True 32 | -------------------------------------------------------------------------------- /test/functional/input/data/hyperlinking.txt: -------------------------------------------------------------------------------- 1 | Hyperlinks and -targets 2 | ----------------------- 3 | 4 | In LaTeX, we must set an explicit anchor (``\phantomsection``) for a 5 | _`hypertarget in plain text` or in a figure but not in a longtable or 6 | caption: 7 | 8 | .. _`table label`: 9 | 10 | .. table:: Table with _`hypertarget in table title`. 11 | 12 | ===== ===== ===== 13 | False True None 14 | ===== ===== ===== 15 | 16 | .. _`figure label`: 17 | 18 | .. figure:: ../../../docs/user/rst/images/biohazard.png 19 | 20 | Figure with _`hypertarget in figure caption`. 21 | 22 | Legend with _`hypertarget in figure legend`. 23 | 24 | .. _`image label`: 25 | 26 | .. image:: ../../../docs/user/rst/images/biohazard.png 27 | 28 | See `hypertarget in plain text`_, 29 | `table label`_, `hypertarget in table title`_, 30 | `figure label`_, `hypertarget in figure caption`_, 31 | `hypertarget in figure legend`_, and 32 | `image label`_. 33 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/print.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following rule is necessary to have all slides appear in print! 3 | DO NOT REMOVE IT! */ 4 | .slide, ul {page-break-inside: avoid; visibility: visible !important;} 5 | h1 {page-break-after: avoid;} 6 | 7 | body {font-size: 12pt; background: white;} 8 | * {color: black;} 9 | 10 | #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} 11 | #slide0 h3 {margin: 0; padding: 0;} 12 | #slide0 h4 {margin: 0 0 0.5em; padding: 0;} 13 | #slide0 {margin-bottom: 3em;} 14 | 15 | #header {display: none;} 16 | #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; 17 | font-style: italic;} 18 | #footer h2, #controls {display: none;} 19 | 20 | .print {display: inline ! important;} 21 | 22 | /* The following rule keeps the layout stuff out of print. 23 | Remove at your own risk! */ 24 | .layout, .layout * {display: none !important;} 25 | -------------------------------------------------------------------------------- /test/functional/expected/ui/default/print.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following rule is necessary to have all slides appear in print! 3 | DO NOT REMOVE IT! */ 4 | .slide, ul {page-break-inside: avoid; visibility: visible !important;} 5 | h1 {page-break-after: avoid;} 6 | 7 | body {font-size: 12pt; background: white;} 8 | * {color: black;} 9 | 10 | #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} 11 | #slide0 h3 {margin: 0; padding: 0;} 12 | #slide0 h4 {margin: 0 0 0.5em; padding: 0;} 13 | #slide0 {margin-bottom: 3em;} 14 | 15 | #header {display: none;} 16 | #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; 17 | font-style: italic;} 18 | #footer h2, #controls {display: none;} 19 | 20 | .print {display: inline ! important;} 21 | 22 | /* The following rule keeps the layout stuff out of print. 23 | Remove at your own risk! */ 24 | .layout, .layout * {display: none !important;} 25 | -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/print.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following rule is necessary to have all slides appear in print! 3 | DO NOT REMOVE IT! */ 4 | .slide, ul {page-break-inside: avoid; visibility: visible !important;} 5 | h1 {page-break-after: avoid;} 6 | 7 | body {font-size: 12pt; background: white;} 8 | * {color: black;} 9 | 10 | #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} 11 | #slide0 h3 {margin: 0; padding: 0;} 12 | #slide0 h4 {margin: 0 0 0.5em; padding: 0;} 13 | #slide0 {margin-bottom: 3em;} 14 | 15 | #header {display: none;} 16 | #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; 17 | font-style: italic;} 18 | #footer h2, #controls {display: none;} 19 | 20 | .print {display: inline ! important;} 21 | 22 | /* The following rule keeps the layout stuff out of print. 23 | Remove at your own risk! */ 24 | .layout, .layout * {display: none !important;} 25 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isodia.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |acute| unicode:: U+000B4 .. ACUTE ACCENT 8 | .. |breve| unicode:: U+002D8 .. BREVE 9 | .. |caron| unicode:: U+002C7 .. CARON 10 | .. |cedil| unicode:: U+000B8 .. CEDILLA 11 | .. |circ| unicode:: U+002C6 .. MODIFIER LETTER CIRCUMFLEX ACCENT 12 | .. |dblac| unicode:: U+002DD .. DOUBLE ACUTE ACCENT 13 | .. |die| unicode:: U+000A8 .. DIAERESIS 14 | .. |dot| unicode:: U+002D9 .. DOT ABOVE 15 | .. |grave| unicode:: U+00060 .. GRAVE ACCENT 16 | .. |macr| unicode:: U+000AF .. MACRON 17 | .. |ogon| unicode:: U+002DB .. OGONEK 18 | .. |ring| unicode:: U+002DA .. RING ABOVE 19 | .. |tilde| unicode:: U+002DC .. SMALL TILDE 20 | .. |uml| unicode:: U+000A8 .. DIAERESIS 21 | -------------------------------------------------------------------------------- /docutils/parsers/rst/directives/references.py: -------------------------------------------------------------------------------- 1 | # $Id: references.py 7062 2011-06-30 22:14:29Z milde $ 2 | # Authors: David Goodger ; Dmitry Jemerov 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """ 6 | Directives for references and targets. 7 | """ 8 | 9 | __docformat__ = 'reStructuredText' 10 | 11 | from docutils import nodes 12 | from docutils.transforms import references 13 | from docutils.parsers.rst import Directive 14 | from docutils.parsers.rst import directives 15 | 16 | 17 | class TargetNotes(Directive): 18 | 19 | """Target footnote generation.""" 20 | 21 | option_spec = {'class': directives.class_option, 22 | 'name': directives.unchanged} 23 | 24 | def run(self): 25 | pending = nodes.pending(references.TargetNotes) 26 | self.add_name(pending) 27 | pending.details.update(self.options) 28 | self.state_machine.document.note_pending(pending) 29 | return [pending] 30 | -------------------------------------------------------------------------------- /tools/rst2xetex.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2xetex.py 7847 2015-03-17 17:30:47Z milde $ 4 | # Author: Guenter Milde 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | A minimal front end to the Docutils Publisher, producing Lua/XeLaTeX code. 9 | """ 10 | 11 | try: 12 | import locale 13 | locale.setlocale(locale.LC_ALL, '') 14 | except: 15 | pass 16 | 17 | from docutils.core import publish_cmdline 18 | 19 | description = ('Generates LaTeX documents from standalone reStructuredText ' 20 | 'sources for compilation with the Unicode-aware TeX variants ' 21 | 'XeLaTeX or LuaLaTeX. ' 22 | 'Reads from (default is stdin) and writes to ' 23 | ' (default is stdout). See ' 24 | ' for ' 25 | 'the full reference.') 26 | 27 | publish_cmdline(writer_name='xetex', description=description) 28 | -------------------------------------------------------------------------------- /tools/editors/README.txt: -------------------------------------------------------------------------------- 1 | ====================================== 2 | Editor Support for reStructuredText_ 3 | ====================================== 4 | 5 | :Date: $Date: 2014-10-21 16:07:59 +0200 (Di, 21 Okt 2014) $ 6 | 7 | The files in this directory contain support code for reStructuredText 8 | editing for the following editors: 9 | 10 | * `Emacs `__: see the `README `__ and `Emacs 11 | Support for reStructuredText <../../docs/user/emacs.html>`_. 12 | 13 | External links: 14 | 15 | * `reStructuredText syntax highlighting mode for vim 16 | `__ 17 | 18 | * `VST (Vim reStructured Text) is a plugin for Vim7 with folding for 19 | reST `__ 20 | 21 | * `rst mode `__ for the `JED`_ 22 | programmers editor 23 | 24 | Additions are welcome. 25 | 26 | .. _reStructuredText: http://docutils.sf.net/rst.html 27 | .. _JED: http://www.jedsoft.org/jed/ 28 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/big-white/framing.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following styles size, place, and layer the slide components. 3 | Edit these if you want to change the overall slide layout. 4 | The commented lines can be uncommented (and modified, if necessary) 5 | to help you with the rearrangement process. */ 6 | 7 | /* target = 1024x768 */ 8 | 9 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 10 | div#footer {display:none;} 11 | .slide {top: 0; width: 92%; padding: 0.25em 4% 4%; z-index: 2;} 12 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 13 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 14 | margin: 0;} 15 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; 16 | z-index: 10;} 17 | html>body #currentSlide {position: fixed;} 18 | 19 | /* 20 | div#header {background: #FCC;} 21 | div#footer {background: #CCF;} 22 | div#controls {background: #BBD;} 23 | div#currentSlide {background: #FFC;} 24 | */ 25 | -------------------------------------------------------------------------------- /test/test_parsers/test_get_parser_class.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_get_parser_class.py 7504 2012-08-27 07:55:20Z grubert $ 4 | # Author: grubert abadger1999 5 | # Maintainer: docutils-develop@lists.sourceforge.net 6 | # Copyright: This module has been placed in the public domain. 7 | 8 | """ 9 | test get_parser_class 10 | """ 11 | 12 | from __init__ import DocutilsTestSupport 13 | from docutils.parsers import get_parser_class 14 | 15 | class GetParserClassTestCase(DocutilsTestSupport.StandardTestCase): 16 | 17 | def test_registered_parser(self): 18 | rdr = get_parser_class('rst') 19 | # raises ImportError on failure 20 | 21 | def test_bogus_parser(self): 22 | self.assertRaises(ImportError, 23 | get_parser_class, 'nope') 24 | 25 | def test_local_parser(self): 26 | # requires local-parser.py in test directory (testroot) 27 | wr = get_parser_class('local-parser') 28 | 29 | if __name__ == '__main__': 30 | import unittest 31 | unittest.main() 32 | 33 | -------------------------------------------------------------------------------- /test/test_readers/test_get_reader_class.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_get_reader_class.py 7504 2012-08-27 07:55:20Z grubert $ 4 | # Author: grubert abadger1999 5 | # Maintainer: docutils-develop@lists.sourceforge.net 6 | # Copyright: This module has been placed in the public domain. 7 | 8 | """ 9 | test get_reader_class 10 | """ 11 | 12 | from __init__ import DocutilsTestSupport 13 | from docutils.readers import get_reader_class 14 | 15 | class GetReaderClassTestCase(DocutilsTestSupport.StandardTestCase): 16 | 17 | def test_registered_reader(self): 18 | rdr = get_reader_class('pep') 19 | # raises ImportError on failure 20 | 21 | def test_bogus_reader(self): 22 | self.assertRaises(ImportError, 23 | get_reader_class, 'nope') 24 | 25 | def test_local_reader(self): 26 | # requires local-reader.py in test directory (testroot) 27 | wr = get_reader_class('local-reader') 28 | 29 | if __name__ == '__main__': 30 | import unittest 31 | unittest.main() 32 | 33 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/big-black/framing.css: -------------------------------------------------------------------------------- 1 | /* The following styles size, place, and layer the slide components. 2 | Edit these if you want to change the overall slide layout. 3 | The commented lines can be uncommented (and modified, if necessary) 4 | to help you with the rearrangement process. */ 5 | 6 | /* target = 1024x768 */ 7 | 8 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 9 | div#header {top: 0; z-index: 1;} 10 | div#footer {display:none;} 11 | .slide {top: 0; width: 92%; padding: 0.1em 4% 4%; z-index: 2;} 12 | /* list-style: none;} */ 13 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 14 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 15 | margin: 0;} 16 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; 17 | z-index: 10;} 18 | html>body #currentSlide {position: fixed;} 19 | 20 | /* 21 | div#header {background: #FCC;} 22 | div#footer {background: #CCF;} 23 | div#controls {background: #BBD;} 24 | div#currentSlide {background: #FFC;} 25 | */ 26 | -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/framing.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following styles size, place, and layer the slide components. 3 | Edit these if you want to change the overall slide layout. 4 | The commented lines can be uncommented (and modified, if necessary) 5 | to help you with the rearrangement process. */ 6 | 7 | /* target = 1024x768 */ 8 | 9 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 10 | div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} 11 | .slide {top: 0; width: 92%; padding: 1em 4% 0 4%; z-index: 2;} 12 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 13 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 14 | margin: 0;} 15 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; 16 | z-index: 10;} 17 | html>body #currentSlide {position: fixed;} 18 | 19 | /* 20 | div#header {background: #FCC;} 21 | div#footer {background: #CCF;} 22 | div#controls {background: #BBD;} 23 | div#currentSlide {background: #FFC;} 24 | */ 25 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/small-white/framing.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following styles size, place, and layer the slide components. 3 | Edit these if you want to change the overall slide layout. 4 | The commented lines can be uncommented (and modified, if necessary) 5 | to help you with the rearrangement process. */ 6 | 7 | /* target = 1024x768 */ 8 | 9 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 10 | div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} 11 | .slide {top: 0; width: 92%; padding: 1em 4% 0 4%; z-index: 2;} 12 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 13 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 14 | margin: 0;} 15 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; 16 | z-index: 10;} 17 | html>body #currentSlide {position: fixed;} 18 | 19 | /* 20 | div#header {background: #FCC;} 21 | div#footer {background: #CCF;} 22 | div#controls {background: #BBD;} 23 | div#currentSlide {background: #FFC;} 24 | */ 25 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/medium-white/framing.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following styles size, place, and layer the slide components. 3 | Edit these if you want to change the overall slide layout. 4 | The commented lines can be uncommented (and modified, if necessary) 5 | to help you with the rearrangement process. */ 6 | 7 | /* target = 1024x768 */ 8 | 9 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 10 | div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} 11 | .slide {top: 0; width: 92%; padding: 0.75em 4% 0 4%; z-index: 2;} 12 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 13 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 14 | margin: 0;} 15 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; 16 | z-index: 10;} 17 | html>body #currentSlide {position: fixed;} 18 | 19 | /* 20 | div#header {background: #FCC;} 21 | div#footer {background: #CCF;} 22 | div#controls {background: #BBD;} 23 | div#currentSlide {background: #FFC;} 24 | */ 25 | -------------------------------------------------------------------------------- /test/data/dependencies.txt: -------------------------------------------------------------------------------- 1 | Test input for test_dependencies. 2 | 3 | Docutils can write a list of files required to generate the output like 4 | included files or embedded stylesheets. This is particularly useful in 5 | conjunction with programs like ``make``. 6 | 7 | Included files are recorded: 8 | 9 | .. include:: include.txt 10 | 11 | .. raw:: HTML 12 | :file: raw.txt 13 | 14 | Dependencies are recorded only once: 15 | 16 | .. include:: include.txt 17 | 18 | Image files are only recorded, if actually accessed 19 | (to extract the size or if embedded in the output document): 20 | 21 | .. image:: test.jpg 22 | 23 | .. figure:: ../docs/user/rst/images/title.png 24 | :figwidth: image 25 | 26 | Scaled images without given size are recorded by the html writer: 27 | 28 | .. image:: ../docs/user/rst/images/biohazard.png 29 | :scale: 50 % 30 | 31 | TODO: Paths in included files should be rewritten relative to the base 32 | document. 33 | 34 | * when loading images, 35 | * when recording dependencies. 36 | 37 | .. include: subdir/dependencies-included.txt 38 | -------------------------------------------------------------------------------- /test/functional/input/compact_lists.txt: -------------------------------------------------------------------------------- 1 | * This is an ordinary simple bullet list. 2 | * It should be made compact (

&

tags omitted). 3 | 4 | ********** 5 | 6 | * This is a bullet list that is not simple. 7 | 8 | There are multiple paragraphs in some items. 9 | 10 | * It should not be made compact. 11 | 12 | * Even though some items may have only one paragraph. 13 | 14 | ********** 15 | 16 | .. class:: open 17 | 18 | * This is a simple bullet list, but class="open" is set. 19 | * It should not be made compact. 20 | 21 | ********** 22 | 23 | .. class:: compact 24 | 25 | * This is a bullet list that is not simple. 26 | 27 | There are multiple paragraphs in some items. 28 | 29 | * However, the class="compact" setting will cause 30 | all first paragraph's

&

tags to be omitted. 31 | 32 | * Items with multiple paragraphs will not appear changed. 33 | 34 | * Items may have one paragraph, or multiple. 35 | 36 | Items with multiple paragraphs will still be followed 37 | by vertical whitespace because of the later paragraphs. 38 | 39 | * The effect is interesting. 40 | -------------------------------------------------------------------------------- /test/test_transforms/test_filter.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_filter.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for docutils.transforms.components.Filter. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | from docutils.parsers.rst import Parser 13 | 14 | 15 | def suite(): 16 | parser = Parser() 17 | s = DocutilsTestSupport.TransformTestSuite(parser) 18 | s.generateTests(totest) 19 | return s 20 | 21 | totest = {} 22 | 23 | totest['meta'] = ((), [ 24 | ["""\ 25 | .. meta:: 26 | :description: The reStructuredText plaintext markup language 27 | :keywords: plaintext,markup language 28 | """, 29 | """\ 30 | 31 | 32 | 33 | """], 34 | ]) 35 | 36 | 37 | if __name__ == '__main__': 38 | import unittest 39 | unittest.main(defaultTest='suite') 40 | -------------------------------------------------------------------------------- /test/test_writers/test_get_writer_class.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_get_writer_class.py 7660 2013-05-07 09:01:00Z milde $ 4 | # Author: grubert 5 | # Maintainer: docutils-develop@lists.sourceforge.net 6 | # Copyright: This module has been placed in the public domain. 7 | 8 | """ 9 | test get_writer_class 10 | """ 11 | 12 | from __init__ import DocutilsTestSupport 13 | from docutils.writers import get_writer_class 14 | 15 | class GetWriterClassTestCase(DocutilsTestSupport.StandardTestCase): 16 | #tests = ( ('manpage', 1), ('nope', 0), ('dummy-writer', 1)) 17 | 18 | def test_registered_writer(self): 19 | wr = get_writer_class('manpage') 20 | # raises ImportError on failure 21 | 22 | def test_bogus_writer(self): 23 | self.assertRaises(ImportError, 24 | get_writer_class, 'nope') 25 | 26 | def test_local_writer(self): 27 | # requires local-writer.py in test directory (testroot) 28 | wr = get_writer_class('local-writer') 29 | 30 | if __name__ == '__main__': 31 | import unittest 32 | unittest.main() 33 | 34 | -------------------------------------------------------------------------------- /tools/dev/profile_docutils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -i 2 | 3 | # $Id: profile_docutils.py 7442 2012-06-13 23:27:03Z milde $ 4 | # Author: Lea Wiemann 5 | # Copyright: This script has been placed in the public domain. 6 | 7 | import os.path 8 | import docutils.core 9 | import hotshot.stats 10 | 11 | print('Profiler started.') 12 | 13 | os.chdir(os.path.join(os.path.dirname(docutils.__file__), '..')) 14 | 15 | print('Profiling...') 16 | 17 | prof = hotshot.Profile('docutils.prof') 18 | prof.runcall(docutils.core.publish_file, source_path='HISTORY.txt', 19 | destination_path='prof.HISTORY.html', writer_name='html') 20 | prof.close() 21 | 22 | print('Loading statistics...') 23 | 24 | print(""" 25 | stats = hotshot.stats.load('docutils.prof') 26 | stats.strip_dirs() 27 | stats.sort_stats('time') # 'cumulative'; 'calls' 28 | stats.print_stats(40) 29 | """) 30 | 31 | stats = hotshot.stats.load('docutils.prof') 32 | stats.strip_dirs() 33 | stats.sort_stats('time') 34 | stats.print_stats(40) 35 | 36 | try: 37 | exec(open(os.environ['PYTHONSTARTUP']).read()) 38 | except: 39 | pass 40 | -------------------------------------------------------------------------------- /test/functional/expected/ui/default/framing.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following styles size, place, and layer the slide components. 3 | Edit these if you want to change the overall slide layout. 4 | The commented lines can be uncommented (and modified, if necessary) 5 | to help you with the rearrangement process. */ 6 | 7 | /* target = 1024x768 */ 8 | 9 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 10 | div#header {position: fixed; top: 0; height: 3em; z-index: 1;} 11 | div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} 12 | .slide {top: 0; width: 92%; padding: 2.5em 4% 4%; z-index: 2;} 13 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 14 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 15 | margin: 0;} 16 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; 17 | z-index: 10;} 18 | html>body #currentSlide {position: fixed;} 19 | 20 | /* 21 | div#header {background: #FCC;} 22 | div#footer {background: #CCF;} 23 | div#controls {background: #BBD;} 24 | div#currentSlide {background: #FFC;} 25 | */ 26 | -------------------------------------------------------------------------------- /test/local-writer.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # $Id: local-writer.py 7500 2012-08-22 19:38:14Z grubert $ 3 | # Author: Engelbert Gruber 4 | # Copyright: This module is put into the public domain. 5 | 6 | """ 7 | mini-writer to test get_writer_class with local writer 8 | """ 9 | 10 | import docutils 11 | from docutils import nodes, writers, languages 12 | try: 13 | import roman 14 | except ImportError: 15 | import docutils.utils.roman as roman 16 | 17 | class Writer(writers.Writer): 18 | 19 | supported = ('dummy',) 20 | """Formats this writer supports.""" 21 | 22 | output = None 23 | """Final translated form of `document`.""" 24 | 25 | def __init__(self): 26 | writers.Writer.__init__(self) 27 | self.translator_class = Translator 28 | 29 | def translate(self): 30 | visitor = self.translator_class(self.document) 31 | self.document.walkabout(visitor) 32 | self.output = visitor.astext() 33 | 34 | class Translator(nodes.NodeVisitor): 35 | def __init__(self, document): 36 | nodes.NodeVisitor.__init__(self, document) 37 | 38 | 39 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/framing.css: -------------------------------------------------------------------------------- 1 | /* This file has been placed in the public domain. */ 2 | /* The following styles size, place, and layer the slide components. 3 | Edit these if you want to change the overall slide layout. 4 | The commented lines can be uncommented (and modified, if necessary) 5 | to help you with the rearrangement process. */ 6 | 7 | /* target = 1024x768 */ 8 | 9 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 10 | div#header {position: fixed; top: 0; height: 3em; z-index: 1;} 11 | div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} 12 | .slide {top: 0; width: 92%; padding: 2.5em 4% 4%; z-index: 2;} 13 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 14 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 15 | margin: 0;} 16 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; 17 | z-index: 10;} 18 | html>body #currentSlide {position: fixed;} 19 | 20 | /* 21 | div#header {background: #FCC;} 22 | div#footer {background: #CCF;} 23 | div#controls {background: #BBD;} 24 | div#currentSlide {background: #FFC;} 25 | */ 26 | -------------------------------------------------------------------------------- /test/functional/input/standalone_rst_latex.txt: -------------------------------------------------------------------------------- 1 | .. include:: data/standard.txt 2 | .. currently not implemented in LaTeX: 3 | .. include:: data/header_footer.txt 4 | .. include:: data/table_colspan.txt 5 | .. include:: data/table_rowspan.txt 6 | .. include:: data/list_table.txt 7 | .. include:: data/custom_roles.txt 8 | .. include:: data/math.txt 9 | 10 | Tests for the LaTeX writer 11 | ========================== 12 | 13 | Test syntax elements which may cause trouble for the LaTeX writer but might 14 | not need to be tested with other writers (e.g. the HTML writer). 15 | 16 | .. include:: data/custom_roles_latex.txt 17 | .. include:: data/classes_latex.txt 18 | .. include:: data/tables_latex.txt 19 | .. include:: data/option_lists.txt 20 | .. include:: data/nonalphanumeric.txt 21 | .. include:: data/unicode.txt 22 | .. include:: data/latex_encoding.txt 23 | .. include:: data/hyperlinking.txt 24 | .. include:: data/urls.txt 25 | .. include:: data/section_titles.txt 26 | .. unusual combinations (currently separately tested) 27 | .. include:: data/latex_cornercases.txt 28 | 29 | .. Preface for System Messages: 30 | .. include:: data/errors.txt 31 | -------------------------------------------------------------------------------- /test/functional/input/latex_babel.txt: -------------------------------------------------------------------------------- 1 | The babel_ package introduces the concept of "shorthands": additional 2 | characters that introduce a latex macro. Most common is the active double 3 | quote ("). Problematic is the tilde character (~) which is regularely used 4 | for no-break spaces but redefined by some language definition files: 5 | 6 | English: 'an' "active"-quote, ^circumflex, and no-break spaces 7 | 8 | .. class:: language-eu 9 | 10 | Basque: 'an' "active"-quote, ^circumflex, and no-break spaces 11 | 12 | .. class:: language-eo 13 | 14 | Esperanto: 'an' "active"-quote, ^circumflex, and no-break spaces 15 | 16 | .. class:: language-et 17 | 18 | Estonian: 'an' "active"-quote, ^circumflex, and no-break spaces 19 | 20 | .. class:: language-gl 21 | 22 | Galician: 'an' "active"-quote, ^circumflex, and no-break spaces 23 | 24 | .. class:: language-de 25 | 26 | German: 'an' "active"-quote, ^circumflex, and no-break spaces 27 | 28 | Spanish: option clash with Galician! 29 | 30 | .. 31 | .. class:: language-es 32 | 33 | Spanish: 'an' "active"-quote, ^circumflex, and no-break spaces 34 | 35 | 36 | .. _babel: http://www.ctan.org/packages/babel 37 | -------------------------------------------------------------------------------- /test/test_writers/test_pseudoxml.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: test_pseudoxml.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Test for pseudo-XML writer. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.PublishTestSuite('pseudoxml') 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['basic'] = [ 21 | # input 22 | ["""\ 23 | This is a paragraph. 24 | 25 | ---------- 26 | 27 | This is another paragraph. 28 | 29 | A Section 30 | --------- 31 | 32 | Foo. 33 | """, 34 | # output 35 | """\ 36 | 37 | 38 | This is a paragraph. 39 | 40 | 41 | This is another paragraph. 42 |
43 | 44 | A Section 45 | <paragraph> 46 | Foo. 47 | """] 48 | ] 49 | 50 | if __name__ == '__main__': 51 | import unittest 52 | unittest.main(defaultTest='suite') 53 | -------------------------------------------------------------------------------- /test/functional/expected/latex_docinfo.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper]{article} 2 | % generated by Docutils <http://docutils.sourceforge.net/> 3 | \usepackage{cmap} % fix search and cut-and-paste in Acrobat 4 | \usepackage{ifthen} 5 | \usepackage[T1]{fontenc} 6 | \usepackage[utf8]{inputenc} 7 | 8 | %%% Custom LaTeX preamble 9 | % PDF Standard Fonts 10 | \usepackage{mathptmx} % Times 11 | \usepackage[scaled=.90]{helvet} 12 | \usepackage{courier} 13 | 14 | %%% User specified packages and stylesheets 15 | 16 | %%% Fallback definitions for Docutils-specific commands 17 | 18 | % hyperlinks: 19 | \ifthenelse{\isundefined{\hypersetup}}{ 20 | \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} 21 | \usepackage{bookmark} 22 | \urlstyle{same} % normal text font (alternatives: tt, rm, sf) 23 | }{} 24 | \hypersetup{ 25 | pdfauthor={Foo Fred;Bar Barney} 26 | } 27 | 28 | %%% Body 29 | \begin{document} 30 | \title{} 31 | \author{Foo Fred\\ 32 | Food Foomatics \& Friends\\ 33 | foo@food.example.info\\ 34 | Fox St 13\\ 35 | Foowood \and 36 | Bar Barney\\ 37 | Bar-BQ Bar\\ 38 | 1-800-BARBQBAR\\ 39 | Barbara St 16\\ 40 | South Barwell} 41 | \date{} 42 | \maketitle 43 | 44 | \end{document} 45 | -------------------------------------------------------------------------------- /test/test_transforms/test_strip_comments.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_strip_comments.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger <goodger@python.org> 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for docutils.transforms.universal.StripComments. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | from docutils.transforms.universal import StripComments 13 | from docutils.parsers.rst import Parser 14 | 15 | 16 | def suite(): 17 | parser = Parser() 18 | s = DocutilsTestSupport.TransformTestSuite( 19 | parser, suite_settings={'strip_comments': 1}) 20 | s.generateTests(totest) 21 | return s 22 | 23 | totest = {} 24 | 25 | totest['strip_comments'] = ((StripComments,), [ 26 | ["""\ 27 | .. this is a comment 28 | 29 | Title 30 | ===== 31 | 32 | Paragraph. 33 | """, 34 | """\ 35 | <document source="test data"> 36 | <section ids="title" names="title"> 37 | <title> 38 | Title 39 | <paragraph> 40 | Paragraph. 41 | """], 42 | ]) 43 | 44 | 45 | if __name__ == '__main__': 46 | import unittest 47 | unittest.main(defaultTest='suite') 48 | -------------------------------------------------------------------------------- /test/functional/input/data/table_complex.txt: -------------------------------------------------------------------------------- 1 | Complex tables 2 | -------------- 3 | 4 | Here's a complex table, which should test all features. 5 | 6 | +------------------------+------------+----------+----------+ 7 | | Header row, column 1 | Header 2 | Header 3 | Header 4 | 8 | | (header rows optional) | | | | 9 | +========================+============+==========+==========+ 10 | | body row 1, column 1 | column 2 | column 3 | column 4 | 11 | +------------------------+------------+----------+----------+ 12 | | body row 2 | Cells may span columns. | 13 | +------------------------+------------+---------------------+ 14 | | body row 3 | Cells may | - Table cells | 15 | +------------------------+ span rows. | - contain | 16 | | body row 4 | | - body elements. | 17 | | | Paragraph. | | 18 | +------------------------+------------+----------+----------+ 19 | | body row 5 | Cells may also be | | 20 | | | empty: ``-->`` | | 21 | +------------------------+-----------------------+----------+ 22 | -------------------------------------------------------------------------------- /docutils/parsers/rst/languages/__init__.py: -------------------------------------------------------------------------------- 1 | # $Id: __init__.py 8239 2018-11-21 21:46:00Z milde $ 2 | # Author: David Goodger <goodger@python.org> 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | # Internationalization details are documented in 6 | # <http://docutils.sf.net/docs/howto/i18n.html>. 7 | 8 | """ 9 | This package contains modules for language-dependent features of 10 | reStructuredText. 11 | """ 12 | 13 | __docformat__ = 'reStructuredText' 14 | 15 | import sys 16 | 17 | from docutils.utils import normalize_language_tag 18 | 19 | 20 | _languages = {} 21 | 22 | def get_language(language_code): 23 | for tag in normalize_language_tag(language_code): 24 | tag = tag.replace('-','_') # '-' not valid in module names 25 | if tag in _languages: 26 | return _languages[tag] 27 | try: 28 | module = __import__(tag, globals(), locals(), level=1) 29 | except ImportError: 30 | try: 31 | module = __import__(tag, globals(), locals(), level=0) 32 | except ImportError: 33 | continue 34 | _languages[tag] = module 35 | return module 36 | return None 37 | -------------------------------------------------------------------------------- /test/test_transforms/test_expose_internals.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_expose_internals.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann <LeWiemann@gmail.com> 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Test module for universal.ExposeInternals transform. 9 | """ 10 | 11 | 12 | from __init__ import DocutilsTestSupport # must be imported before docutils 13 | from docutils.transforms.universal import ExposeInternals 14 | from docutils.parsers.rst import Parser 15 | 16 | def suite(): 17 | parser = Parser() 18 | s = DocutilsTestSupport.TransformTestSuite( 19 | parser, suite_settings={'expose_internals': ['rawsource', 'source']}) 20 | s.generateTests(totest) 21 | return s 22 | 23 | 24 | totest = {} 25 | 26 | totest['transitions'] = ((ExposeInternals,), [ 27 | ["""\ 28 | This is a test. 29 | """, 30 | """\ 31 | <document internal:rawsource="" source="test data"> 32 | <paragraph internal:rawsource="This is a test." internal:source="test data"> 33 | This is a test. 34 | """], 35 | ]) 36 | 37 | 38 | if __name__ == '__main__': 39 | import unittest 40 | unittest.main(defaultTest='suite') 41 | -------------------------------------------------------------------------------- /tools/editors/emacs/tests/init.el: -------------------------------------------------------------------------------- 1 | ;; Initialize tests -*- lexical-binding: t -*- 2 | 3 | (defun init-rst-ert (&optional with-buffer) 4 | "Initialize tests. 5 | Prepare for buffer using tests if WITH-BUFFER." 6 | (when with-buffer 7 | (add-to-list 'load-path ".") 8 | (load "ert-buffer" nil t) 9 | (if (equal (car load-path) ".") 10 | (setq load-path (cdr load-path)))) 11 | 12 | (add-to-list 'load-path "..") 13 | (load "rst.el" nil t) 14 | (if (equal (car load-path) "..") 15 | (setq load-path (cdr load-path))) 16 | 17 | ;; Emacs 24 should have a patch in `testcover-after` declaring a 18 | ;; `gv-expander'. 19 | (if (< emacs-major-version 24) 20 | ;; Define a setf-method for `testcover-after' so `ert' tests can be run 21 | ;; without problems. 22 | (defsetf testcover-after (idx val) (store) 23 | (list 'progn 24 | (list 'testcover-after idx val) 25 | ;; FIXME: Though it solves the problem it is not really correct 26 | ;; because `val' is only a temporary variable here. 27 | (list 'setf val store))))) 28 | 29 | ;; Clean up `load-path' if set caller just to load this file. 30 | (if (equal (car load-path) ".") 31 | (setq load-path (cdr load-path))) 32 | -------------------------------------------------------------------------------- /tools/editors/emacs/README.txt: -------------------------------------------------------------------------------- 1 | .. -*- coding: utf-8 -*- 2 | 3 | ===================== 4 | Emacs Support Files 5 | ===================== 6 | 7 | :Date: $Date: 2008-11-26 19:07:47 +0100 (Mi, 26 Nov 2008) $ 8 | 9 | This directory contains the following Emacs lisp package files: 10 | 11 | * `<rst.el>`_: Emacs support for reStructuredText_. This file contains a 12 | major mode that provides: 13 | 14 | * Section decoration/adornment creation and updating (M. Blais); 15 | * Table-of-contents mode and insertion (M. Blais); 16 | * Font-lock syntax highlighting (S. Merten); 17 | * Some handy editing functions (D. Goodger). 18 | * Some functions for converting rest documents from within emacs (M. Blais). 19 | 20 | * `<tests/>`_ subdirectory: automated tests for some of the features in rst.el. 21 | Please make sure the tests pass if you change the LISP code. Just type "make" 22 | to run the tests. 23 | 24 | To install the package, put a copy of the package file in a directory on your 25 | ``load-path`` (use ``C-h v load-path`` to check). 26 | 27 | For setup and usage details, see `Emacs Support for reStructuredText 28 | <../../../docs/user/emacs.html>`_. 29 | 30 | .. _reStructuredText: http://docutils.sourceforge.net/rst.html 31 | -------------------------------------------------------------------------------- /test/functional/input/data/custom_roles.txt: -------------------------------------------------------------------------------- 1 | Custom Roles 2 | ------------ 3 | 4 | * A role based on an existing role. 5 | 6 | .. role:: custom(literal) 7 | 8 | :custom:`one` :custom:`two` :custom:`three` 9 | 10 | * A new role. 11 | 12 | .. role:: customnew 13 | 14 | :customnew:`one two three` 15 | 16 | * A role with class attribute. 17 | 18 | .. role:: customclass 19 | :class: special 20 | 21 | :customclass:`interpreted text` 22 | 23 | * A language-switching role: 24 | 25 | .. role:: language-de 26 | 27 | Let's count in German :language-de:`eins zwei drei`. 28 | 29 | * A role with multiple class attributes, styled with raw directives: 30 | 31 | .. role:: customx 32 | :class: green sc language-en-GB 33 | 34 | .. raw:: latex 35 | 36 | \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}} 37 | \newcommand{\DUrolesc}[1]{\textsc{#1}} 38 | 39 | The following works in most browsers but does not validate 40 | (``<style>`` is only allowed in the document head):: 41 | 42 | .. raw:: html 43 | 44 | <style type="text/css"><!-- 45 | .green {color: green;} 46 | .sc {font-variant: small-caps;} 47 | --></style> 48 | 49 | :customx:`British colourful text in small-caps`. 50 | -------------------------------------------------------------------------------- /tools/rst2html5.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf8 -*- 3 | # :Copyright: © 2015 Günter Milde. 4 | # :License: Released under the terms of the `2-Clause BSD license`_, in short: 5 | # 6 | # Copying and distribution of this file, with or without modification, 7 | # are permitted in any medium without royalty provided the copyright 8 | # notice and this notice are preserved. 9 | # This file is offered as-is, without any warranty. 10 | # 11 | # .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause 12 | # 13 | # Revision: $Revision: 7847 $ 14 | # Date: $Date: 2015-03-17 18:30:47 +0100 (Di, 17 Mär 2015) $ 15 | 16 | """ 17 | A minimal front end to the Docutils Publisher, producing HTML 5 documents. 18 | 19 | The output also conforms to XHTML 1.0 transitional 20 | (except for the doctype declaration). 21 | """ 22 | 23 | try: 24 | import locale # module missing in Jython 25 | locale.setlocale(locale.LC_ALL, '') 26 | except locale.Error: 27 | pass 28 | 29 | from docutils.core import publish_cmdline, default_description 30 | 31 | description = (u'Generates HTML 5 documents from standalone ' 32 | u'reStructuredText sources ' 33 | + default_description) 34 | 35 | publish_cmdline(writer_name='html5', description=description) 36 | -------------------------------------------------------------------------------- /test/test_parsers/test_parser.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_parser.py 8164 2017-08-14 11:28:48Z milde $ 4 | # Author: Stefan Rank <strank(AT)strank(DOT)info> 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for basic functionality of parser classes. 9 | """ 10 | 11 | import sys 12 | import unittest 13 | import DocutilsTestSupport # must be imported before docutils 14 | import docutils 15 | from docutils import parsers, utils, frontend 16 | 17 | 18 | class RstParserTests(unittest.TestCase): 19 | 20 | def test_inputrestrictions(self): 21 | parser_class = parsers.get_parser_class('rst') 22 | parser = parser_class() 23 | document = utils.new_document('test data', frontend.OptionParser( 24 | components=(parser, )).get_default_values()) 25 | 26 | if sys.version_info < (3,): 27 | # supplying string input is supported, but only if ascii-decodable 28 | self.assertRaises(UnicodeDecodeError, 29 | parser.parse, b'hol%s' % chr(224), document) 30 | else: 31 | # input must be unicode at all times 32 | self.assertRaises(TypeError, parser.parse, b'hol', document) 33 | 34 | 35 | if __name__ == '__main__': 36 | unittest.main() 37 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/include10.txt: -------------------------------------------------------------------------------- 1 | .. |bad| unicode:: 0x11111111 2 | 3 | hi 4 | ----- 5 | 6 | indent 7 | error 8 | 9 | hi 10 | ----- 11 | 12 | .. include:: <nonexistent> 13 | 14 | .. note:: 15 | 16 | .. admonition:: 17 | without title 18 | 19 | .. epigraph:: 20 | 21 | .. highlights:: 22 | 23 | .. pull-quote:: 24 | 25 | .. date:: 26 | 27 | not a 28 | definition list: 29 | as a term may only be one line long. 30 | 31 | .. admonition:: 32 | 33 | without title and content following a blank line 34 | 35 | section underline too short 36 | ----- 37 | 38 | ============== ====== 39 | A simple table cell 2 40 | ============== ====== 41 | cell 3 cell 4 42 | ============== ====== 43 | No blank line after table. 44 | 45 | .. |empty| unicode:: 46 | 47 | .. topic:: 48 | 49 | .. rubric:: 50 | .. rubric:: A rubric has no content 51 | 52 | .. _`target: No matching backquote. 53 | .. __malformed: no good 54 | 55 | A literal block:: 56 | with no blank line above. 57 | 58 | :: 59 | 60 | > A literal block. 61 | $ with inconsistent quoting. 62 | 63 | :unknown-role:`role` 64 | and *unbalanced 65 | `inline 66 | **markup 67 | 68 | :PEP:`-1` 69 | 70 | .. unknown:: directive (info still reported with wrong line) 71 | 72 | ============== ====== 73 | A simple table with 74 | no bottom border 75 | -------------------------------------------------------------------------------- /test/test_transforms/test___init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test___init__.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann <LeWiemann@gmail.com> 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Test module for transforms/__init__.py. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport # must be imported before docutils 12 | from docutils import transforms, utils 13 | import unittest 14 | 15 | 16 | class TestTransform(transforms.Transform): 17 | 18 | default_priority = 100 19 | 20 | applied = 0 21 | 22 | def apply(self, **kwargs): 23 | self.applied += 1 24 | assert kwargs == {'foo': 42} 25 | 26 | 27 | class KwargsTestCase(unittest.TestCase): 28 | 29 | def test_kwargs(self): 30 | transformer = transforms.Transformer(utils.new_document('test data')) 31 | transformer.add_transform(TestTransform, foo=42) 32 | transformer.apply_transforms() 33 | self.assertEqual(len(transformer.applied), 1) 34 | self.assertEqual(len(transformer.applied[0]), 4) 35 | transform_record = transformer.applied[0] 36 | self.assertEqual(transform_record[1], TestTransform) 37 | self.assertEqual(transform_record[3], {'foo': 42}) 38 | 39 | 40 | if __name__ == '__main__': 41 | unittest.main() 42 | -------------------------------------------------------------------------------- /test/functional/expected/misc_rst_html4css1.html: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8" ?> 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 4 | <head> 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 | <meta name="generator" content="Docutils 0.15: http://docutils.sourceforge.net/" /> 7 | <title>link_in_substitution.txt 8 | 9 | 10 | 11 |
12 | 13 | 14 |

Test the interaction of transforms.references.Substitutions and 15 | transforms.references.ExternalLinks.

16 |

reStructuredText is cool!

17 |

There is a preferred alternative:

18 |

reStructuredText is cool!

19 |

This only works for the case where the entire substitution is a 20 | reference, not when the reference is embedded as part of the 21 | substitution:

22 |

unstructured reStructuredText is uncool!

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_class.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_class.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the 'class' directive. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['class'] = [ 21 | ["""\ 22 | .. class:: class1 class2 23 | """, 24 | """\ 25 | 26 | 27 | .. internal attributes: 28 | .transform: docutils.transforms.misc.ClassAttribute 29 | .details: 30 | class: ['class1', 'class2'] 31 | directive: 'class' 32 | """], 33 | ["""\ 34 | .. class:: class1 class2 35 | 36 | The classes are applied to this paragraph. 37 | 38 | And this one. 39 | """, 40 | """\ 41 | 42 | 43 | The classes are applied to this paragraph. 44 | 45 | And this one. 46 | """], 47 | ] 48 | 49 | 50 | if __name__ == '__main__': 51 | import unittest 52 | unittest.main(defaultTest='suite') 53 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_sectnum.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_sectnum.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the 'sectnum' directive. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['sectnum'] = [ 21 | ["""\ 22 | .. sectnum:: 23 | """, 24 | """\ 25 | 26 | 27 | .. internal attributes: 28 | .transform: docutils.transforms.parts.SectNum 29 | .details: 30 | """], 31 | ["""\ 32 | .. sectnum:: 33 | :depth: 23 34 | :start: 42 35 | :prefix: A Prefix 36 | :suffix: A Suffix 37 | """, 38 | """\ 39 | 40 | 41 | .. internal attributes: 42 | .transform: docutils.transforms.parts.SectNum 43 | .details: 44 | depth: 23 45 | prefix: 'A Prefix' 46 | start: 42 47 | suffix: 'A Suffix' 48 | """], 49 | ] 50 | 51 | 52 | if __name__ == '__main__': 53 | import unittest 54 | unittest.main(defaultTest='suite') 55 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/s5defs.txt: -------------------------------------------------------------------------------- 1 | .. Definitions of interpreted text roles (classes) for S5/HTML data. 2 | .. This data file has been placed in the public domain. 3 | 4 | .. Colours 5 | ======= 6 | 7 | .. role:: black 8 | .. role:: gray 9 | .. role:: silver 10 | .. role:: white 11 | 12 | .. role:: maroon 13 | .. role:: red 14 | .. role:: magenta 15 | .. role:: fuchsia 16 | .. role:: pink 17 | .. role:: orange 18 | .. role:: yellow 19 | .. role:: lime 20 | .. role:: green 21 | .. role:: olive 22 | .. role:: teal 23 | .. role:: cyan 24 | .. role:: aqua 25 | .. role:: blue 26 | .. role:: navy 27 | .. role:: purple 28 | 29 | 30 | .. Text Sizes 31 | ========== 32 | 33 | .. role:: huge 34 | .. role:: big 35 | .. role:: small 36 | .. role:: tiny 37 | 38 | 39 | .. Display in Slides (Presentation Mode) Only 40 | ========================================== 41 | 42 | .. role:: slide 43 | :class: slide-display 44 | 45 | 46 | .. Display in Outline Mode Only 47 | ============================ 48 | 49 | .. role:: outline 50 | 51 | 52 | .. Display in Print Only 53 | ===================== 54 | 55 | .. role:: print 56 | 57 | 58 | .. Display in Handout Mode Only 59 | ============================ 60 | 61 | .. role:: handout 62 | 63 | 64 | .. Incremental Display 65 | =================== 66 | 67 | .. role:: incremental 68 | .. default-role:: incremental 69 | -------------------------------------------------------------------------------- /test/functional/expected/field_name_limit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | field_list.txt 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
short:This field's name is short.
medium-length:This field's name is medium-length.
long field name:This field's name is long.
very very long field name:This field's name is quite long.
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /docutils/writers/s5_html/themes/default/iepngfix.htc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 42 | -------------------------------------------------------------------------------- /test/functional/expected/ui/default/iepngfix.htc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 42 | -------------------------------------------------------------------------------- /test/functional/expected/ui/small-black/iepngfix.htc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 42 | -------------------------------------------------------------------------------- /test/functional/input/data/latex_encoding.txt: -------------------------------------------------------------------------------- 1 | Encoding special chars 2 | ---------------------- 3 | 4 | The LaTeX Info pages lists under "2.18 Special Characters" 5 | 6 | The following characters play a special role in LaTeX and are called 7 | "special printing characters", or simply "special characters". 8 | 9 | # $ % & ~ _ ^ \\ { } 10 | 11 | The special chars verbatim:: 12 | 13 | # $ % & ~ _ ^ \ { } 14 | 15 | However also *square brackets* [] need special care. 16 | 17 | Commands with optional arguments (e.g. ``\item``) check 18 | if the token right after the macro name is an opening bracket. 19 | In that case the contents between that bracket and the following 20 | closing bracket on the same grouping level are taken as the 21 | optional argument. What makes this unintuitive is the fact that 22 | the square brackets aren't grouping characters themselves, so in 23 | your last example ``\item[[...]]`` the optional argument consists of 24 | [... (without the closing bracket). 25 | 26 | Compare the items in the following lists: 27 | 28 | * simple item 29 | * [bracketed] item 30 | 31 | simple 32 | description term 33 | 34 | [bracketed] 35 | description term 36 | 37 | The OT1 font-encoding has different characters for the less-than, 38 | greater-than and bar, < | >, except for typewriter font `cmtt`:: 39 | 40 | < | > 41 | 42 | -------------------------------------------------------------------------------- /licenses/BSD-2-Clause.txt: -------------------------------------------------------------------------------- 1 | 2-Clause BSD license / FreeBSD license 2 | ====================================== 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /docutils/writers/pep_html/template.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | PEP %(pep)s -- %(title)s 13 | %(stylesheet)s 14 | 15 | 16 | 18 | 22 | 27 |
28 | %(body)s 29 | %(body_suffix)s 30 | -------------------------------------------------------------------------------- /test/test_transforms/test_strip_elements_with_class.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_strip_elements_with_class.py 7496 2012-08-16 15:11:18Z milde $ 4 | # Author: Guenter Milde 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for docutils.transforms.universal.StripComments. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | from docutils.parsers.rst import Parser 13 | from docutils.transforms.universal import StripClassesAndElements 14 | 15 | def suite(): 16 | parser = Parser() 17 | s = DocutilsTestSupport.TransformTestSuite( 18 | parser, suite_settings={'strip_elements_with_classes': 19 | ['spam', 'no-ham']}) 20 | s.generateTests(totest) 21 | return s 22 | 23 | totest = {} 24 | 25 | totest['strip_spam'] = ((StripClassesAndElements,), [ 26 | ["""\ 27 | not classy 28 | 29 | .. class:: spam 30 | 31 | this is spam 32 | 33 | .. class:: ham 34 | 35 | this is ham 36 | 37 | .. code:: 38 | :class: spam 39 | 40 | print "spam" 41 | 42 | .. image:: spam.jpg 43 | :class: spam 44 | 45 | this is not ham 46 | """, 47 | """\ 48 | 49 | 50 | not classy 51 | 52 | this is ham 53 | 54 | this is not ham 55 | """], 56 | ]) 57 | 58 | 59 | if __name__ == '__main__': 60 | import unittest 61 | unittest.main(defaultTest='suite') 62 | -------------------------------------------------------------------------------- /test/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $Id: coverage.sh 5539 2008-03-30 09:05:39Z wiemann $ 4 | # Author: Lea Wiemann 5 | # Copyright: This script has been placed in the public domain. 6 | 7 | # Usage: ./coverage.sh [project, [module]] 8 | 9 | set -e 10 | # Resolve all symlinks in current path. 11 | cd -P . 12 | proj="${PWD##*/}" 13 | if test "$proj" == test; then 14 | cd .. 15 | proj="${PWD##*/}" 16 | fi 17 | if test "$1"; then 18 | proj="$1" 19 | fi 20 | module="${2:-alltests.py}" 21 | module="${module#test/}" 22 | echo "Performing code coverage test for project \"$proj\", test module \"$module\"..." 23 | echo 24 | echo "Please be patient; coverage tracking slows test execution down by more" 25 | echo "than factor 10." 26 | echo 27 | cd test 28 | rm -rf cover 29 | mkdir -p cover 30 | python -u -m trace --count --coverdir=cover --missing "$module" 31 | cd .. 32 | echo 33 | echo 34 | echo Uncovered lines 35 | echo =============== 36 | echo 37 | ( 38 | find "$proj/" -name \*.py | while read i; do 39 | i="${i%.py}" 40 | test -f test/cover/"${i//\//.}".cover -o "${i##*/}" == Template || echo "${i//\//.}" "`cat "$i.py" | wc -l`" 41 | done 42 | cd test/cover 43 | find . \( -name . -o ! -name "$proj".\* -exec rm {} \; \) 44 | for i in *.cover; do 45 | sed 's/^>>>>>> \(.*"""\)/ \1/' < "$i" > "${i%.cover}" 46 | rm "$i" 47 | done 48 | for i in *; do echo -n "$i "; grep -c '^>>>>>> ' "$i" || true; done 49 | ) | grep -v ' 0$' | sort -nk 2 50 | -------------------------------------------------------------------------------- /test/data/full-template.txt: -------------------------------------------------------------------------------- 1 | head_prefix = """\ 2 | %(head_prefix)s""" 3 | 4 | 5 | head = """\ 6 | %(head)s""" 7 | 8 | 9 | stylesheet = """\ 10 | %(stylesheet)s""" 11 | 12 | 13 | body_prefix = """\ 14 | %(body_prefix)s""" 15 | 16 | 17 | body_pre_docinfo = """\ 18 | %(body_pre_docinfo)s""" 19 | 20 | 21 | docinfo = """\ 22 | %(docinfo)s""" 23 | 24 | 25 | body = """\ 26 | %(body)s""" 27 | 28 | 29 | body_suffix = """\ 30 | %(body_suffix)s""" 31 | 32 | 33 | head_prefix = """\ 34 | %(head_prefix)s""" 35 | 36 | 37 | head = """\ 38 | %(head)s""" 39 | 40 | 41 | stylesheet = """\ 42 | %(stylesheet)s""" 43 | 44 | 45 | body_prefix = """\ 46 | %(body_prefix)s""" 47 | 48 | 49 | body_pre_docinfo = """\ 50 | %(body_pre_docinfo)s""" 51 | 52 | 53 | docinfo = """\ 54 | %(docinfo)s""" 55 | 56 | 57 | body = """\ 58 | %(body)s""" 59 | 60 | 61 | body_suffix = """\ 62 | %(body_suffix)s""" 63 | 64 | 65 | title = """\ 66 | %(title)s""" 67 | 68 | 69 | subtitle = """\ 70 | %(subtitle)s""" 71 | 72 | 73 | header = """\ 74 | %(header)s""" 75 | 76 | 77 | footer = """\ 78 | %(footer)s""" 79 | 80 | 81 | meta = """\ 82 | %(meta)s""" 83 | 84 | 85 | fragment = """\ 86 | %(fragment)s""" 87 | 88 | 89 | html_prolog = """\ 90 | %(html_prolog)s""" 91 | 92 | 93 | html_head = """\ 94 | %(html_head)s""" 95 | 96 | 97 | html_title = """\ 98 | %(html_title)s""" 99 | 100 | 101 | html_subtitle = """\ 102 | %(html_subtitle)s""" 103 | 104 | 105 | html_body = """\ 106 | %(html_body)s""" 107 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_interpreted_fr.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_interpreted.py 6424 2010-09-18 10:43:52Z smerten $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for interpreted text in docutils/parsers/rst/states.py. 9 | Test not default/fallback language french. 10 | """ 11 | 12 | from __init__ import DocutilsTestSupport 13 | 14 | def suite(): 15 | s = DocutilsTestSupport.ParserTestSuite(suite_settings={'language_code':'fr'}) 16 | s.generateTests(totest) 17 | return s 18 | 19 | totest = {} 20 | 21 | totest['basics'] = [ 22 | ["""\ 23 | Simple explicit roles and english fallbacks: 24 | :acronym:`acronym`, 25 | :exp:`superscript`, 26 | :ind:`subscript`, 27 | :titre:`title reference`. 28 | """, 29 | """\ 30 | 31 | 32 | Simple explicit roles and english fallbacks: 33 | 34 | acronym 35 | , 36 | 37 | superscript 38 | , 39 | 40 | subscript 41 | , 42 | 43 | title reference 44 | . 45 | 46 | 47 | No role entry for "acronym" in module "docutils.parsers.rst.languages.fr". 48 | Using English fallback for role "acronym". 49 | """], 50 | ] 51 | 52 | if __name__ == '__main__': 53 | import unittest 54 | unittest.main(defaultTest='suite') 55 | -------------------------------------------------------------------------------- /test/functional/input/standalone_rst_xetex.txt: -------------------------------------------------------------------------------- 1 | .. include:: data/standard.txt 2 | .. currently not implemented in LaTeX: 3 | .. include:: data/header_footer.txt 4 | .. include:: data/table_colspan.txt 5 | .. include:: data/table_rowspan.txt 6 | .. include:: data/list_table.txt 7 | .. include:: data/custom_roles.txt 8 | .. include:: data/math.txt 9 | 10 | Tests for the LaTeX writer 11 | ========================== 12 | 13 | Test syntax elements which may cause trouble for the LaTeX writer but might 14 | not need to be tested with other writers (e.g. the HTML writer). 15 | 16 | .. include:: data/custom_roles_latex.txt 17 | .. include:: data/classes_latex.txt 18 | .. include:: data/tables_latex.txt 19 | .. include:: data/option_lists.txt 20 | .. include:: data/nonalphanumeric.txt 21 | .. include:: data/unicode.txt 22 | .. include:: data/latex_encoding.txt 23 | .. include:: data/hyperlinking.txt 24 | .. include:: data/urls.txt 25 | .. include:: data/section_titles.txt 26 | 27 | Tests for the XeTeX writer 28 | ========================== 29 | 30 | With XeTeX, you can typeset text in any language/script supported by 31 | Unicode and the selected font, e.g. Azərbaycanca, Bân-lâm-gú, Башҡорт 32 | Беларуская, Български, Català, Чӑвашла, Česky, Ελληνικά, Español, 33 | Français, Føroyskt, Хальмг, Íslenska, עברית , Қазақша, Kurdî, 34 | Latviešu, Lietuvių, Македонски, Монгол, Nāhuatl, Português, Română, 35 | Русский, Slovenščina, Српски, Türkçe, Українська, Tiếng Việt, Volapük, 36 | Võro, ייִדיש , Žemaitėška. 37 | Currently, there is extended support for 28 languages in the 38 | polyglossia_ package. 39 | 40 | .. _polyglossia: http://ctan.org/pkg/polyglossia 41 | 42 | .. System Messages: 43 | .. include:: data/errors.txt 44 | -------------------------------------------------------------------------------- /test/test_command_line.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # .. coding: utf-8 3 | # $Id: test_command_line.py 7668 2013-06-04 12:46:30Z milde $ 4 | # Author: Günter Milde 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Test module for the command line. 9 | """ 10 | 11 | import unittest 12 | import sys, codecs 13 | import DocutilsTestSupport # must be imported before docutils 14 | import docutils.core 15 | 16 | # determine/guess the encoding of the standard input: 17 | try: 18 | import locale # module missing in Jython 19 | locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1] 20 | except ImportError: 21 | locale_encoding = None 22 | 23 | argv_encoding = locale_encoding or 'ascii' 24 | try: 25 | codecs.lookup(argv_encoding) 26 | except LookupError: 27 | argv_encoding = 'ascii' 28 | 29 | 30 | class CommandLineEncodingTests(unittest.TestCase): 31 | 32 | def test_sys_argv_decoding(self): 33 | if argv_encoding == 'ascii': # cannot test 34 | return 35 | sys.argv.append('--source-url=test.txt') # pure ASCII argument 36 | if sys.version_info < (3,0): 37 | sys.argv.append(u'--title=Dornröschen'.encode(argv_encoding)) 38 | else: 39 | sys.argv.append(u'--title=Dornröschen') 40 | publisher = docutils.core.Publisher() 41 | publisher.process_command_line() 42 | self.assertEqual(publisher.settings.source_url, 'test.txt') 43 | self.assertEqual(publisher.settings.title, u'Dornröschen') 44 | sys.argv.pop() # --title 45 | sys.argv.pop() # --source-url 46 | 47 | 48 | if __name__ == '__main__': 49 | unittest.main() 50 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_doctest_blocks.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_doctest_blocks.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for states.py. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['doctest_blocks'] = [ 21 | ["""\ 22 | Paragraph. 23 | 24 | >>> print "Doctest block." 25 | Doctest block. 26 | 27 | Paragraph. 28 | """, 29 | """\ 30 | 31 | 32 | Paragraph. 33 | 34 | >>> print "Doctest block." 35 | Doctest block. 36 | 37 | Paragraph. 38 | """], 39 | ["""\ 40 | Paragraph. 41 | 42 | >>> print " Indented output." 43 | Indented output. 44 | """, 45 | """\ 46 | 47 | 48 | Paragraph. 49 | 50 | >>> print " Indented output." 51 | Indented output. 52 | """], 53 | ["""\ 54 | Paragraph. 55 | 56 | >>> print " Indented block & output." 57 | Indented block & output. 58 | """, 59 | """\ 60 | 61 | 62 | Paragraph. 63 | 64 | 65 | >>> print " Indented block & output." 66 | Indented block & output. 67 | """], 68 | ] 69 | 70 | if __name__ == '__main__': 71 | import unittest 72 | unittest.main(defaultTest='suite') 73 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_paragraphs.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_paragraphs.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for states.py. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['paragraphs'] = [ 21 | ["""\ 22 | A paragraph. 23 | """, 24 | """\ 25 | 26 | 27 | A paragraph. 28 | """], 29 | ["""\ 30 | Paragraph 1. 31 | 32 | Paragraph 2. 33 | """, 34 | """\ 35 | 36 | 37 | Paragraph 1. 38 | 39 | Paragraph 2. 40 | """], 41 | ["""\ 42 | Line 1. 43 | Line 2. 44 | Line 3. 45 | """, 46 | """\ 47 | 48 | 49 | Line 1. 50 | Line 2. 51 | Line 3. 52 | """], 53 | ["""\ 54 | Paragraph 1, Line 1. 55 | Line 2. 56 | Line 3. 57 | 58 | Paragraph 2, Line 1. 59 | Line 2. 60 | Line 3. 61 | """, 62 | """\ 63 | 64 | 65 | Paragraph 1, Line 1. 66 | Line 2. 67 | Line 3. 68 | 69 | Paragraph 2, Line 1. 70 | Line 2. 71 | Line 3. 72 | """], 73 | ["""\ 74 | A. Einstein was a really 75 | smart dude. 76 | """, 77 | """\ 78 | 79 | 80 | A. Einstein was a really 81 | smart dude. 82 | """], 83 | ] 84 | 85 | if __name__ == '__main__': 86 | import unittest 87 | unittest.main(defaultTest='suite') 88 | -------------------------------------------------------------------------------- /docutils/languages/__init__.py: -------------------------------------------------------------------------------- 1 | # $Id: __init__.py 8239 2018-11-21 21:46:00Z milde $ 2 | # Author: David Goodger 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | # Internationalization details are documented in 6 | # . 7 | 8 | """ 9 | This package contains modules for language-dependent features of Docutils. 10 | """ 11 | 12 | __docformat__ = 'reStructuredText' 13 | 14 | import sys 15 | 16 | from docutils.utils import normalize_language_tag 17 | 18 | 19 | _languages = {} 20 | 21 | def get_language(language_code, reporter=None): 22 | """Return module with language localizations. 23 | 24 | `language_code` is a "BCP 47" language tag. 25 | If there is no matching module, warn and fall back to English. 26 | """ 27 | # TODO: use a dummy module returning emtpy strings?, configurable? 28 | for tag in normalize_language_tag(language_code): 29 | tag = tag.replace('-','_') # '-' not valid in module names 30 | if tag in _languages: 31 | return _languages[tag] 32 | try: 33 | module = __import__(tag, globals(), locals(), level=1) 34 | except ImportError: 35 | try: 36 | module = __import__(tag, globals(), locals(), level=0) 37 | except ImportError: 38 | continue 39 | _languages[tag] = module 40 | return module 41 | if reporter is not None: 42 | reporter.warning( 43 | 'language "%s" not supported: ' % language_code + 44 | 'Docutils-generated text will be in English.') 45 | module = __import__('en', globals(), locals(), level=1) 46 | _languages[tag] = module # warn only one time! 47 | return module 48 | -------------------------------------------------------------------------------- /docutils/readers/pep.py: -------------------------------------------------------------------------------- 1 | # $Id: pep.py 7320 2012-01-19 22:33:02Z milde $ 2 | # Author: David Goodger 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """ 6 | Python Enhancement Proposal (PEP) Reader. 7 | """ 8 | 9 | __docformat__ = 'reStructuredText' 10 | 11 | 12 | from docutils.readers import standalone 13 | from docutils.transforms import peps, references, misc, frontmatter 14 | from docutils.parsers import rst 15 | 16 | 17 | class Reader(standalone.Reader): 18 | 19 | supported = ('pep',) 20 | """Contexts this reader supports.""" 21 | 22 | settings_spec = ( 23 | 'PEP Reader Option Defaults', 24 | 'The --pep-references and --rfc-references options (for the ' 25 | 'reStructuredText parser) are on by default.', 26 | ()) 27 | 28 | config_section = 'pep reader' 29 | config_section_dependencies = ('readers', 'standalone reader') 30 | 31 | def get_transforms(self): 32 | transforms = standalone.Reader.get_transforms(self) 33 | # We have PEP-specific frontmatter handling. 34 | transforms.remove(frontmatter.DocTitle) 35 | transforms.remove(frontmatter.SectionSubTitle) 36 | transforms.remove(frontmatter.DocInfo) 37 | transforms.extend([peps.Headers, peps.Contents, peps.TargetNotes]) 38 | return transforms 39 | 40 | settings_default_overrides = {'pep_references': 1, 'rfc_references': 1} 41 | 42 | inliner_class = rst.states.Inliner 43 | 44 | def __init__(self, parser=None, parser_name=None): 45 | """`parser` should be ``None``.""" 46 | if parser is None: 47 | parser = rst.Parser(rfc2822=True, inliner=self.inliner_class()) 48 | standalone.Reader.__init__(self, parser, '') 49 | -------------------------------------------------------------------------------- /test/functional/input/data/unicode.txt: -------------------------------------------------------------------------------- 1 | Non-ASCII characters 2 | -------------------- 3 | 4 | Punctuation and footnote symbols 5 | 6 | = =================================== 7 | – en-dash 8 | — em-dash 9 | ‘ single turned comma quotation mark 10 | ’ single comma quotation mark 11 | ‚ low single comma quotation mark 12 | “ double turned comma quotation mark 13 | ” double comma quotation mark 14 | „ low double comma quotation mark 15 | † dagger 16 | ‡ double dagger 17 | ♦ black diamond suit 18 | ♥ black heart suit 19 | ♠ black spade suit 20 | ♣ black club suit 21 | … ellipsis 22 | ™ trade mark sign 23 | ⇔ left-right double arrow 24 | = =================================== 25 | 26 | 27 | The `Latin-1 extended` Unicode block 28 | 29 | === = = = = = = = = = = 30 | .. 0 1 2 3 4 5 6 7 8 9 31 | --- - - - - - - - - - - 32 | 160   ¡ ¢ £ ¥ ¦ § ¨ © 33 | 170 ª « ¬ ­ ® ¯ ° ± ² ³ 34 | 180 ´ µ ¶ · ¸ ¹ º » ¼ ½ 35 | 190 ¾ ¿ À Á Â Ã Ä Å Æ Ç 36 | 200 È É Ê Ë Ì Í Î Ï Ð Ñ 37 | 210 Ò Ó Ô Õ Ö × Ø Ù Ú Û 38 | 220 Ü Ý Þ ß à á â ã ä å 39 | 230 æ ç è é ê ë ì í î ï 40 | 240 ð ñ ò ó ô õ ö ÷ ø ù 41 | 250 ú û ü ý þ ÿ 42 | === = = = = = = = = = = 43 | 44 | * The following line should not be wrapped, because it uses 45 | no-break spaces (\\u00a0): 46 | 47 | X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X 48 | 49 | * Line wrapping with/without breakpoints marked by soft hyphens 50 | (\\u00ad): 51 | 52 | pdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­sch 53 | 54 | pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch 55 | -------------------------------------------------------------------------------- /docutils/parsers/__init__.py: -------------------------------------------------------------------------------- 1 | # $Id: __init__.py 8239 2018-11-21 21:46:00Z milde $ 2 | # Author: David Goodger 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """ 6 | This package contains Docutils parser modules. 7 | """ 8 | 9 | __docformat__ = 'reStructuredText' 10 | 11 | import sys 12 | from docutils import Component 13 | 14 | 15 | class Parser(Component): 16 | 17 | component_type = 'parser' 18 | config_section = 'parsers' 19 | 20 | def parse(self, inputstring, document): 21 | """Override to parse `inputstring` into document tree `document`.""" 22 | raise NotImplementedError('subclass must override this method') 23 | 24 | def setup_parse(self, inputstring, document): 25 | """Initial parse setup. Call at start of `self.parse()`.""" 26 | self.inputstring = inputstring 27 | self.document = document 28 | document.reporter.attach_observer(document.note_parse_message) 29 | 30 | def finish_parse(self): 31 | """Finalize parse details. Call at end of `self.parse()`.""" 32 | self.document.reporter.detach_observer( 33 | self.document.note_parse_message) 34 | 35 | 36 | _parser_aliases = { 37 | 'restructuredtext': 'rst', 38 | 'rest': 'rst', 39 | 'restx': 'rst', 40 | 'rtxt': 'rst',} 41 | 42 | def get_parser_class(parser_name): 43 | """Return the Parser class from the `parser_name` module.""" 44 | parser_name = parser_name.lower() 45 | if parser_name in _parser_aliases: 46 | parser_name = _parser_aliases[parser_name] 47 | try: 48 | module = __import__(parser_name, globals(), locals(), level=1) 49 | except ImportError: 50 | module = __import__(parser_name, globals(), locals(), level=0) 51 | return module.Parser 52 | -------------------------------------------------------------------------------- /docutils/readers/doctree.py: -------------------------------------------------------------------------------- 1 | # $Id: doctree.py 4564 2006-05-21 20:44:42Z wiemann $ 2 | # Author: Martin Blais 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | """Reader for existing document trees.""" 6 | 7 | from docutils import readers, utils, transforms 8 | 9 | 10 | class Reader(readers.ReReader): 11 | 12 | """ 13 | Adapt the Reader API for an existing document tree. 14 | 15 | The existing document tree must be passed as the ``source`` parameter to 16 | the `docutils.core.Publisher` initializer, wrapped in a 17 | `docutils.io.DocTreeInput` object:: 18 | 19 | pub = docutils.core.Publisher( 20 | ..., source=docutils.io.DocTreeInput(document), ...) 21 | 22 | The original document settings are overridden; if you want to use the 23 | settings of the original document, pass ``settings=document.settings`` to 24 | the Publisher call above. 25 | """ 26 | 27 | supported = ('doctree',) 28 | 29 | config_section = 'doctree reader' 30 | config_section_dependencies = ('readers',) 31 | 32 | def parse(self): 33 | """ 34 | No parsing to do; refurbish the document tree instead. 35 | Overrides the inherited method. 36 | """ 37 | self.document = self.input 38 | # Create fresh Transformer object, to be populated from Writer 39 | # component. 40 | self.document.transformer = transforms.Transformer(self.document) 41 | # Replace existing settings object with new one. 42 | self.document.settings = self.settings 43 | # Create fresh Reporter object because it is dependent on 44 | # (new) settings. 45 | self.document.reporter = utils.new_reporter( 46 | self.document.get('source', ''), self.document.settings) 47 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isogrk2.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |Aacgr| unicode:: U+00386 .. GREEK CAPITAL LETTER ALPHA WITH TONOS 8 | .. |aacgr| unicode:: U+003AC .. GREEK SMALL LETTER ALPHA WITH TONOS 9 | .. |Eacgr| unicode:: U+00388 .. GREEK CAPITAL LETTER EPSILON WITH TONOS 10 | .. |eacgr| unicode:: U+003AD .. GREEK SMALL LETTER EPSILON WITH TONOS 11 | .. |EEacgr| unicode:: U+00389 .. GREEK CAPITAL LETTER ETA WITH TONOS 12 | .. |eeacgr| unicode:: U+003AE .. GREEK SMALL LETTER ETA WITH TONOS 13 | .. |Iacgr| unicode:: U+0038A .. GREEK CAPITAL LETTER IOTA WITH TONOS 14 | .. |iacgr| unicode:: U+003AF .. GREEK SMALL LETTER IOTA WITH TONOS 15 | .. |idiagr| unicode:: U+00390 .. GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS 16 | .. |Idigr| unicode:: U+003AA .. GREEK CAPITAL LETTER IOTA WITH DIALYTIKA 17 | .. |idigr| unicode:: U+003CA .. GREEK SMALL LETTER IOTA WITH DIALYTIKA 18 | .. |Oacgr| unicode:: U+0038C .. GREEK CAPITAL LETTER OMICRON WITH TONOS 19 | .. |oacgr| unicode:: U+003CC .. GREEK SMALL LETTER OMICRON WITH TONOS 20 | .. |OHacgr| unicode:: U+0038F .. GREEK CAPITAL LETTER OMEGA WITH TONOS 21 | .. |ohacgr| unicode:: U+003CE .. GREEK SMALL LETTER OMEGA WITH TONOS 22 | .. |Uacgr| unicode:: U+0038E .. GREEK CAPITAL LETTER UPSILON WITH TONOS 23 | .. |uacgr| unicode:: U+003CD .. GREEK SMALL LETTER UPSILON WITH TONOS 24 | .. |udiagr| unicode:: U+003B0 .. GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS 25 | .. |Udigr| unicode:: U+003AB .. GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA 26 | .. |udigr| unicode:: U+003CB .. GREEK SMALL LETTER UPSILON WITH DIALYTIKA 27 | -------------------------------------------------------------------------------- /test/functional/input/data/custom_roles_latex.txt: -------------------------------------------------------------------------------- 1 | Custom Roles in LaTeX 2 | --------------------- 3 | 4 | * Role names and class arguments are converted to conform to the 5 | regular expression ``[a-z][-a-z0-9]*`` (letters are downcased, 6 | accents and similar decoration is stripped, non-conforming 7 | characters are replaced by a hyphen). 8 | 9 | Class arguments may contain numbers and hyphens, which need special 10 | treatment in LaTeX command names. 11 | 12 | .. role:: custom4 13 | :class: large custom4 small_caps custom.role custom\role 14 | 15 | :custom4:`Text with role "custom4"` (but without styling by ``DUrole*`` 16 | macros). 17 | 18 | * With LaTeX, roles can be styled within the document using the `raw` 19 | directive. 20 | 21 | .. raw:: latex 22 | 23 | \newcommand{\DUrolelarge}[1]{{\large #1}} 24 | \makeatletter 25 | \@namedef{DUrolesmall-caps}{\textsc} 26 | \@namedef{DUrolecustom4}{\textbf} 27 | \makeatother 28 | 29 | :custom4:`inline text` in large, bold, small-caps. 30 | 31 | * Custom roles can be based on standard roles: 32 | 33 | .. role:: custom-emphasis(emphasis) 34 | 35 | This is a :custom-emphasis:`customized emphasis text role` 36 | 37 | .. role:: custom-literal(literal) 38 | 39 | This is a :custom-literal:`customized literal text role` 40 | 41 | .. role:: custom-strong(strong) 42 | 43 | This is a :custom-strong:`customized strong text role` 44 | 45 | .. role:: custom-subscript(subscript) 46 | 47 | This is a :custom-subscript:`customized subscript text role` 48 | 49 | .. role:: custom-superscript(superscript) 50 | 51 | This is a :custom-superscript:`customized superscript text role` 52 | 53 | .. role:: custom-title-reference(title-reference) 54 | 55 | This is a :custom-title-reference:`customized title-reference text role` 56 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isoamsc.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |dlcorn| unicode:: U+0231E .. BOTTOM LEFT CORNER 8 | .. |drcorn| unicode:: U+0231F .. BOTTOM RIGHT CORNER 9 | .. |gtlPar| unicode:: U+02995 .. DOUBLE LEFT ARC GREATER-THAN BRACKET 10 | .. |langd| unicode:: U+02991 .. LEFT ANGLE BRACKET WITH DOT 11 | .. |lbrke| unicode:: U+0298B .. LEFT SQUARE BRACKET WITH UNDERBAR 12 | .. |lbrksld| unicode:: U+0298F .. LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER 13 | .. |lbrkslu| unicode:: U+0298D .. LEFT SQUARE BRACKET WITH TICK IN TOP CORNER 14 | .. |lceil| unicode:: U+02308 .. LEFT CEILING 15 | .. |lfloor| unicode:: U+0230A .. LEFT FLOOR 16 | .. |lmoust| unicode:: U+023B0 .. UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION 17 | .. |lpargt| unicode:: U+029A0 .. SPHERICAL ANGLE OPENING LEFT 18 | .. |lparlt| unicode:: U+02993 .. LEFT ARC LESS-THAN BRACKET 19 | .. |ltrPar| unicode:: U+02996 .. DOUBLE RIGHT ARC LESS-THAN BRACKET 20 | .. |rangd| unicode:: U+02992 .. RIGHT ANGLE BRACKET WITH DOT 21 | .. |rbrke| unicode:: U+0298C .. RIGHT SQUARE BRACKET WITH UNDERBAR 22 | .. |rbrksld| unicode:: U+0298E .. RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER 23 | .. |rbrkslu| unicode:: U+02990 .. RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER 24 | .. |rceil| unicode:: U+02309 .. RIGHT CEILING 25 | .. |rfloor| unicode:: U+0230B .. RIGHT FLOOR 26 | .. |rmoust| unicode:: U+023B1 .. UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION 27 | .. |rpargt| unicode:: U+02994 .. RIGHT ARC GREATER-THAN BRACKET 28 | .. |ulcorn| unicode:: U+0231C .. TOP LEFT CORNER 29 | .. |urcorn| unicode:: U+0231D .. TOP RIGHT CORNER 30 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_block_quotes.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_block_quotes.py 5174 2007-05-31 00:01:52Z wiemann $ 4 | # Author: Lea Wiemann 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the block quote directives "epigraph", "highlights", and 9 | "pull-quote". 10 | """ 11 | 12 | from __init__ import DocutilsTestSupport 13 | 14 | def suite(): 15 | s = DocutilsTestSupport.ParserTestSuite() 16 | s.generateTests(totest) 17 | return s 18 | 19 | generic_tests = [ 20 | ["""\ 21 | .. %(type)s:: 22 | 23 | This is a block quote. 24 | 25 | -- Attribution 26 | 27 | This is another block quote. 28 | 29 | -- Another Attribution, 30 | Second Line 31 | """, 32 | """\ 33 | 34 | 35 | 36 | This is a block quote. 37 | 38 | Attribution 39 | 40 | 41 | This is another block quote. 42 | 43 | Another Attribution, 44 | Second Line 45 | """], 46 | # TODO: Add class option. 47 | ["""\ 48 | .. %(type)s:: 49 | """, 50 | """\ 51 | 52 | 53 | 54 | Content block expected for the "%(type)s" directive; none found. 55 | 56 | .. %(type)s:: 57 | """], 58 | ] 59 | 60 | totest = {} 61 | for block_quote_type in ('epigraph', 'highlights', 'pull-quote'): 62 | totest[block_quote_type] = [ 63 | [text % {'type': block_quote_type} for text in pair] 64 | for pair in generic_tests] 65 | 66 | 67 | if __name__ == '__main__': 68 | import unittest 69 | unittest.main(defaultTest='suite') 70 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_math.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_math.py 7062 2011-06-30 22:14:29Z milde $ 4 | # Author: Guenter Milde 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the 'math' directive. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['argument'] = [ 21 | ["""\ 22 | .. math:: y = f(x) 23 | """, 24 | """\ 25 | 26 | 27 | y = f(x) 28 | """], 29 | ] 30 | 31 | totest['content'] = [ 32 | ["""\ 33 | .. math:: 34 | 35 | 1+1=2 36 | """, 37 | """\ 38 | 39 | 40 | 1+1=2 41 | """], 42 | ] 43 | 44 | totest['options'] = [ 45 | ["""\ 46 | .. math:: 47 | :class: new 48 | :name: eq:Eulers law 49 | 50 | e^i*2*\pi = 1 51 | """, 52 | """\ 53 | 54 | 55 | e^i*2*\pi = 1 56 | """], 57 | ] 58 | 59 | totest['argument_and_content'] = [ 60 | ["""\ 61 | .. math:: y = f(x) 62 | 63 | 1+1=2 64 | 65 | """, 66 | """\ 67 | 68 | 69 | y = f(x) 70 | 71 | 1+1=2 72 | """], 73 | ] 74 | 75 | totest['content with blank line'] = [ 76 | ["""\ 77 | .. math:: 78 | 79 | 1+1=2 80 | 81 | E = mc^2 82 | """, 83 | """\ 84 | 85 | 86 | 1+1=2 87 | 88 | E = mc^2 89 | """], 90 | ] 91 | 92 | 93 | if __name__ == '__main__': 94 | import unittest 95 | unittest.main(defaultTest='suite') 96 | -------------------------------------------------------------------------------- /docutils/utils/math/__init__.py: -------------------------------------------------------------------------------- 1 | # :Id: $Id: __init__.py 7865 2015-04-12 10:06:43Z milde $ 2 | # :Author: Guenter Milde. 3 | # :License: Released under the terms of the `2-Clause BSD license`_, in short: 4 | # 5 | # Copying and distribution of this file, with or without modification, 6 | # are permitted in any medium without royalty provided the copyright 7 | # notice and this notice are preserved. 8 | # This file is offered as-is, without any warranty. 9 | # 10 | # .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause 11 | 12 | """ 13 | This is the Docutils (Python Documentation Utilities) "math" sub-package. 14 | 15 | It contains various modules for conversion between different math formats 16 | (LaTeX, MathML, HTML). 17 | 18 | :math2html: LaTeX math -> HTML conversion from eLyXer 19 | :latex2mathml: LaTeX math -> presentational MathML 20 | :unichar2tex: Unicode character to LaTeX math translation table 21 | :tex2unichar: LaTeX math to Unicode character translation dictionaries 22 | :tex2mathml_extern: Wrapper for TeX -> MathML command line converters 23 | """ 24 | 25 | # helpers for Docutils math support 26 | # ================================= 27 | 28 | def pick_math_environment(code, numbered=False): 29 | """Return the right math environment to display `code`. 30 | 31 | The test simply looks for line-breaks (``\\``) outside environments. 32 | Multi-line formulae are set with ``align``, one-liners with 33 | ``equation``. 34 | 35 | If `numbered` evaluates to ``False``, the "starred" versions are used 36 | to suppress numbering. 37 | """ 38 | # cut out environment content: 39 | chunks = code.split(r'\begin{') 40 | toplevel_code = ''.join([chunk.split(r'\end{')[-1] 41 | for chunk in chunks]) 42 | if toplevel_code.find(r'\\') >= 0: 43 | env = 'align' 44 | else: 45 | env = 'equation' 46 | if not numbered: 47 | env += '*' 48 | return env 49 | -------------------------------------------------------------------------------- /docs/user/rst/images/biohazard-bitmap.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 27 | 29 | 41 | turned 50 | 51 | -------------------------------------------------------------------------------- /docutils/languages/de.py: -------------------------------------------------------------------------------- 1 | # $Id: de.py 4564 2006-05-21 20:44:42Z wiemann $ 2 | # Author: Gunnar Schwant 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | # New language mappings are welcome. Before doing a new translation, please 6 | # read . Two files must be 7 | # translated for each language: one in docutils/languages, the other in 8 | # docutils/parsers/rst/languages. 9 | 10 | """ 11 | German language mappings for language-dependent features of Docutils. 12 | """ 13 | 14 | __docformat__ = 'reStructuredText' 15 | 16 | labels = { 17 | 'author': 'Autor', 18 | 'authors': 'Autoren', 19 | 'organization': 'Organisation', 20 | 'address': 'Adresse', 21 | 'contact': 'Kontakt', 22 | 'version': 'Version', 23 | 'revision': 'Revision', 24 | 'status': 'Status', 25 | 'date': 'Datum', 26 | 'dedication': 'Widmung', 27 | 'copyright': 'Copyright', 28 | 'abstract': 'Zusammenfassung', 29 | 'attention': 'Achtung!', 30 | 'caution': 'Vorsicht!', 31 | 'danger': '!GEFAHR!', 32 | 'error': 'Fehler', 33 | 'hint': 'Hinweis', 34 | 'important': 'Wichtig', 35 | 'note': 'Bemerkung', 36 | 'tip': 'Tipp', 37 | 'warning': 'Warnung', 38 | 'contents': 'Inhalt'} 39 | """Mapping of node class name to label text.""" 40 | 41 | bibliographic_fields = { 42 | 'autor': 'author', 43 | 'autoren': 'authors', 44 | 'organisation': 'organization', 45 | 'adresse': 'address', 46 | 'kontakt': 'contact', 47 | 'version': 'version', 48 | 'revision': 'revision', 49 | 'status': 'status', 50 | 'datum': 'date', 51 | 'copyright': 'copyright', 52 | 'widmung': 'dedication', 53 | 'zusammenfassung': 'abstract'} 54 | """German (lowcased) to canonical name mapping for bibliographic fields.""" 55 | 56 | author_separators = [';', ','] 57 | """List of separator strings for the 'Authors' bibliographic field. Tried in 58 | order.""" 59 | -------------------------------------------------------------------------------- /test/test_transforms/test_peps.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_peps.py 4564 2006-05-21 20:44:42Z wiemann $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for docutils.transforms.peps. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | from docutils.transforms.peps import TargetNotes 13 | from docutils.parsers.rst import Parser 14 | 15 | 16 | def suite(): 17 | parser = Parser() 18 | s = DocutilsTestSupport.TransformTestSuite(parser) 19 | s.generateTests(totest) 20 | return s 21 | 22 | totest = {} 23 | 24 | totest['target_notes'] = ((TargetNotes,), [ 25 | ["""\ 26 | No references or targets exist, therefore 27 | no "References" section should be generated. 28 | """, 29 | """\ 30 | 31 | 32 | No references or targets exist, therefore 33 | no "References" section should be generated. 34 | """], 35 | ["""\ 36 | A target exists, here's the reference_. 37 | A "References" section should be generated. 38 | 39 | .. _reference: http://www.example.org 40 | """, 41 | """\ 42 | 43 | 44 | A target exists, here's the \n\ 45 | 46 | reference 47 | \n\ 48 | 49 | . 50 | A "References" section should be generated. 51 | 52 |
53 | 54 | References 55 | <footnote auto="1" ids="id2" names="TARGET_NOTE:\ id2"> 56 | <paragraph> 57 | <reference refuri="http://www.example.org"> 58 | http://www.example.org 59 | """], 60 | ]) 61 | 62 | 63 | 64 | if __name__ == '__main__': 65 | import unittest 66 | unittest.main(defaultTest='suite') 67 | -------------------------------------------------------------------------------- /tools/rst2odt_prepstyles.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $ 4 | # Author: Dave Kuhlman <dkuhlman@rexx.com> 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Fix a word-processor-generated styles.odt for odtwriter use: Drop page size 9 | specifications from styles.xml in STYLE_FILE.odt. 10 | """ 11 | 12 | # 13 | # Author: Michael Schutte <michi@uiae.at> 14 | 15 | from lxml import etree 16 | import sys 17 | import zipfile 18 | from tempfile import mkstemp 19 | import shutil 20 | import os 21 | 22 | NAMESPACES = { 23 | "style": "urn:oasis:names:tc:opendocument:xmlns:style:1.0", 24 | "fo": "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 25 | } 26 | 27 | def prepstyle(filename): 28 | 29 | zin = zipfile.ZipFile(filename) 30 | styles = zin.read("styles.xml") 31 | 32 | root = etree.fromstring(styles) 33 | for el in root.xpath("//style:page-layout-properties", 34 | namespaces=NAMESPACES): 35 | for attr in el.attrib: 36 | if attr.startswith("{%s}" % NAMESPACES["fo"]): 37 | del el.attrib[attr] 38 | 39 | tempname = mkstemp() 40 | zout = zipfile.ZipFile(os.fdopen(tempname[0], "w"), "w", 41 | zipfile.ZIP_DEFLATED) 42 | 43 | for item in zin.infolist(): 44 | if item.filename == "styles.xml": 45 | zout.writestr(item, etree.tostring(root)) 46 | else: 47 | zout.writestr(item, zin.read(item.filename)) 48 | 49 | zout.close() 50 | zin.close() 51 | shutil.move(tempname[1], filename) 52 | 53 | 54 | def main(): 55 | args = sys.argv[1:] 56 | if len(args) != 1: 57 | print >> sys.stderr, __doc__ 58 | print >> sys.stderr, "Usage: %s STYLE_FILE.odt\n" % sys.argv[0] 59 | sys.exit(1) 60 | filename = args[0] 61 | prepstyle(filename) 62 | 63 | if __name__ == '__main__': 64 | main() 65 | 66 | 67 | # vim:tw=78:sw=4:sts=4:et: 68 | -------------------------------------------------------------------------------- /docs/user/rst/images/biohazard-bitmap-scaling.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> 3 | 4 | <svg 5 | xmlns:dc="http://purl.org/dc/elements/1.1/" 6 | xmlns:cc="http://creativecommons.org/ns#" 7 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 8 | xmlns:svg="http://www.w3.org/2000/svg" 9 | xmlns="http://www.w3.org/2000/svg" 10 | xmlns:xlink="http://www.w3.org/1999/xlink" 11 | version="1.1" 12 | viewBox="0 0 16 16" 13 | width="100%" 14 | height="100%" 15 | id="svg2"> 16 | <metadata 17 | id="metadata8"> 18 | <rdf:RDF> 19 | <cc:Work 20 | rdf:about=""> 21 | <dc:format>image/svg+xml</dc:format> 22 | <dc:type 23 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 24 | <dc:title></dc:title> 25 | </cc:Work> 26 | </rdf:RDF> 27 | </metadata> 28 | <defs 29 | id="defs6" /> 30 | <image 31 | xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAIRJREFU 32 | OI2lUkEOwCAIa83+/+XusGCQIWOxF1GhUICSEEFSkvj1BgCjEwwAkkjylW0hyByyBP5+dR2zqrYE 33 | ux5kvq8e/AVtCh39HlbhqIIlcafdx+jxFezs2BY3fDkxO0lVezElnGA2MWrzmxftkiASxZIjjiWk 34 | BNlYd6NeJCyzLVbZ/92om331AFqcoAAAAABJRU5ErkJggg== 35 | " 36 | x="4.9541664" 37 | y="-5.2426963" 38 | width="11.322034" 39 | height="9.3559322" 40 | transform="matrix(0.77695327,0.62955828,-0.62955828,0.77695327,0,0)" 41 | id="image10" /> 42 | <text 43 | x="0.40677962" 44 | y="15.186441" 45 | id="text2987" 46 | xml:space="preserve" 47 | style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan 48 | x="0.40677962" 49 | y="15.186441" 50 | id="tspan2989">turned</tspan></text> 51 | </svg> 52 | -------------------------------------------------------------------------------- /docutils/languages/ko.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # $Id: ko.py 8253 2019-04-15 10:01:10Z milde $ 3 | # Author: Thomas SJ Kang <thomas.kangsj@ujuc.kr> 4 | # Copyright: This module has been placed in the public domain. 5 | 6 | # New language mappings are welcome. Before doing a new translation, please 7 | # read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be 8 | # translated for each language: one in docutils/languages, the other in 9 | # docutils/parsers/rst/languages. 10 | 11 | """ 12 | Korean-language mappings for language-dependent features of Docutils. 13 | """ 14 | 15 | __docformat__ = 'reStructuredText' 16 | 17 | labels = { 18 | # fixed: language-dependent 19 | 'author': u'저자', 20 | 'authors': u'저자들', 21 | 'organization': u'조직', 22 | 'address': u'주소', 23 | 'contact': u'연락처', 24 | 'version': 'Version', 25 | 'revision': 'Revision', 26 | 'status': u'상태', 27 | 'date': u'날짜', 28 | 'copyright': u'저작권', 29 | 'dedication': u'헌정', 30 | 'abstract': u'요약', 31 | 'attention': u'집중!', 32 | 'caution': u'주의!', 33 | 'danger': u'!위험!', 34 | 'error': u'오류', 35 | 'hint': u'실마리', 36 | 'important': u'중요한', 37 | 'note': u'비고', 38 | 'tip': u'팁', 39 | 'warning': u'경고', 40 | 'contents': u'목차'} 41 | """Mapping of node class name to label text.""" 42 | 43 | bibliographic_fields = { 44 | # language-dependent: fixed 45 | u'저자': 'author', 46 | u'저자들': 'authors', 47 | u'조직': 'organization', 48 | u'주소': 'address', 49 | u'연락처': 'contact', 50 | u'version': 'version', 51 | u'revision': 'revision', 52 | u'상태': 'status', 53 | u'날짜': 'date', 54 | u'저작권': 'copyright', 55 | u'헌정': 'dedication', 56 | u'요약': 'abstract'} 57 | """Korean to canonical name mapping for bibliographic fields.""" 58 | 59 | author_separators = [';', ','] 60 | """List of separator strings for the 'Authors' bibliographic field. Tried in 61 | order.""" 62 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isocyr2.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | <http://www.w3.org/2003/entities/xml/>. 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | <http://docutils.sourceforge.net>. 6 | 7 | .. |DJcy| unicode:: U+00402 .. CYRILLIC CAPITAL LETTER DJE 8 | .. |djcy| unicode:: U+00452 .. CYRILLIC SMALL LETTER DJE 9 | .. |DScy| unicode:: U+00405 .. CYRILLIC CAPITAL LETTER DZE 10 | .. |dscy| unicode:: U+00455 .. CYRILLIC SMALL LETTER DZE 11 | .. |DZcy| unicode:: U+0040F .. CYRILLIC CAPITAL LETTER DZHE 12 | .. |dzcy| unicode:: U+0045F .. CYRILLIC SMALL LETTER DZHE 13 | .. |GJcy| unicode:: U+00403 .. CYRILLIC CAPITAL LETTER GJE 14 | .. |gjcy| unicode:: U+00453 .. CYRILLIC SMALL LETTER GJE 15 | .. |Iukcy| unicode:: U+00406 .. CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 16 | .. |iukcy| unicode:: U+00456 .. CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 17 | .. |Jsercy| unicode:: U+00408 .. CYRILLIC CAPITAL LETTER JE 18 | .. |jsercy| unicode:: U+00458 .. CYRILLIC SMALL LETTER JE 19 | .. |Jukcy| unicode:: U+00404 .. CYRILLIC CAPITAL LETTER UKRAINIAN IE 20 | .. |jukcy| unicode:: U+00454 .. CYRILLIC SMALL LETTER UKRAINIAN IE 21 | .. |KJcy| unicode:: U+0040C .. CYRILLIC CAPITAL LETTER KJE 22 | .. |kjcy| unicode:: U+0045C .. CYRILLIC SMALL LETTER KJE 23 | .. |LJcy| unicode:: U+00409 .. CYRILLIC CAPITAL LETTER LJE 24 | .. |ljcy| unicode:: U+00459 .. CYRILLIC SMALL LETTER LJE 25 | .. |NJcy| unicode:: U+0040A .. CYRILLIC CAPITAL LETTER NJE 26 | .. |njcy| unicode:: U+0045A .. CYRILLIC SMALL LETTER NJE 27 | .. |TSHcy| unicode:: U+0040B .. CYRILLIC CAPITAL LETTER TSHE 28 | .. |tshcy| unicode:: U+0045B .. CYRILLIC SMALL LETTER TSHE 29 | .. |Ubrcy| unicode:: U+0040E .. CYRILLIC CAPITAL LETTER SHORT U 30 | .. |ubrcy| unicode:: U+0045E .. CYRILLIC SMALL LETTER SHORT U 31 | .. |YIcy| unicode:: U+00407 .. CYRILLIC CAPITAL LETTER YI 32 | .. |yicy| unicode:: U+00457 .. CYRILLIC SMALL LETTER YI 33 | -------------------------------------------------------------------------------- /test/functional/expected/compact_lists.html: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8" ?> 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 4 | <head> 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 | <meta name="generator" content="Docutils 0.15: http://docutils.sourceforge.net/" /> 7 | <title>compact_lists.txt 8 | 9 | 10 | 11 |
12 | 13 | 14 |
    15 |
  • This is an ordinary simple bullet list.
  • 16 |
  • It should be made compact (<p> & </p> tags omitted).
  • 17 |
18 |
19 |
    20 |
  • This is a bullet list that is not simple.

    21 |

    There are multiple paragraphs in some items.

    22 |
  • 23 |
  • It should not be made compact.

    24 |
  • 25 |
  • Even though some items may have only one paragraph.

    26 |
  • 27 |
28 |
29 |
    30 |
  • This is a simple bullet list, but class="open" is set.

    31 |
  • 32 |
  • It should not be made compact.

    33 |
  • 34 |
35 |
36 |
    37 |
  • This is a bullet list that is not simple.

    There are multiple paragraphs in some items.

    38 |
  • 39 |
  • However, the class="compact" setting will cause 40 | all first paragraph's <p> & </p> tags to be omitted.
  • 41 |
  • Items with multiple paragraphs will not appear changed.
  • 42 |
  • Items may have one paragraph, or multiple.

    Items with multiple paragraphs will still be followed 43 | by vertical whitespace because of the later paragraphs.

    44 |
  • 45 |
  • The effect is interesting.
  • 46 |
47 |
48 | 49 | 50 | -------------------------------------------------------------------------------- /test/functional/expected/cyrillic.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,russian]{article} 2 | % generated by Docutils 3 | \usepackage{cmap} % fix search and cut-and-paste in Acrobat 4 | \usepackage{ifthen} 5 | \usepackage[T1,T2A]{fontenc} 6 | \usepackage[utf8]{inputenc} 7 | \usepackage[english,russian]{babel} 8 | \setcounter{secnumdepth}{0} 9 | 10 | %%% Custom LaTeX preamble 11 | % PDF Standard Fonts 12 | \usepackage{mathptmx} % Times 13 | \usepackage[scaled=.90]{helvet} 14 | \usepackage{courier} 15 | 16 | %%% User specified packages and stylesheets 17 | \usepackage{cmlgc} 18 | 19 | %%% Fallback definitions for Docutils-specific commands 20 | 21 | % titlereference role 22 | \providecommand*{\DUroletitlereference}[1]{\textsl{#1}} 23 | 24 | % hyperlinks: 25 | \ifthenelse{\isundefined{\hypersetup}}{ 26 | \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,unicode=true]{hyperref} 27 | \usepackage{bookmark} 28 | \urlstyle{same} % normal text font (alternatives: tt, rm, sf) 29 | }{} 30 | 31 | %%% Body 32 | \begin{document} 33 | 34 | 35 | \section{Заголовок% 36 | \label{id1}% 37 | } 38 | 39 | первый пример: «Здравствуй, мир!» 40 | 41 | 42 | \section{Title% 43 | \label{title}% 44 | } 45 | 46 | \foreignlanguage{english}{first example: “Hello world”.} 47 | 48 | 49 | \section{Notes% 50 | \label{notes}% 51 | } 52 | 53 | \foreignlanguage{english}{This example tests rendering of Latin and Cyrillic characters by the LaTeX 54 | and XeTeX writers. Check the compiled PDF for garbage characters in text and 55 | bookmarks.} 56 | 57 | \foreignlanguage{english}{To work around a problem with Cyrillic in PDF-bookmarks in \DUroletitlereference{hyperref} 58 | versions older than v6.79g 2009/11/20, the test caller \texttt{latex\_cyrillic.py} 59 | sets \texttt{hyperref\_options} to \texttt{'unicode=true'} while \texttt{xetex\_cyrillic.py} 60 | sets it to \texttt{'unicode=false'}. The recommended option for current 61 | (2011-08-24) hyperref versions is \texttt{'pdfencoding=auto'}.} 62 | 63 | \end{document} 64 | -------------------------------------------------------------------------------- /docutils/languages/ja.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # $Id: ja.py 4564 2006-05-21 20:44:42Z wiemann $ 3 | # Author: Hisashi Morita 4 | # Copyright: This module has been placed in the public domain. 5 | 6 | # New language mappings are welcome. Before doing a new translation, please 7 | # read . Two files must be 8 | # translated for each language: one in docutils/languages, the other in 9 | # docutils/parsers/rst/languages. 10 | 11 | """ 12 | Japanese-language mappings for language-dependent features of Docutils. 13 | """ 14 | 15 | __docformat__ = 'reStructuredText' 16 | 17 | labels = { 18 | # fixed: language-dependent 19 | 'author': u'著者', 20 | 'authors': u'著者', 21 | 'organization': u'組織', 22 | 'address': u'住所', 23 | 'contact': u'連絡先', 24 | 'version': u'バージョン', 25 | 'revision': u'リビジョン', 26 | 'status': u'ステータス', 27 | 'date': u'日付', 28 | 'copyright': u'著作権', 29 | 'dedication': u'献辞', 30 | 'abstract': u'概要', 31 | 'attention': u'注目!', 32 | 'caution': u'注意!', 33 | 'danger': u'!危険!', 34 | 'error': u'エラー', 35 | 'hint': u'ヒント', 36 | 'important': u'重要', 37 | 'note': u'備考', 38 | 'tip': u'通報', 39 | 'warning': u'警告', 40 | 'contents': u'目次'} 41 | """Mapping of node class name to label text.""" 42 | 43 | bibliographic_fields = { 44 | # language-dependent: fixed 45 | u'著者': 'author', 46 | u' n/a': 'authors', 47 | u'組織': 'organization', 48 | u'住所': 'address', 49 | u'連絡先': 'contact', 50 | u'バージョン': 'version', 51 | u'リビジョン': 'revision', 52 | u'ステータス': 'status', 53 | u'日付': 'date', 54 | u'著作権': 'copyright', 55 | u'献辞': 'dedication', 56 | u'概要': 'abstract'} 57 | """Japanese (lowcased) to canonical name mapping for bibliographic fields.""" 58 | 59 | author_separators = [';', ','] 60 | """List of separator strings for the 'Authors' bibliographic field. Tried in 61 | order.""" 62 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_date.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_date.py 7491 2012-08-13 23:30:52Z milde $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the misc.py "date" directive. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | import time 13 | 14 | from docutils.utils.error_reporting import locale_encoding 15 | 16 | def suite(): 17 | s = DocutilsTestSupport.ParserTestSuite() 18 | s.generateTests(totest) 19 | return s 20 | 21 | totest = {} 22 | 23 | totest['date'] = [ 24 | ["""\ 25 | .. |date| date:: 26 | 27 | Today's date is |date|. 28 | """, 29 | """\ 30 | 31 | 32 | %s 33 | 34 | Today's date is \n\ 35 | 36 | date 37 | . 38 | """ % time.strftime('%Y-%m-%d')], 39 | ["""\ 40 | .. |date| date:: %a, %d %b %Y 41 | """, 42 | """\ 43 | 44 | 45 | %s 46 | """ % time.strftime('%a, %d %b %Y')], 47 | ["""\ 48 | .. date:: 49 | """, 50 | """\ 51 | 52 | 53 | 54 | Invalid context: the "date" directive can only be used within a substitution definition. 55 | 56 | .. date:: 57 | """], 58 | ] 59 | 60 | # some locales return non-ASCII characters for names of days or months 61 | if locale_encoding in ['utf8', 'utf-8', 'latin-1']: 62 | totest['decode date'] = [ 63 | [u"""\ 64 | .. |date| date:: t\xc3glich 65 | """, 66 | u"""\ 67 | 68 | 69 | t\xc3glich 70 | """], 71 | ] 72 | 73 | if __name__ == '__main__': 74 | import unittest 75 | unittest.main(defaultTest='suite') 76 | -------------------------------------------------------------------------------- /docutils/languages/it.py: -------------------------------------------------------------------------------- 1 | # $Id: it.py 4564 2006-05-21 20:44:42Z wiemann $ 2 | # Author: Nicola Larosa 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | # New language mappings are welcome. Before doing a new translation, please 6 | # read . Two files must be 7 | # translated for each language: one in docutils/languages, the other in 8 | # docutils/parsers/rst/languages. 9 | 10 | """ 11 | Italian-language mappings for language-dependent features of Docutils. 12 | """ 13 | 14 | __docformat__ = 'reStructuredText' 15 | 16 | labels = { 17 | 'author': 'Autore', 18 | 'authors': 'Autori', 19 | 'organization': 'Organizzazione', 20 | 'address': 'Indirizzo', 21 | 'contact': 'Contatti', 22 | 'version': 'Versione', 23 | 'revision': 'Revisione', 24 | 'status': 'Status', 25 | 'date': 'Data', 26 | 'copyright': 'Copyright', 27 | 'dedication': 'Dedica', 28 | 'abstract': 'Riassunto', 29 | 'attention': 'Attenzione!', 30 | 'caution': 'Cautela!', 31 | 'danger': '!PERICOLO!', 32 | 'error': 'Errore', 33 | 'hint': 'Suggerimento', 34 | 'important': 'Importante', 35 | 'note': 'Nota', 36 | 'tip': 'Consiglio', 37 | 'warning': 'Avvertenza', 38 | 'contents': 'Indice'} 39 | """Mapping of node class name to label text.""" 40 | 41 | bibliographic_fields = { 42 | 'autore': 'author', 43 | 'autori': 'authors', 44 | 'organizzazione': 'organization', 45 | 'indirizzo': 'address', 46 | 'contatto': 'contact', 47 | 'versione': 'version', 48 | 'revisione': 'revision', 49 | 'status': 'status', 50 | 'data': 'date', 51 | 'copyright': 'copyright', 52 | 'dedica': 'dedication', 53 | 'riassunto': 'abstract'} 54 | """Italian (lowcased) to canonical name mapping for bibliographic fields.""" 55 | 56 | author_separators = [';', ','] 57 | """List of separator strings for the 'Authors' bibliographic field. Tried in 58 | order.""" 59 | -------------------------------------------------------------------------------- /docutils/parsers/rst/include/isomopf-wide.txt: -------------------------------------------------------------------------------- 1 | .. This data file has been placed in the public domain. 2 | .. Derived from the Unicode character mappings available from 3 | . 4 | Processed by unicode2rstsubs.py, part of Docutils: 5 | . 6 | 7 | .. |Aopf| unicode:: U+1D538 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL A 8 | .. |Bopf| unicode:: U+1D539 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL B 9 | .. |Copf| unicode:: U+02102 .. DOUBLE-STRUCK CAPITAL C 10 | .. |Dopf| unicode:: U+1D53B .. MATHEMATICAL DOUBLE-STRUCK CAPITAL D 11 | .. |Eopf| unicode:: U+1D53C .. MATHEMATICAL DOUBLE-STRUCK CAPITAL E 12 | .. |Fopf| unicode:: U+1D53D .. MATHEMATICAL DOUBLE-STRUCK CAPITAL F 13 | .. |Gopf| unicode:: U+1D53E .. MATHEMATICAL DOUBLE-STRUCK CAPITAL G 14 | .. |Hopf| unicode:: U+0210D .. DOUBLE-STRUCK CAPITAL H 15 | .. |Iopf| unicode:: U+1D540 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL I 16 | .. |Jopf| unicode:: U+1D541 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL J 17 | .. |Kopf| unicode:: U+1D542 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL K 18 | .. |Lopf| unicode:: U+1D543 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL L 19 | .. |Mopf| unicode:: U+1D544 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL M 20 | .. |Nopf| unicode:: U+02115 .. DOUBLE-STRUCK CAPITAL N 21 | .. |Oopf| unicode:: U+1D546 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL O 22 | .. |Popf| unicode:: U+02119 .. DOUBLE-STRUCK CAPITAL P 23 | .. |Qopf| unicode:: U+0211A .. DOUBLE-STRUCK CAPITAL Q 24 | .. |Ropf| unicode:: U+0211D .. DOUBLE-STRUCK CAPITAL R 25 | .. |Sopf| unicode:: U+1D54A .. MATHEMATICAL DOUBLE-STRUCK CAPITAL S 26 | .. |Topf| unicode:: U+1D54B .. MATHEMATICAL DOUBLE-STRUCK CAPITAL T 27 | .. |Uopf| unicode:: U+1D54C .. MATHEMATICAL DOUBLE-STRUCK CAPITAL U 28 | .. |Vopf| unicode:: U+1D54D .. MATHEMATICAL DOUBLE-STRUCK CAPITAL V 29 | .. |Wopf| unicode:: U+1D54E .. MATHEMATICAL DOUBLE-STRUCK CAPITAL W 30 | .. |Xopf| unicode:: U+1D54F .. MATHEMATICAL DOUBLE-STRUCK CAPITAL X 31 | .. |Yopf| unicode:: U+1D550 .. MATHEMATICAL DOUBLE-STRUCK CAPITAL Y 32 | .. |Zopf| unicode:: U+02124 .. DOUBLE-STRUCK CAPITAL Z 33 | -------------------------------------------------------------------------------- /test/functional/input/data/urls.txt: -------------------------------------------------------------------------------- 1 | External references 2 | ------------------- 3 | 4 | Long URLs should be wrapped in the PDF. This can be achieved with the 5 | ``\url`` command which is used by the LaTeX writer whenever the content 6 | (name) of a reference node equals the link URL. 7 | 8 | Example: 9 | a long URL that should wrap in the output 10 | http://docutils.sourceforge.net/docs/user/latex.html#id79 11 | 12 | 13 | If the argument contains any "%", "#", or "^^", or ends with ``\``, it can't 14 | be used in the argument to another command. The argument must not contain 15 | unbalanced braces. 16 | 17 | The characters ^, {, }, and ``\`` are invalid in a "http:" or "ftp:" URL 18 | and not recognized as part of it: 19 | 20 | | http://www.example.org/strange^^name 21 | | http://www.example.org\\using\\DOS\\paths\\ 22 | | http://www.example.org/XML/strange{n}ame 23 | 24 | They can, however be used in paths and/or filenames. 25 | 26 | Handling by the LaTeX writer: 27 | 28 | * ``#``, ``\`` and ``%`` are escaped: 29 | 30 | | `URL with # `__ 31 | http://www.w3.org/XML/Schema#dev 32 | | `URL with % `__ 33 | http://example.org/Schema%dev 34 | | `file with DOS path`__ `A:DOS\\path\\`__ 35 | 36 | .. note:: These URLs are typeset inside a LaTeX command without error. 37 | 38 | | http://www.w3.org/XML/Schema#dev 39 | | http://example.org/Schema%dev 40 | | `A:DOS\\path\\`__ 41 | 42 | __ 43 | __ 44 | __ A:DOS\\path\\ 45 | 46 | 47 | * ``^^`` LaTeX's special syntax for characters results in "strange" replacements 48 | (both with ``\href`` and ``\url``). A warning is given. 49 | 50 | `file with ^^ <../strange^^name>`__: 51 | `<../strange^^name>`__ 52 | 53 | * Unbalanced braces, { or }, will fail (both with ``\href`` and ``\url``):: 54 | 55 | `file with { <../strange{name>`__ 56 | `<../strange{name>`__ 57 | 58 | while balanced braces are suported: 59 | 60 | | `<../strange{n}ame>`__ 61 | | `<../st{r}ange{n}ame>`__ 62 | | `<../{st{r}ange{n}ame}>`__ 63 | -------------------------------------------------------------------------------- /docutils/languages/af.py: -------------------------------------------------------------------------------- 1 | # $Id: af.py 4564 2006-05-21 20:44:42Z wiemann $ 2 | # Author: Jannie Hofmeyr 3 | # Copyright: This module has been placed in the public domain. 4 | 5 | # New language mappings are welcome. Before doing a new translation, please 6 | # read . Two files must be 7 | # translated for each language: one in docutils/languages, the other in 8 | # docutils/parsers/rst/languages. 9 | 10 | """ 11 | Afrikaans-language mappings for language-dependent features of Docutils. 12 | """ 13 | 14 | __docformat__ = 'reStructuredText' 15 | 16 | labels = { 17 | 'author': 'Auteur', 18 | 'authors': 'Auteurs', 19 | 'organization': 'Organisasie', 20 | 'address': 'Adres', 21 | 'contact': 'Kontak', 22 | 'version': 'Weergawe', 23 | 'revision': 'Revisie', 24 | 'status': 'Status', 25 | 'date': 'Datum', 26 | 'copyright': 'Kopiereg', 27 | 'dedication': 'Opdrag', 28 | 'abstract': 'Opsomming', 29 | 'attention': 'Aandag!', 30 | 'caution': 'Wees versigtig!', 31 | 'danger': '!GEVAAR!', 32 | 'error': 'Fout', 33 | 'hint': 'Wenk', 34 | 'important': 'Belangrik', 35 | 'note': 'Nota', 36 | 'tip': 'Tip', # hint and tip both have the same translation: wenk 37 | 'warning': 'Waarskuwing', 38 | 'contents': 'Inhoud'} 39 | """Mapping of node class name to label text.""" 40 | 41 | bibliographic_fields = { 42 | 'auteur': 'author', 43 | 'auteurs': 'authors', 44 | 'organisasie': 'organization', 45 | 'adres': 'address', 46 | 'kontak': 'contact', 47 | 'weergawe': 'version', 48 | 'revisie': 'revision', 49 | 'status': 'status', 50 | 'datum': 'date', 51 | 'kopiereg': 'copyright', 52 | 'opdrag': 'dedication', 53 | 'opsomming': 'abstract'} 54 | """Afrikaans (lowcased) to canonical name mapping for bibliographic fields.""" 55 | 56 | author_separators = [';', ','] 57 | """List of separator strings for the 'Authors' bibliographic field. Tried in 58 | order.""" 59 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_parsed_literals.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_parsed_literals.py 7072 2011-07-06 15:52:30Z milde $ 4 | # Author: Lea Wiemann 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the body.py 'parsed-literal' directive. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['parsed_literals'] = [ 21 | ["""\ 22 | .. parsed-literal:: 23 | 24 | This is a parsed literal block. 25 | It may contain *inline markup 26 | spanning lines.* 27 | """, 28 | """\ 29 | 30 | 31 | This is a parsed literal block. 32 | It may contain \n\ 33 | 34 | inline markup 35 | spanning lines. 36 | """], 37 | ["""\ 38 | .. parsed-literal:: 39 | :class: myliteral 40 | :name: example: parsed 41 | 42 | This is a parsed literal block with options. 43 | """, 44 | """\ 45 | 46 | 47 | This is a parsed literal block with options. 48 | """], 49 | ["""\ 50 | .. parsed-literal:: content may start on same line 51 | """, 52 | """\ 53 | 54 | 55 | content may start on same line 56 | """], 57 | ["""\ 58 | .. parsed-literal:: 59 | """, 60 | """\ 61 | 62 | 63 | 64 | Content block expected for the "parsed-literal" directive; none found. 65 | 66 | .. parsed-literal:: 67 | """], 68 | ] 69 | 70 | 71 | if __name__ == '__main__': 72 | import unittest 73 | unittest.main(defaultTest='suite') 74 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_code_none.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_code_none.py 7221 2011-11-15 07:49:01Z milde $ 4 | # Author: Guenter Milde 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Test the 'code' directive in body.py with syntax_highlight = 'none'. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite(suite_settings={'syntax_highlight':'none'}) 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['code-parsing-none'] = [ 21 | ["""\ 22 | .. code:: 23 | 24 | This is a code block. 25 | """, 26 | """\ 27 | 28 | 29 | This is a code block. 30 | """], 31 | ["""\ 32 | .. code:: python 33 | :number-lines: 7 34 | 35 | def my_function(): 36 | '''Test the lexer. 37 | ''' 38 | 39 | # and now for something completely different 40 | print 8/2 41 | """, 42 | """\ 43 | 44 | 45 | 46 | 7 \n\ 47 | def my_function(): 48 | 49 | 8 \n\ 50 | \'\'\'Test the lexer. 51 | 52 | 9 \n\ 53 | \'\'\' 54 | 55 | 10 \n\ 56 | \n\ 57 | 58 | 11 \n\ 59 | # and now for something completely different 60 | 61 | 12 \n\ 62 | print 8/2 63 | """], 64 | ["""\ 65 | .. code:: latex 66 | 67 | hello \emph{world} % emphasize 68 | """, 69 | """\ 70 | 71 | 72 | hello \\emph{world} % emphasize 73 | """], 74 | ] 75 | 76 | 77 | if __name__ == '__main__': 78 | import unittest 79 | unittest.main(defaultTest='suite') 80 | -------------------------------------------------------------------------------- /test/test_parsers/test_rst/test_directives/test_target_notes.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # $Id: test_target_notes.py 7062 2011-06-30 22:14:29Z milde $ 4 | # Author: David Goodger 5 | # Copyright: This module has been placed in the public domain. 6 | 7 | """ 8 | Tests for the target-notes directives. 9 | """ 10 | 11 | from __init__ import DocutilsTestSupport 12 | 13 | def suite(): 14 | s = DocutilsTestSupport.ParserTestSuite() 15 | s.generateTests(totest) 16 | return s 17 | 18 | totest = {} 19 | 20 | totest['target-notes'] = [ 21 | ["""\ 22 | .. target-notes:: 23 | """, 24 | """\ 25 | 26 | 27 | .. internal attributes: 28 | .transform: docutils.transforms.references.TargetNotes 29 | .details: 30 | """], 31 | ["""\ 32 | .. target-notes:: :class: custom 33 | """, 34 | """\ 35 | 36 | 37 | .. internal attributes: 38 | .transform: docutils.transforms.references.TargetNotes 39 | .details: 40 | class: ['custom'] 41 | """], 42 | ["""\ 43 | .. target-notes:: 44 | :class: custom 45 | :name: targets 46 | """, 47 | """\ 48 | 49 | 50 | .. internal attributes: 51 | .transform: docutils.transforms.references.TargetNotes 52 | .details: 53 | class: ['custom'] 54 | """], 55 | ["""\ 56 | .. target-notes:: 57 | :class: 58 | """, 59 | """\ 60 | 61 | 62 | 63 | Error in "target-notes" directive: 64 | invalid option value: (option: "class"; value: None) 65 | argument required but none supplied. 66 | 67 | .. target-notes:: 68 | :class: 69 | """], 70 | ] 71 | 72 | 73 | if __name__ == '__main__': 74 | import unittest 75 | unittest.main(defaultTest='suite') 76 | --------------------------------------------------------------------------------