├── test
└── temp
├── .nojekyll
├── PyLit.egg-info
├── top_level.txt
├── dependency_links.txt
├── SOURCES.txt
└── PKG-INFO
├── pylit.egg-info
├── top_level.txt
├── dependency_links.txt
├── SOURCES.txt
└── PKG-INFO
├── _build
├── html
│ ├── _static
│ │ ├── custom.css
│ │ ├── up.png
│ │ ├── down.png
│ │ ├── file.png
│ │ ├── plus.png
│ │ ├── comment.png
│ │ ├── favicon.ico
│ │ ├── minus.png
│ │ ├── ajax-loader.gif
│ │ ├── down-pressed.png
│ │ ├── up-pressed.png
│ │ ├── comment-bright.png
│ │ ├── comment-close.png
│ │ ├── documentation_options.js
│ │ └── pygments.css
│ ├── objects.inv
│ ├── tutorial
│ │ ├── hello.py
│ │ ├── greeting.py
│ │ ├── greeting.py.txt
│ │ ├── hello.py.txt
│ │ ├── hello_with_header.py
│ │ ├── hello_with_header.py.txt
│ │ ├── hello_2.py.txt
│ │ ├── hello_2.py
│ │ ├── hello_multifile.py
│ │ ├── hello_multifile.py.txt
│ │ ├── hello_with_doctest.py.txt
│ │ ├── hello_with_doctest_2.py.txt
│ │ ├── hello_with_doctest.py
│ │ ├── hello_with_doctest_2.py
│ │ └── hello_with_doctest_2.py.html
│ ├── _sources
│ │ ├── tutorial
│ │ │ ├── greeting.py.txt
│ │ │ ├── hello.py.txt
│ │ │ ├── hello_with_header.py.txt
│ │ │ ├── hello_2.py.txt
│ │ │ ├── hello_multifile.py.txt
│ │ │ ├── hello_with_doctest.py.txt
│ │ │ └── hello_with_doctest_2.py.txt
│ │ ├── _build
│ │ │ └── html
│ │ │ │ ├── tutorial
│ │ │ │ ├── greeting.py.txt
│ │ │ │ ├── hello.py.txt
│ │ │ │ ├── hello_with_header.py.txt
│ │ │ │ ├── hello_2.py.txt
│ │ │ │ ├── hello_multifile.py.txt
│ │ │ │ ├── hello_with_doctest.py.txt
│ │ │ │ └── hello_with_doctest_2.py.txt
│ │ │ │ └── examples
│ │ │ │ ├── palatino-helvetica-courier.sty.txt
│ │ │ │ ├── setup.py.txt
│ │ │ │ ├── iterqueue_speed_test.py.txt
│ │ │ │ ├── listings-python-options.sty.txt
│ │ │ │ ├── 99bottles.py.txt
│ │ │ │ ├── pygments-default.css.txt
│ │ │ │ ├── testmod_literate.py.txt
│ │ │ │ └── listings-tex-options.sty.txt
│ │ ├── updates.txt
│ │ ├── filename-extensions.txt
│ │ ├── examples
│ │ │ ├── palatino-helvetica-courier.sty.txt
│ │ │ ├── setup.py.txt
│ │ │ ├── iterqueue_speed_test.py.txt
│ │ │ ├── listings-python-options.sty.txt
│ │ │ ├── 99bottles.py.txt
│ │ │ ├── pygments-default.css.txt
│ │ │ ├── testmod_literate.py.txt
│ │ │ └── listings-tex-options.sty.txt
│ │ ├── download
│ │ │ └── index.txt
│ │ ├── index.txt
│ │ └── usage.txt
│ ├── .buildinfo
│ ├── download
│ │ └── pylit
│ ├── examples
│ │ ├── palatino-helvetica-courier.sty.txt
│ │ ├── setup.py.txt
│ │ ├── iterqueue_speed_test.py.txt
│ │ ├── listings-python-options.sty.txt
│ │ ├── 99bottles.py.txt
│ │ ├── pygments-default.css.txt
│ │ ├── testmod_literate.py.txt
│ │ └── listings-tex-options.sty.txt
│ └── _build
│ │ └── html
│ │ └── tutorial
│ │ └── greeting.py.html
└── doctrees
│ ├── conf.py.doctree
│ ├── index.doctree
│ ├── updates.doctree
│ ├── usage.doctree
│ ├── features.doctree
│ ├── environment.pickle
│ ├── download
│ └── index.doctree
│ ├── examples
│ ├── index.doctree
│ ├── pylit.py.doctree
│ ├── setup.py.doctree
│ ├── 99bottles.py.doctree
│ ├── iterqueue.py.doctree
│ ├── pylit_test.py.doctree
│ ├── simplestates.py.doctree
│ ├── iterqueue_test.py.doctree
│ ├── literate-doctests.doctree
│ ├── pygments-default.css.doctree
│ ├── simplestates_test.py.doctree
│ ├── testfile_literate.py.doctree
│ ├── testmod_literate.py.doctree
│ ├── iterqueue_speed_test.py.doctree
│ ├── listings-tex-options.sty.doctree
│ ├── listings-python-options.sty.doctree
│ └── palatino-helvetica-courier.sty.doctree
│ ├── tutorial
│ ├── index.doctree
│ ├── hello.py.doctree
│ ├── hello_2.py.doctree
│ ├── greeting.py.doctree
│ ├── hello_multifile.py.doctree
│ ├── hello_with_header.py.doctree
│ ├── hello_with_doctest.py.doctree
│ └── hello_with_doctest_2.py.doctree
│ ├── filename-extensions.doctree
│ └── literate-programming.doctree
├── docs
├── favicon.ico
├── tutorial
│ ├── hello.py
│ ├── greeting.py
│ ├── greeting.py.txt
│ ├── hello.py.txt
│ ├── hello_with_header.py
│ ├── hello_with_header.py.txt
│ ├── hello_2.py
│ ├── hello_2.py.txt
│ ├── hello_multifile.py
│ ├── hello_multifile.py.txt
│ ├── hello_with_doctest.py.txt
│ ├── hello_with_doctest.py
│ ├── hello_with_doctest_2.py.txt
│ └── hello_with_doctest_2.py
├── download
│ ├── pylit
│ └── index.txt
├── updates.txt
├── filename-extensions.txt
├── examples
│ ├── palatino-helvetica-courier.sty.txt
│ ├── setup.py.txt
│ ├── iterqueue_speed_test.py
│ ├── iterqueue_speed_test.py.txt
│ ├── listings-python-options.sty.txt
│ ├── 99bottles.py
│ ├── 99bottles.py.txt
│ ├── pygments-default.css.txt
│ ├── testmod_literate.py.txt
│ ├── testmod_literate.py
│ └── listings-tex-options.sty.txt
├── index.txt
├── .templates
│ └── layout.html
├── pylit.css
└── usage.txt
├── dist
├── PyLit-3.1.1.tar.gz
└── pylit-3.1.1.tar.gz
├── tox.ini
├── .gitignore
├── index.html
├── README.rst
├── setup.py
└── contribs
├── pylit_elisp.py
└── test_filters.py
/test/temp:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.nojekyll:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/PyLit.egg-info/top_level.txt:
--------------------------------------------------------------------------------
1 | pylit
2 |
--------------------------------------------------------------------------------
/pylit.egg-info/top_level.txt:
--------------------------------------------------------------------------------
1 | pylit
2 |
--------------------------------------------------------------------------------
/PyLit.egg-info/dependency_links.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/pylit.egg-info/dependency_links.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/_build/html/_static/custom.css:
--------------------------------------------------------------------------------
1 | /* This file intentionally left blank. */
2 |
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/docs/favicon.ico
--------------------------------------------------------------------------------
/_build/html/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/objects.inv
--------------------------------------------------------------------------------
/dist/PyLit-3.1.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/dist/PyLit-3.1.1.tar.gz
--------------------------------------------------------------------------------
/dist/pylit-3.1.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/dist/pylit-3.1.1.tar.gz
--------------------------------------------------------------------------------
/_build/html/_static/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/up.png
--------------------------------------------------------------------------------
/_build/html/_static/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/down.png
--------------------------------------------------------------------------------
/_build/html/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/file.png
--------------------------------------------------------------------------------
/_build/html/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/plus.png
--------------------------------------------------------------------------------
/docs/tutorial/hello.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python3
2 |
3 | print( "Hello world." )
4 |
--------------------------------------------------------------------------------
/_build/doctrees/conf.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/conf.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/index.doctree
--------------------------------------------------------------------------------
/_build/doctrees/updates.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/updates.doctree
--------------------------------------------------------------------------------
/_build/doctrees/usage.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/usage.doctree
--------------------------------------------------------------------------------
/_build/html/_static/comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/comment.png
--------------------------------------------------------------------------------
/_build/html/_static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/favicon.ico
--------------------------------------------------------------------------------
/_build/html/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/minus.png
--------------------------------------------------------------------------------
/_build/html/tutorial/hello.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python3
2 |
3 | print( "Hello world." )
4 |
--------------------------------------------------------------------------------
/docs/tutorial/greeting.py:
--------------------------------------------------------------------------------
1 | # a friendly greeting stored in a variable ::
2 |
3 | greeting = "Hello world."
4 |
--------------------------------------------------------------------------------
/_build/doctrees/features.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/features.doctree
--------------------------------------------------------------------------------
/_build/html/tutorial/greeting.py:
--------------------------------------------------------------------------------
1 | # a friendly greeting stored in a variable ::
2 |
3 | greeting = "Hello world."
4 |
--------------------------------------------------------------------------------
/docs/tutorial/greeting.py.txt:
--------------------------------------------------------------------------------
1 | a friendly greeting stored in a variable ::
2 |
3 | greeting = "Hello world."
4 |
--------------------------------------------------------------------------------
/_build/doctrees/environment.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/environment.pickle
--------------------------------------------------------------------------------
/_build/html/_static/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/ajax-loader.gif
--------------------------------------------------------------------------------
/_build/html/_static/down-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/down-pressed.png
--------------------------------------------------------------------------------
/_build/html/_static/up-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/up-pressed.png
--------------------------------------------------------------------------------
/_build/html/tutorial/greeting.py.txt:
--------------------------------------------------------------------------------
1 | a friendly greeting stored in a variable ::
2 |
3 | greeting = "Hello world."
4 |
--------------------------------------------------------------------------------
/docs/tutorial/hello.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | ::
4 |
5 | print( "Hello world." )
6 |
--------------------------------------------------------------------------------
/_build/doctrees/download/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/download/index.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/index.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/index.doctree
--------------------------------------------------------------------------------
/_build/html/_static/comment-bright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/comment-bright.png
--------------------------------------------------------------------------------
/_build/html/_static/comment-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/html/_static/comment-close.png
--------------------------------------------------------------------------------
/_build/doctrees/examples/pylit.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/pylit.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/setup.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/setup.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/hello.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/hello.py.doctree
--------------------------------------------------------------------------------
/_build/html/_sources/tutorial/greeting.py.txt:
--------------------------------------------------------------------------------
1 | a friendly greeting stored in a variable ::
2 |
3 | greeting = "Hello world."
4 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | ::
4 |
5 | print( "Hello world." )
6 |
--------------------------------------------------------------------------------
/_build/doctrees/filename-extensions.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/filename-extensions.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/hello_2.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/hello_2.py.doctree
--------------------------------------------------------------------------------
/_build/html/_sources/tutorial/hello.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | ::
4 |
5 | print( "Hello world." )
6 |
--------------------------------------------------------------------------------
/_build/doctrees/examples/99bottles.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/99bottles.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/iterqueue.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/iterqueue.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/pylit_test.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/pylit_test.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/literate-programming.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/literate-programming.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/greeting.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/greeting.py.doctree
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/tutorial/greeting.py.txt:
--------------------------------------------------------------------------------
1 | a friendly greeting stored in a variable ::
2 |
3 | greeting = "Hello world."
4 |
--------------------------------------------------------------------------------
/_build/doctrees/examples/simplestates.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/simplestates.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/iterqueue_test.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/iterqueue_test.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/literate-doctests.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/literate-doctests.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/hello_multifile.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/hello_multifile.py.doctree
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/tutorial/hello.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | ::
4 |
5 | print( "Hello world." )
6 |
--------------------------------------------------------------------------------
/_build/doctrees/examples/pygments-default.css.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/pygments-default.css.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/simplestates_test.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/simplestates_test.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/testfile_literate.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/testfile_literate.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/testmod_literate.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/testmod_literate.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/hello_with_header.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/hello_with_header.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/iterqueue_speed_test.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/iterqueue_speed_test.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/hello_with_doctest.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/hello_with_doctest.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/tutorial/hello_with_doctest_2.py.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/tutorial/hello_with_doctest_2.py.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/listings-tex-options.sty.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/listings-tex-options.sty.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/listings-python-options.sty.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/listings-python-options.sty.doctree
--------------------------------------------------------------------------------
/_build/doctrees/examples/palatino-helvetica-courier.sty.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/slott56/PyLit-3/HEAD/_build/doctrees/examples/palatino-helvetica-courier.sty.doctree
--------------------------------------------------------------------------------
/docs/tutorial/hello_with_header.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | # The classical programming example in Python3::
5 |
6 | print( "Hello world." )
7 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_with_header.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | # The classical programming example in Python3::
5 |
6 | print( "Hello world." )
7 |
--------------------------------------------------------------------------------
/PyLit.egg-info/SOURCES.txt:
--------------------------------------------------------------------------------
1 | README.rst
2 | pylit.py
3 | setup.py
4 | pylit.egg-info/PKG-INFO
5 | pylit.egg-info/SOURCES.txt
6 | pylit.egg-info/dependency_links.txt
7 | pylit.egg-info/top_level.txt
--------------------------------------------------------------------------------
/docs/tutorial/hello_with_header.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | The classical programming example in Python3::
5 |
6 | print( "Hello world." )
7 |
--------------------------------------------------------------------------------
/pylit.egg-info/SOURCES.txt:
--------------------------------------------------------------------------------
1 | README.rst
2 | pylit.py
3 | setup.py
4 | pylit.egg-info/PKG-INFO
5 | pylit.egg-info/SOURCES.txt
6 | pylit.egg-info/dependency_links.txt
7 | pylit.egg-info/top_level.txt
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_with_header.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | The classical programming example in Python3::
5 |
6 | print( "Hello world." )
7 |
--------------------------------------------------------------------------------
/_build/html/_sources/tutorial/hello_with_header.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | The classical programming example in Python3::
5 |
6 | print( "Hello world." )
7 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/tutorial/hello_with_header.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | The classical programming example in Python3::
5 |
6 | print( "Hello world." )
7 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_2.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python3
2 | #
3 | # Let Python_ print a string literal::
4 |
5 | print( "Hello world." )
6 |
7 | # It's easy, isn't it?
8 | #
9 | # .. _Python: www.python.org
10 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | Let Python_ print a string literal::
4 |
5 | print( "Hello world." )
6 |
7 | It's easy, isn't it?
8 |
9 | .. _Python: www.python.org
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | Let Python_ print a string literal::
4 |
5 | print( "Hello world." )
6 |
7 | It's easy, isn't it?
8 |
9 | .. _Python: www.python.org
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_2.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python3
2 | #
3 | # Let Python_ print a string literal::
4 |
5 | print( "Hello world." )
6 |
7 | # It's easy, isn't it?
8 | #
9 | # .. _Python: www.python.org
10 |
--------------------------------------------------------------------------------
/_build/html/_sources/tutorial/hello_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | Let Python_ print a string literal::
4 |
5 | print( "Hello world." )
6 |
7 | It's easy, isn't it?
8 |
9 | .. _Python: www.python.org
10 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/tutorial/hello_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python3
2 |
3 | Let Python_ print a string literal::
4 |
5 | print( "Hello world." )
6 |
7 | It's easy, isn't it?
8 |
9 | .. _Python: www.python.org
10 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | [tox]
2 | minversion = 3.5.0
3 | envlist = py35, py36, py37
4 |
5 | [testenv]
6 | changedir =
7 | test
8 | install_commands =
9 | python -m pip install pylit
10 | commands =
11 | python pylit_test.py
12 | python pylit_ui_test.py
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | .idea/*
3 | .tox/*
4 | *.pickle
5 | *.buildinfo
6 | *.doctree
7 | *.komodo*
8 | .buildinfo
9 | objects.inv
10 | _build/doctrees/*.doctree
11 | _build/doctrees/*.pickle
12 | _build/doctrees/*/*.doctree
13 | _build/doctrees/*/*.pickle
14 |
--------------------------------------------------------------------------------
/_build/html/.buildinfo:
--------------------------------------------------------------------------------
1 | # Sphinx build info version 1
2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3 | config: d41e8510dae1fe1b361a38537099bab5
4 | tags: 645f666f9bcd5a90fca523b33c5a78b7
5 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_multifile.py:
--------------------------------------------------------------------------------
1 | # The classical programming example with the greeting from a variable in
2 | # another file::
3 |
4 | import greeting
5 | print( greeting.greeting )
6 |
7 | # Where ``greeting.py`` contains:
8 | #
9 | # .. include:: greeting.py.txt
10 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_multifile.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example with the greeting from a variable in
2 | another file::
3 |
4 | import greeting
5 | print( greeting.greeting )
6 |
7 | Where ``greeting.py`` contains:
8 |
9 | .. include:: greeting.py.txt
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_multifile.py:
--------------------------------------------------------------------------------
1 | # The classical programming example with the greeting from a variable in
2 | # another file::
3 |
4 | import greeting
5 | print( greeting.greeting )
6 |
7 | # Where ``greeting.py`` contains:
8 | #
9 | # .. include:: greeting.py.txt
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_multifile.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example with the greeting from a variable in
2 | another file::
3 |
4 | import greeting
5 | print( greeting.greeting )
6 |
7 | Where ``greeting.py`` contains:
8 |
9 | .. include:: greeting.py.txt
10 |
--------------------------------------------------------------------------------
/_build/html/_sources/tutorial/hello_multifile.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example with the greeting from a variable in
2 | another file::
3 |
4 | import greeting
5 | print( greeting.greeting )
6 |
7 | Where ``greeting.py`` contains:
8 |
9 | .. include:: greeting.py.txt
10 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/tutorial/hello_multifile.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example with the greeting from a variable in
2 | another file::
3 |
4 | import greeting
5 | print( greeting.greeting )
6 |
7 | Where ``greeting.py`` contains:
8 |
9 | .. include:: greeting.py.txt
10 |
--------------------------------------------------------------------------------
/docs/download/pylit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | # Load the pylit module::
4 |
5 | import pylit
6 |
7 | # Configure default settings, e.g. ::
8 |
9 | ## pylit.defaults.code_block_marker['c++'] = '.. code-block:: c++'
10 |
11 | # call the text <--> code converter::
12 |
13 | pylit.main()
14 |
--------------------------------------------------------------------------------
/_build/html/download/pylit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | # Load the pylit module::
4 |
5 | import pylit
6 |
7 | # Configure default settings, e.g. ::
8 |
9 | ## pylit.defaults.code_block_marker['c++'] = '.. code-block:: c++'
10 |
11 | # call the text <--> code converter::
12 |
13 | pylit.main()
14 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_with_doctest.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world.
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_with_doctest.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python will print a familiar greeting:
2 | #
3 | # >>> with open("docs/tutorial/hello_with_doctest.py") as source:
4 | # ... exec( compile( source.read(), source.name, 'exec' ) )
5 | # Hello world.
6 | #
7 | # ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_with_doctest_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest_2.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world.
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_with_doctest.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world.
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_with_doctest_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest_2.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world.
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/docs/tutorial/hello_with_doctest_2.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python will print a familiar greeting:
2 | #
3 | # >>> with open("docs/tutorial/hello_with_doctest_2.py") as source:
4 | # ... exec( compile( source.read(), source.name, 'exec' ) )
5 | # Hello world.
6 | #
7 | # ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/_sources/tutorial/hello_with_doctest.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_with_doctest.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python will print a familiar greeting:
2 | #
3 | # >>> with open("docs/tutorial/hello_with_doctest.py") as source:
4 | # ... exec( compile( source.read(), source.name, 'exec' ) )
5 | # Hello world.
6 | #
7 | # ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/_sources/tutorial/hello_with_doctest_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest_2.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world.
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_with_doctest_2.py:
--------------------------------------------------------------------------------
1 | # The classical programming example in Python will print a familiar greeting:
2 | #
3 | # >>> with open("docs/tutorial/hello_with_doctest_2.py") as source:
4 | # ... exec( compile( source.read(), source.name, 'exec' ) )
5 | # Hello world.
6 | #
7 | # ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/tutorial/hello_with_doctest.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/tutorial/hello_with_doctest_2.py.txt:
--------------------------------------------------------------------------------
1 | The classical programming example in Python will print a familiar greeting:
2 |
3 | >>> with open("docs/tutorial/hello_with_doctest_2.py") as source:
4 | ... exec( compile( source.read(), source.name, 'exec' ) )
5 | Hello world.
6 |
7 | ::
8 |
9 | print( "Hello world." )
10 |
--------------------------------------------------------------------------------
/_build/html/_static/documentation_options.js:
--------------------------------------------------------------------------------
1 | var DOCUMENTATION_OPTIONS = {
2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
3 | VERSION: '3.1.1',
4 | LANGUAGE: 'None',
5 | COLLAPSE_INDEX: false,
6 | FILE_SUFFIX: '.html',
7 | HAS_SOURCE: true,
8 | SOURCELINK_SUFFIX: '.txt',
9 | NAVIGATION_WITH_KEYS: false,
10 | };
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | ############
2 | PyLit 3.1
3 | ############
4 |
5 |
6 | See http://slott56.github.io/PyLit-3/index.html for the complete documentation.
7 |
8 | The ``Makefile`` is used via ``make html`` to rebuild the code and documentation.
9 |
10 | The ``docs`` directory contains the documentation, plus many examples.
11 |
12 | The ``pylit.py`` is the module. Once you've installed it, use ``python -m pylit`` to run it.
13 |
14 | The ``test`` directory contains the unit test suite.
15 |
16 | The ``contribs`` directory are old contributed modules which have not yet been
17 | converted to Python3.
18 |
19 | The code repository is: https://github.com/slott56/PyLit-3
20 |
--------------------------------------------------------------------------------
/docs/updates.txt:
--------------------------------------------------------------------------------
1 | Updates
2 | ********
3 |
4 | The PyLit documentation itself is built with Sphinx. It includes the text
5 | version of several modules.
6 |
7 | Here's the test procedure. Note the ``cd`` to change directories. This
8 | assures that PyLit is found in the ``..`` directory.
9 |
10 | .. parsed-literal::
11 |
12 | cd test
13 | python3 pylit_test.py
14 | python3 pylit_ui_test.py
15 |
16 | You can also use tox to run a suite of tests.
17 |
18 | .. parsed-literal::
19 |
20 | tox
21 |
22 | Here's part of the documentation build procedure. It uses PyLit to create source for the documentation.
23 |
24 | - Clone a new document from ``docs/index.txt``
25 |
26 | - Clone a new example from a file in ``docs/examples``
27 |
28 | - Clone a new example from a file in ``test``
29 |
30 | .. parsed-literal::
31 |
32 | python3 pylit.py docs/conf.py
33 | python3 pylit.py pylit.py docs/examples/pylit.py.txt
34 | python3 pylit.py --comment-string='## ' test/pylit_test.py docs/examples/pylit_test.py.txt
35 |
36 | After this, we can manually run Sphinx to rebuild the documentation.
37 |
38 | .. parsed-literal::
39 |
40 | sphinx-build docs _build/html
41 |
42 | We can do this wih the included Makefile, which also converts all of the
43 | tutorials and examples.
44 |
--------------------------------------------------------------------------------
/_build/html/_sources/updates.txt:
--------------------------------------------------------------------------------
1 | Updates
2 | ********
3 |
4 | The PyLit documentation itself is built with Sphinx. It includes the text
5 | version of several modules.
6 |
7 | Here's the test procedure. Note the ``cd`` to change directories. This
8 | assures that PyLit is found in the ``..`` directory.
9 |
10 | .. parsed-literal::
11 |
12 | cd test
13 | python3 pylit_test.py
14 | python3 pylit_ui_test.py
15 |
16 | You can also use tox to run a suite of tests.
17 |
18 | .. parsed-literal::
19 |
20 | tox
21 |
22 | Here's part of the documentation build procedure. It uses PyLit to create source for the documentation.
23 |
24 | - Clone a new document from ``docs/index.txt``
25 |
26 | - Clone a new example from a file in ``docs/examples``
27 |
28 | - Clone a new example from a file in ``test``
29 |
30 | .. parsed-literal::
31 |
32 | python3 pylit.py docs/conf.py
33 | python3 pylit.py pylit.py docs/examples/pylit.py.txt
34 | python3 pylit.py --comment-string='## ' test/pylit_test.py docs/examples/pylit_test.py.txt
35 |
36 | After this, we can manually run Sphinx to rebuild the documentation.
37 |
38 | .. parsed-literal::
39 |
40 | sphinx-build docs _build/html
41 |
42 | We can do this wih the included Makefile, which also converts all of the
43 | tutorials and examples.
44 |
--------------------------------------------------------------------------------
/docs/filename-extensions.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | Finding a Filename Extension for Literate Sources
4 | *************************************************
5 |
6 | Finding an easy to remember, unused file name extension is not easy.
7 |
8 | .py.txt
9 | a double extension (similar to .tar.gz, say) seems most appropriate (at
10 | least on UNIX). The same scheme can be used for c.txt, p.txt and the like.
11 | However, it fails on FAT16 file systems.
12 |
13 | .pytxt
14 | is recognised as extension by os.path.splitext but also fails on FAT16
15 |
16 | .pyt
17 | (PYthon Text) is used by the Python test interpreter
18 | `pytest `__
19 |
20 | .pyl
21 | was once mentioned as extension for "literate Python" files in an email
22 | exchange but subsequently used for Python libraries.
23 |
24 | .lpy
25 | seems to be free (as by a Google search, "lpy" is the name of a python
26 | code pretty printer but this should not pose a problem).
27 |
28 | .tpy
29 | seems to be free as well.
30 |
31 | All these extensions are Python specific. A new search for nice and unused
32 | extensions would have to be repeated for every language supported by PyLit.
33 |
34 | After considering the alternatives, the additional extension ``.txt`` was
35 | chosen for the text source (for Python this becomes ``py.txt``).
36 |
--------------------------------------------------------------------------------
/_build/html/_sources/filename-extensions.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | Finding a Filename Extension for Literate Sources
4 | *************************************************
5 |
6 | Finding an easy to remember, unused file name extension is not easy.
7 |
8 | .py.txt
9 | a double extension (similar to .tar.gz, say) seems most appropriate (at
10 | least on UNIX). The same scheme can be used for c.txt, p.txt and the like.
11 | However, it fails on FAT16 file systems.
12 |
13 | .pytxt
14 | is recognised as extension by os.path.splitext but also fails on FAT16
15 |
16 | .pyt
17 | (PYthon Text) is used by the Python test interpreter
18 | `pytest `__
19 |
20 | .pyl
21 | was once mentioned as extension for "literate Python" files in an email
22 | exchange but subsequently used for Python libraries.
23 |
24 | .lpy
25 | seems to be free (as by a Google search, "lpy" is the name of a python
26 | code pretty printer but this should not pose a problem).
27 |
28 | .tpy
29 | seems to be free as well.
30 |
31 | All these extensions are Python specific. A new search for nice and unused
32 | extensions would have to be repeated for every language supported by PyLit.
33 |
34 | After considering the alternatives, the additional extension ``.txt`` was
35 | chosen for the text source (for Python this becomes ``py.txt``).
36 |
--------------------------------------------------------------------------------
/PyLit.egg-info/PKG-INFO:
--------------------------------------------------------------------------------
1 | Metadata-Version: 1.2
2 | Name: pylit
3 | Version: 3.1.1
4 | Summary: Python Literate Programming
5 | Home-page: https://github.com/slott56/PyLit-3
6 | Author: S.Lott
7 | Author-email: slott56@gmail.com
8 | License: GNU General Public License (v. 2 or later)
9 | Project-URL: Documentation, https://slott56.github.io/PyLit-3/index.html
10 | Project-URL: Source Code, https://github.com/slott56/PyLit-3
11 | Project-URL: Bug Tracker, https://github.com/slott56/PyLit-3/issues
12 | Description: ############
13 | PyLit 3.1
14 | ############
15 |
16 |
17 | See http://slott56.github.io/PyLit-3/index.html for the complete documentation.
18 |
19 | The ``Makefile`` is used via ``make html`` to rebuild the code and documentation.
20 |
21 | The ``docs`` directory contains the documentation, plus many examples.
22 |
23 | The ``pylit.py`` is the module.
24 |
25 | The ``test`` directory contains the unit test suite.
26 |
27 | The ``contribs`` directory are old contributed modules which have not yet been
28 | converted to Python3.
29 |
30 | The code repository is: https://github.com/slott56/PyLit-3
31 |
32 | Platform: UNKNOWN
33 | Classifier: Development Status :: 6 - Mature
34 | Classifier: Intended Audience :: Developers
35 | Classifier: Operating System :: OS Independent
36 | Classifier: Programming Language :: Python :: 3 :: Only
37 | Classifier: Topic :: Software Development :: Build Tools
38 | Provides: p
39 | Provides: y
40 | Provides: l
41 | Provides: i
42 | Provides: t
43 | Requires-Python: >=3.5
44 |
--------------------------------------------------------------------------------
/pylit.egg-info/PKG-INFO:
--------------------------------------------------------------------------------
1 | Metadata-Version: 1.2
2 | Name: pylit
3 | Version: 3.1.1
4 | Summary: Python Literate Programming
5 | Home-page: https://github.com/slott56/PyLit-3
6 | Author: S.Lott
7 | Author-email: slott56@gmail.com
8 | License: GNU General Public License (v. 2 or later)
9 | Project-URL: Documentation, https://slott56.github.io/PyLit-3/index.html
10 | Project-URL: Source Code, https://github.com/slott56/PyLit-3
11 | Project-URL: Bug Tracker, https://github.com/slott56/PyLit-3/issues
12 | Description: ############
13 | PyLit 3.1
14 | ############
15 |
16 |
17 | See http://slott56.github.io/PyLit-3/index.html for the complete documentation.
18 |
19 | The ``Makefile`` is used via ``make html`` to rebuild the code and documentation.
20 |
21 | The ``docs`` directory contains the documentation, plus many examples.
22 |
23 | The ``pylit.py`` is the module.
24 |
25 | The ``test`` directory contains the unit test suite.
26 |
27 | The ``contribs`` directory are old contributed modules which have not yet been
28 | converted to Python3.
29 |
30 | The code repository is: https://github.com/slott56/PyLit-3
31 |
32 | Platform: UNKNOWN
33 | Classifier: Development Status :: 6 - Mature
34 | Classifier: Intended Audience :: Developers
35 | Classifier: Operating System :: OS Independent
36 | Classifier: Programming Language :: Python :: 3 :: Only
37 | Classifier: Topic :: Software Development :: Build Tools
38 | Provides: p
39 | Provides: y
40 | Provides: l
41 | Provides: i
42 | Provides: t
43 | Requires-Python: >=3.5
44 |
--------------------------------------------------------------------------------
/docs/examples/palatino-helvetica-courier.sty.txt:
--------------------------------------------------------------------------------
1 | palatino-helvetica-courier.sty
2 | ==============================
3 | Recommended Font Settings for Palatino, Helvetica, and Courier
4 | --------------------------------------------------------------
5 |
6 | :Author: Günter Milde
7 | :Revision: $Revision: 5534 $
8 | :Date: $Date: 2005-06-28$
9 | :Copyright: © 2009 G. Milde,
10 | Released without warranties or conditions of any kind
11 | under the terms of the Apache License, Version 2.0
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Usage
15 | ~~~~~
16 |
17 | To use standard Postscript fonts in the combination `Palatino` - `Helvetica`
18 | - `Courier` as document default, call this package with
19 |
20 | ``\usepackage{palatino-helvetica-courier}``
21 |
22 | Options:
23 |
24 | :osf: old-style figures (default)
25 | :lf: lining figures
26 |
27 | While `mathpazo` defaults to lining figures, this package defaults to
28 | old-style figures and also calls `mathpazo` with the [sc] option for true
29 | small caps.
30 |
31 | Implementation
32 | ~~~~~~~~~~~~~~
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{palatino-helvetica-courier}
37 | [2009/03/02 v0.1 Font Settings for Palatino, Helvetica, and Courier]
38 |
39 | Options::
40 |
41 | \DeclareOption{osf}{\newcommand{\phc@options}{sc,osf}}
42 | \DeclareOption{lf}{\newcommand{\phc@options}{sc}}
43 | \ExecuteOptions{osf}
44 | \ProcessOptions*
45 |
46 | Load font packages::
47 |
48 | \RequirePackage[\phc@options]{mathpazo}
49 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
50 | \RequirePackage{courier}
51 |
52 | .. _l2tabu:
53 | http://dante.ctan.org/CTAN/help/Catalogue/entries/l2tabu.html
54 |
55 | .. _psnfss:
56 | http://dante.ctan.org/CTAN/help/Catalogue/entries/psnfss.html
57 |
--------------------------------------------------------------------------------
/_build/html/examples/palatino-helvetica-courier.sty.txt:
--------------------------------------------------------------------------------
1 | palatino-helvetica-courier.sty
2 | ==============================
3 | Recommended Font Settings for Palatino, Helvetica, and Courier
4 | --------------------------------------------------------------
5 |
6 | :Author: Günter Milde
7 | :Revision: $Revision: 5534 $
8 | :Date: $Date: 2005-06-28$
9 | :Copyright: © 2009 G. Milde,
10 | Released without warranties or conditions of any kind
11 | under the terms of the Apache License, Version 2.0
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Usage
15 | ~~~~~
16 |
17 | To use standard Postscript fonts in the combination `Palatino` - `Helvetica`
18 | - `Courier` as document default, call this package with
19 |
20 | ``\usepackage{palatino-helvetica-courier}``
21 |
22 | Options:
23 |
24 | :osf: old-style figures (default)
25 | :lf: lining figures
26 |
27 | While `mathpazo` defaults to lining figures, this package defaults to
28 | old-style figures and also calls `mathpazo` with the [sc] option for true
29 | small caps.
30 |
31 | Implementation
32 | ~~~~~~~~~~~~~~
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{palatino-helvetica-courier}
37 | [2009/03/02 v0.1 Font Settings for Palatino, Helvetica, and Courier]
38 |
39 | Options::
40 |
41 | \DeclareOption{osf}{\newcommand{\phc@options}{sc,osf}}
42 | \DeclareOption{lf}{\newcommand{\phc@options}{sc}}
43 | \ExecuteOptions{osf}
44 | \ProcessOptions*
45 |
46 | Load font packages::
47 |
48 | \RequirePackage[\phc@options]{mathpazo}
49 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
50 | \RequirePackage{courier}
51 |
52 | .. _l2tabu:
53 | http://dante.ctan.org/CTAN/help/Catalogue/entries/l2tabu.html
54 |
55 | .. _psnfss:
56 | http://dante.ctan.org/CTAN/help/Catalogue/entries/psnfss.html
57 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # ********
5 | # setup.py
6 | # ********
7 | #
8 | # Literate programming with reStructuredText
9 | #
10 | # ::
11 |
12 | """pylit: bidirectional text <-> code converter
13 |
14 | Convert between a *text source* with embedded computer code and a *code source*
15 | with embedded documentation.
16 | """
17 |
18 | # Requirements for installation::
19 |
20 | from setuptools import setup, find_packages
21 | import pathlib
22 |
23 | # Module Definition::
24 |
25 | setup(
26 | name='pylit',
27 | version='3.1.1',
28 | description='Python Literate Programming',
29 | long_description=pathlib.Path('README.rst').read_text(),
30 | author='S.Lott',
31 | author_email='slott56@gmail.com',
32 | python_requires=">=3.5",
33 | url='https://github.com/slott56/PyLit-3',
34 | project_urls={
35 | "Documentation": 'https://slott56.github.io/PyLit-3/index.html',
36 | "Source Code": 'https://github.com/slott56/PyLit-3',
37 | "Bug Tracker": 'https://github.com/slott56/PyLit-3/issues',
38 | },
39 | provides='pylit',
40 | py_modules=['pylit'],
41 | classifiers=[
42 | "Development Status :: 6 - Mature",
43 | "Intended Audience :: Developers",
44 | "Operating System :: OS Independent",
45 | "Programming Language :: Python :: 3 :: Only",
46 | "Topic :: Software Development :: Build Tools",
47 | ],
48 | license='GNU General Public License (v. 2 or later)',
49 | )
50 |
51 | # And that's it. This will be installed into the site-packages directory.
52 |
53 | # Technically, this isn't necessary. A simple copy will do.
54 | # Further, the :envvar:`PYTHONPATH` environment variable can name a directory
55 | # that has :file:`pylit.py` in it.
56 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/palatino-helvetica-courier.sty.txt:
--------------------------------------------------------------------------------
1 | palatino-helvetica-courier.sty
2 | ==============================
3 | Recommended Font Settings for Palatino, Helvetica, and Courier
4 | --------------------------------------------------------------
5 |
6 | :Author: Günter Milde
7 | :Revision: $Revision: 5534 $
8 | :Date: $Date: 2005-06-28$
9 | :Copyright: © 2009 G. Milde,
10 | Released without warranties or conditions of any kind
11 | under the terms of the Apache License, Version 2.0
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Usage
15 | ~~~~~
16 |
17 | To use standard Postscript fonts in the combination `Palatino` - `Helvetica`
18 | - `Courier` as document default, call this package with
19 |
20 | ``\usepackage{palatino-helvetica-courier}``
21 |
22 | Options:
23 |
24 | :osf: old-style figures (default)
25 | :lf: lining figures
26 |
27 | While `mathpazo` defaults to lining figures, this package defaults to
28 | old-style figures and also calls `mathpazo` with the [sc] option for true
29 | small caps.
30 |
31 | Implementation
32 | ~~~~~~~~~~~~~~
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{palatino-helvetica-courier}
37 | [2009/03/02 v0.1 Font Settings for Palatino, Helvetica, and Courier]
38 |
39 | Options::
40 |
41 | \DeclareOption{osf}{\newcommand{\phc@options}{sc,osf}}
42 | \DeclareOption{lf}{\newcommand{\phc@options}{sc}}
43 | \ExecuteOptions{osf}
44 | \ProcessOptions*
45 |
46 | Load font packages::
47 |
48 | \RequirePackage[\phc@options]{mathpazo}
49 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
50 | \RequirePackage{courier}
51 |
52 | .. _l2tabu:
53 | http://dante.ctan.org/CTAN/help/Catalogue/entries/l2tabu.html
54 |
55 | .. _psnfss:
56 | http://dante.ctan.org/CTAN/help/Catalogue/entries/psnfss.html
57 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/palatino-helvetica-courier.sty.txt:
--------------------------------------------------------------------------------
1 | palatino-helvetica-courier.sty
2 | ==============================
3 | Recommended Font Settings for Palatino, Helvetica, and Courier
4 | --------------------------------------------------------------
5 |
6 | :Author: Günter Milde
7 | :Revision: $Revision: 5534 $
8 | :Date: $Date: 2005-06-28$
9 | :Copyright: © 2009 G. Milde,
10 | Released without warranties or conditions of any kind
11 | under the terms of the Apache License, Version 2.0
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Usage
15 | ~~~~~
16 |
17 | To use standard Postscript fonts in the combination `Palatino` - `Helvetica`
18 | - `Courier` as document default, call this package with
19 |
20 | ``\usepackage{palatino-helvetica-courier}``
21 |
22 | Options:
23 |
24 | :osf: old-style figures (default)
25 | :lf: lining figures
26 |
27 | While `mathpazo` defaults to lining figures, this package defaults to
28 | old-style figures and also calls `mathpazo` with the [sc] option for true
29 | small caps.
30 |
31 | Implementation
32 | ~~~~~~~~~~~~~~
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{palatino-helvetica-courier}
37 | [2009/03/02 v0.1 Font Settings for Palatino, Helvetica, and Courier]
38 |
39 | Options::
40 |
41 | \DeclareOption{osf}{\newcommand{\phc@options}{sc,osf}}
42 | \DeclareOption{lf}{\newcommand{\phc@options}{sc}}
43 | \ExecuteOptions{osf}
44 | \ProcessOptions*
45 |
46 | Load font packages::
47 |
48 | \RequirePackage[\phc@options]{mathpazo}
49 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
50 | \RequirePackage{courier}
51 |
52 | .. _l2tabu:
53 | http://dante.ctan.org/CTAN/help/Catalogue/entries/l2tabu.html
54 |
55 | .. _psnfss:
56 | http://dante.ctan.org/CTAN/help/Catalogue/entries/psnfss.html
57 |
--------------------------------------------------------------------------------
/docs/examples/setup.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | ********
5 | setup.py
6 | ********
7 |
8 | Literate programming with reStructuredText
9 |
10 | ::
11 |
12 | """pylit: bidirectional text <-> code converter
13 |
14 | Convert between a *text source* with embedded computer code and a *code source*
15 | with embedded documentation.
16 | """
17 |
18 | Requirements for installation::
19 |
20 | from setuptools import setup, find_packages
21 | import pathlib
22 |
23 | Module Definition::
24 |
25 | setup(
26 | name='pylit',
27 | version='3.1.1',
28 | description='Python Literate Programming',
29 | long_description=pathlib.Path('README.rst').read_text(),
30 | author='S.Lott',
31 | author_email='slott56@gmail.com',
32 | python_requires=">=3.5",
33 | url='https://github.com/slott56/PyLit-3',
34 | project_urls={
35 | "Documentation": 'https://slott56.github.io/PyLit-3/index.html',
36 | "Source Code": 'https://github.com/slott56/PyLit-3',
37 | "Bug Tracker": 'https://github.com/slott56/PyLit-3/issues',
38 | },
39 | provides='pylit',
40 | py_modules=['pylit'],
41 | classifiers=[
42 | "Development Status :: 6 - Mature",
43 | "Intended Audience :: Developers",
44 | "Operating System :: OS Independent",
45 | "Programming Language :: Python :: 3 :: Only",
46 | "Topic :: Software Development :: Build Tools",
47 | ],
48 | license='GNU General Public License (v. 2 or later)',
49 | )
50 |
51 | And that's it. This will be installed into the site-packages directory.
52 |
53 | Technically, this isn't necessary. A simple copy will do.
54 | Further, the :envvar:`PYTHONPATH` environment variable can name a directory
55 | that has :file:`pylit.py` in it.
56 |
--------------------------------------------------------------------------------
/_build/html/examples/setup.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | ********
5 | setup.py
6 | ********
7 |
8 | Literate programming with reStructuredText
9 |
10 | ::
11 |
12 | """pylit: bidirectional text <-> code converter
13 |
14 | Convert between a *text source* with embedded computer code and a *code source*
15 | with embedded documentation.
16 | """
17 |
18 | Requirements for installation::
19 |
20 | from setuptools import setup, find_packages
21 | import pathlib
22 |
23 | Module Definition::
24 |
25 | setup(
26 | name='pylit',
27 | version='3.1.1',
28 | description='Python Literate Programming',
29 | long_description=pathlib.Path('README.rst').read_text(),
30 | author='S.Lott',
31 | author_email='slott56@gmail.com',
32 | python_requires=">=3.5",
33 | url='https://github.com/slott56/PyLit-3',
34 | project_urls={
35 | "Documentation": 'https://slott56.github.io/PyLit-3/index.html',
36 | "Source Code": 'https://github.com/slott56/PyLit-3',
37 | "Bug Tracker": 'https://github.com/slott56/PyLit-3/issues',
38 | },
39 | provides='pylit',
40 | py_modules=['pylit'],
41 | classifiers=[
42 | "Development Status :: 6 - Mature",
43 | "Intended Audience :: Developers",
44 | "Operating System :: OS Independent",
45 | "Programming Language :: Python :: 3 :: Only",
46 | "Topic :: Software Development :: Build Tools",
47 | ],
48 | license='GNU General Public License (v. 2 or later)',
49 | )
50 |
51 | And that's it. This will be installed into the site-packages directory.
52 |
53 | Technically, this isn't necessary. A simple copy will do.
54 | Further, the :envvar:`PYTHONPATH` environment variable can name a directory
55 | that has :file:`pylit.py` in it.
56 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/setup.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | ********
5 | setup.py
6 | ********
7 |
8 | Literate programming with reStructuredText
9 |
10 | ::
11 |
12 | """pylit: bidirectional text <-> code converter
13 |
14 | Convert between a *text source* with embedded computer code and a *code source*
15 | with embedded documentation.
16 | """
17 |
18 | Requirements for installation::
19 |
20 | from setuptools import setup, find_packages
21 | import pathlib
22 |
23 | Module Definition::
24 |
25 | setup(
26 | name='pylit',
27 | version='3.1.1',
28 | description='Python Literate Programming',
29 | long_description=pathlib.Path('README.rst').read_text(),
30 | author='S.Lott',
31 | author_email='slott56@gmail.com',
32 | python_requires=">=3.5",
33 | url='https://github.com/slott56/PyLit-3',
34 | project_urls={
35 | "Documentation": 'https://slott56.github.io/PyLit-3/index.html',
36 | "Source Code": 'https://github.com/slott56/PyLit-3',
37 | "Bug Tracker": 'https://github.com/slott56/PyLit-3/issues',
38 | },
39 | provides='pylit',
40 | py_modules=['pylit'],
41 | classifiers=[
42 | "Development Status :: 6 - Mature",
43 | "Intended Audience :: Developers",
44 | "Operating System :: OS Independent",
45 | "Programming Language :: Python :: 3 :: Only",
46 | "Topic :: Software Development :: Build Tools",
47 | ],
48 | license='GNU General Public License (v. 2 or later)',
49 | )
50 |
51 | And that's it. This will be installed into the site-packages directory.
52 |
53 | Technically, this isn't necessary. A simple copy will do.
54 | Further, the :envvar:`PYTHONPATH` environment variable can name a directory
55 | that has :file:`pylit.py` in it.
56 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/setup.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | setup.py
5 | ********
6 | Literate programming with reStructuredText
7 | ++++++++++++++++++++++++++++++++++++++++++
8 |
9 | :Date: $Date$
10 | :Revision: $Revision$
11 | :URL: $URL$
12 | :Copyright: © 2005, 2007 Günter Milde.
13 | Released without warranty under the terms of the
14 | GNU General Public License (v. 2 or later)
15 |
16 | ::
17 |
18 | """pylit: bidirectional text <-> code converter
19 |
20 | Convert between a *text source* with embedded computer code and a *code source*
21 | with embedded documentation.
22 | """
23 |
24 | Requirements for installation::
25 |
26 | from setuptools import setup, find_packages
27 |
28 | Module Definition::
29 |
30 | setup(
31 | name='PyLit',
32 | version='3.1.1',
33 | description='Python Literate Programming',
34 | author='S.Lott',
35 | author_email='slott56@gmail.com',
36 | python_requires=">=3.4",
37 | project_urls={
38 | "Documentation": 'https://slott56.github.io/PyLit-3/index.html',
39 | "Source Code": 'https://github.com/slott56/PyLit-3',
40 | "Bug Tracker": 'https://github.com/slott56/PyLit-3/issues',
41 | },
42 | py_modules=find_packages(),
43 | classifiers=[
44 | "Development Status :: 6 - Mature",
45 | "Intended Audience :: Developers",
46 | "Operating System :: OS Independent",
47 | "Programming Language :: Python :: 3 :: Only",
48 | "Topic :: Software Development :: Build Tools",
49 | ],
50 | license='GNU General Public License (v. 2 or later)',
51 | )
52 |
53 | And that's it. This will be installed into the site-packages directory.
54 |
55 | Technically, this isn't necessary. A simple copy will do.
56 | Further, the :envvar:`PYTHONPATH` environment variable can name a directory
57 | that has :file:`pylit.py` in it.
58 |
--------------------------------------------------------------------------------
/docs/download/index.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | Requirements
4 | ============
5 |
6 | * Python_ version 3.5 or newer.
7 |
8 | If it is missing on your machine, you can get it from
9 | http://www.python.org/download/
10 |
11 | This release will not work with Python2.
12 |
13 | Download
14 | ========
15 |
16 | PyLit
17 | -----
18 | `pylit.py`_
19 | There are no file releases yet. You get the most up to date version from
20 | the `GitHub repository`_.
21 |
22 | pylit_
23 | A simple starter and configuration wrapper (see installation_).
24 |
25 | `pylit_test.py`_
26 | unit tests for the `pylit` module
27 |
28 | Tools
29 | -----
30 |
31 | * Docutils_ or Sphinx_ for conversion of reStructuredText to HTML or PDF
32 | (not strictly required by PyLit but needed for "pretty printing" the text
33 | source)
34 |
35 | * `Editor Support for reStructuredText`_
36 |
37 | * `pylit functions`_ for the `JED editor`_
38 |
39 | .. _`GitHub repository`:
40 | https://github.com/slott56/PyLit-3
41 |
42 | .. _`pylit.py`:
43 | https://raw.githubusercontent.com/slott56/PyLit-3/master/pylit.py
44 | .. _pylit_test.py:
45 | https://raw.githubusercontent.com/slott56/PyLit-3/master/test/pylit_test.py
46 |
47 | .. _Docutils: http://docutils.sourceforge.net/
48 | .. _Sphinx: http://sphinx.pocoo.org/
49 | .. _`Editor Support for reStructuredText`:
50 | http://docutils.sourceforge.net/tools/editors/README.html
51 | .. _`pylit functions`: http://jedmodes.sourceforge.net/mode/pylit/
52 | .. _`JED editor`: http://www.jedsoft.org/jed/
53 |
54 |
55 | Installation
56 | ============
57 |
58 | As `PyLit` is a pure Python module, installation is straightforward:
59 |
60 | * Put `pylit.py`_ in Python's `Module Search Path`_.
61 |
62 | You can now call the script with ::
63 |
64 | python3 -m pylit OPTIONS INFILE [OUTFILE]
65 |
66 | or ::
67 |
68 | python3 -m pylit --help
69 |
70 | * Easier invocation is possible with a small executable wrapper in the PATH.
71 | On Unix you can use a script like pylit_:
72 |
73 | .. include:: pylit
74 | :literal:
75 |
76 | This has two advantages:
77 |
78 | #. `Command line use`_ is simplified.
79 | #. `Default settings`_ can be customised without changing the module file.
80 |
81 | .. _Python: http://www.python.org
82 | .. _module search path:
83 | http://docs.python.org/tut/node8.html#SECTION008110000000000000000
84 | .. _pylit: pylit
85 | .. _command line use: ../usage/index.html#command-line-use
86 | .. _default settings: ../usage/index.html#defaults
87 |
--------------------------------------------------------------------------------
/_build/html/_sources/download/index.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | Requirements
4 | ============
5 |
6 | * Python_ version 3.5 or newer.
7 |
8 | If it is missing on your machine, you can get it from
9 | http://www.python.org/download/
10 |
11 | This release will not work with Python2.
12 |
13 | Download
14 | ========
15 |
16 | PyLit
17 | -----
18 | `pylit.py`_
19 | There are no file releases yet. You get the most up to date version from
20 | the `GitHub repository`_.
21 |
22 | pylit_
23 | A simple starter and configuration wrapper (see installation_).
24 |
25 | `pylit_test.py`_
26 | unit tests for the `pylit` module
27 |
28 | Tools
29 | -----
30 |
31 | * Docutils_ or Sphinx_ for conversion of reStructuredText to HTML or PDF
32 | (not strictly required by PyLit but needed for "pretty printing" the text
33 | source)
34 |
35 | * `Editor Support for reStructuredText`_
36 |
37 | * `pylit functions`_ for the `JED editor`_
38 |
39 | .. _`GitHub repository`:
40 | https://github.com/slott56/PyLit-3
41 |
42 | .. _`pylit.py`:
43 | https://raw.githubusercontent.com/slott56/PyLit-3/master/pylit.py
44 | .. _pylit_test.py:
45 | https://raw.githubusercontent.com/slott56/PyLit-3/master/test/pylit_test.py
46 |
47 | .. _Docutils: http://docutils.sourceforge.net/
48 | .. _Sphinx: http://sphinx.pocoo.org/
49 | .. _`Editor Support for reStructuredText`:
50 | http://docutils.sourceforge.net/tools/editors/README.html
51 | .. _`pylit functions`: http://jedmodes.sourceforge.net/mode/pylit/
52 | .. _`JED editor`: http://www.jedsoft.org/jed/
53 |
54 |
55 | Installation
56 | ============
57 |
58 | As `PyLit` is a pure Python module, installation is straightforward:
59 |
60 | * Put `pylit.py`_ in Python's `Module Search Path`_.
61 |
62 | You can now call the script with ::
63 |
64 | python3 -m pylit OPTIONS INFILE [OUTFILE]
65 |
66 | or ::
67 |
68 | python3 -m pylit --help
69 |
70 | * Easier invocation is possible with a small executable wrapper in the PATH.
71 | On Unix you can use a script like pylit_:
72 |
73 | .. include:: pylit
74 | :literal:
75 |
76 | This has two advantages:
77 |
78 | #. `Command line use`_ is simplified.
79 | #. `Default settings`_ can be customised without changing the module file.
80 |
81 | .. _Python: http://www.python.org
82 | .. _module search path:
83 | http://docs.python.org/tut/node8.html#SECTION008110000000000000000
84 | .. _pylit: pylit
85 | .. _command line use: ../usage/index.html#command-line-use
86 | .. _default settings: ../usage/index.html#defaults
87 |
--------------------------------------------------------------------------------
/docs/examples/iterqueue_speed_test.py:
--------------------------------------------------------------------------------
1 | # iterqueue_speed_test.py
2 | # =======================
3 | # Profiling the iterqueue extended iterator classes
4 | # -------------------------------------------------
5 | #
6 | # ::
7 |
8 | import sys, os, itertools
9 | from timeit import Timer
10 | import iterqueue
11 | from iterqueue_test import wrappers, peekables, pushables, \
12 | state_reporters, iqueues
13 |
14 |
15 | def print_iterator_lists():
16 | print( "Wrappers" )
17 | print( " ","\n ".join(wrapper.__name__ for wrapper in wrappers) )
18 | print( "Peekables" )
19 | print( " ","\n ".join(peekable.__name__ for peekable in peekables) )
20 | print( "Pushables" )
21 | print( " ","\n ".join(pushable.__name__ for pushable in pushables) )
22 | print( "State Reporters" )
23 | print( " ","\n ".join(state_reporter.__name__
24 | for state_reporter in state_reporters) )
25 | print( "Iterator Queues" )
26 | print( " ","\n ".join(iqueue.__name__ for iqueue in iqueues) )
27 |
28 |
29 | #print_iterator_lists()
30 |
31 | # use cases (benchmarks)
32 | # ~~~~~~~~~~~~~~~~~~~~~~
33 | #
34 | # ::
35 |
36 | def loop(iterator):
37 | """baseline: empty `for` loop"""
38 | for _ in iterator:
39 | pass
40 |
41 | def peek_in_loop(iterator):
42 | """peek in every loop"""
43 | for _ in iterator:
44 | try:
45 | iterator.peek()
46 | except StopIteration:
47 | pass
48 |
49 | def peek_before_loop(iterator):
50 | """peek at first value once, then loop"""
51 | try:
52 | iterator.peek()
53 | except StopIteration:
54 | pass
55 | for _ in iterator:
56 | pass
57 |
58 | def bool_in_loop(iterator):
59 | """test for values in every loop"""
60 | for _ in iterator:
61 | bool(iterator)
62 |
63 | def bool_before_loop(iterator):
64 | """test for values once, then loop"""
65 | bool(iterator)
66 | for _ in iterator:
67 | pass
68 |
69 |
70 | def time_benchmark(fun, wrappers, iterator):
71 | """profile benchmark `fun` with `iterator` wrapped in `wrappers`"""
72 |
73 | print( fun.__doc__, "({0:s})".format(iterator) )
74 | setup = "import iterqueue_speed_test\nimport iterqueue"
75 | benchmark = "iterqueue_speed_test.{0!s}(iterqueue.{1!s}(iter({2!r})))"
76 | stmts = [benchmark.format(fun.__name__, wrapper.__name__, iterator)
77 | for wrapper in wrappers]
78 | timers = [Timer(stmt=stmt, setup=setup) for stmt in stmts]
79 |
80 | t_i = [min(timer.repeat(number=1, repeat=3)) for timer in timers]
81 |
82 | results = ["%.5f s %s"%(t, wrapper.__name__)
83 | for t, wrapper in zip(t_i, wrappers)]
84 | results.sort()
85 | print( "\n".join(results) )
86 |
87 | # Typical use case: ``time_benchmark(loop, [iterqueue.XIter], xrange(1000))``
88 | #
89 | # ::
90 |
91 | time_benchmark(loop, wrappers, range(1000))
92 | print()
93 | time_benchmark(peek_before_loop, peekables, range(1000))
94 | print()
95 | time_benchmark(peek_in_loop, peekables, range(1000))
96 | print()
97 | time_benchmark(bool_before_loop, state_reporters, range(1000))
98 | print()
99 | time_benchmark(bool_in_loop, state_reporters, range(1000))
100 |
101 |
--------------------------------------------------------------------------------
/docs/examples/iterqueue_speed_test.py.txt:
--------------------------------------------------------------------------------
1 | iterqueue_speed_test.py
2 | =======================
3 | Profiling the iterqueue extended iterator classes
4 | -------------------------------------------------
5 |
6 | ::
7 |
8 | import sys, os, itertools
9 | from timeit import Timer
10 | import iterqueue
11 | from iterqueue_test import wrappers, peekables, pushables, \
12 | state_reporters, iqueues
13 |
14 |
15 | def print_iterator_lists():
16 | print( "Wrappers" )
17 | print( " ","\n ".join(wrapper.__name__ for wrapper in wrappers) )
18 | print( "Peekables" )
19 | print( " ","\n ".join(peekable.__name__ for peekable in peekables) )
20 | print( "Pushables" )
21 | print( " ","\n ".join(pushable.__name__ for pushable in pushables) )
22 | print( "State Reporters" )
23 | print( " ","\n ".join(state_reporter.__name__
24 | for state_reporter in state_reporters) )
25 | print( "Iterator Queues" )
26 | print( " ","\n ".join(iqueue.__name__ for iqueue in iqueues) )
27 |
28 |
29 | #print_iterator_lists()
30 |
31 | use cases (benchmarks)
32 | ~~~~~~~~~~~~~~~~~~~~~~
33 |
34 | ::
35 |
36 | def loop(iterator):
37 | """baseline: empty `for` loop"""
38 | for _ in iterator:
39 | pass
40 |
41 | def peek_in_loop(iterator):
42 | """peek in every loop"""
43 | for _ in iterator:
44 | try:
45 | iterator.peek()
46 | except StopIteration:
47 | pass
48 |
49 | def peek_before_loop(iterator):
50 | """peek at first value once, then loop"""
51 | try:
52 | iterator.peek()
53 | except StopIteration:
54 | pass
55 | for _ in iterator:
56 | pass
57 |
58 | def bool_in_loop(iterator):
59 | """test for values in every loop"""
60 | for _ in iterator:
61 | bool(iterator)
62 |
63 | def bool_before_loop(iterator):
64 | """test for values once, then loop"""
65 | bool(iterator)
66 | for _ in iterator:
67 | pass
68 |
69 |
70 | def time_benchmark(fun, wrappers, iterator):
71 | """profile benchmark `fun` with `iterator` wrapped in `wrappers`"""
72 |
73 | print( fun.__doc__, "({0:s})".format(iterator) )
74 | setup = "import iterqueue_speed_test\nimport iterqueue"
75 | benchmark = "iterqueue_speed_test.{0!s}(iterqueue.{1!s}(iter({2!r})))"
76 | stmts = [benchmark.format(fun.__name__, wrapper.__name__, iterator)
77 | for wrapper in wrappers]
78 | timers = [Timer(stmt=stmt, setup=setup) for stmt in stmts]
79 |
80 | t_i = [min(timer.repeat(number=1, repeat=3)) for timer in timers]
81 |
82 | results = ["%.5f s %s"%(t, wrapper.__name__)
83 | for t, wrapper in zip(t_i, wrappers)]
84 | results.sort()
85 | print( "\n".join(results) )
86 |
87 | Typical use case: ``time_benchmark(loop, [iterqueue.XIter], xrange(1000))``
88 |
89 | ::
90 |
91 | time_benchmark(loop, wrappers, range(1000))
92 | print()
93 | time_benchmark(peek_before_loop, peekables, range(1000))
94 | print()
95 | time_benchmark(peek_in_loop, peekables, range(1000))
96 | print()
97 | time_benchmark(bool_before_loop, state_reporters, range(1000))
98 | print()
99 | time_benchmark(bool_in_loop, state_reporters, range(1000))
100 |
101 |
--------------------------------------------------------------------------------
/_build/html/examples/iterqueue_speed_test.py.txt:
--------------------------------------------------------------------------------
1 | iterqueue_speed_test.py
2 | =======================
3 | Profiling the iterqueue extended iterator classes
4 | -------------------------------------------------
5 |
6 | ::
7 |
8 | import sys, os, itertools
9 | from timeit import Timer
10 | import iterqueue
11 | from iterqueue_test import wrappers, peekables, pushables, \
12 | state_reporters, iqueues
13 |
14 |
15 | def print_iterator_lists():
16 | print( "Wrappers" )
17 | print( " ","\n ".join(wrapper.__name__ for wrapper in wrappers) )
18 | print( "Peekables" )
19 | print( " ","\n ".join(peekable.__name__ for peekable in peekables) )
20 | print( "Pushables" )
21 | print( " ","\n ".join(pushable.__name__ for pushable in pushables) )
22 | print( "State Reporters" )
23 | print( " ","\n ".join(state_reporter.__name__
24 | for state_reporter in state_reporters) )
25 | print( "Iterator Queues" )
26 | print( " ","\n ".join(iqueue.__name__ for iqueue in iqueues) )
27 |
28 |
29 | #print_iterator_lists()
30 |
31 | use cases (benchmarks)
32 | ~~~~~~~~~~~~~~~~~~~~~~
33 |
34 | ::
35 |
36 | def loop(iterator):
37 | """baseline: empty `for` loop"""
38 | for _ in iterator:
39 | pass
40 |
41 | def peek_in_loop(iterator):
42 | """peek in every loop"""
43 | for _ in iterator:
44 | try:
45 | iterator.peek()
46 | except StopIteration:
47 | pass
48 |
49 | def peek_before_loop(iterator):
50 | """peek at first value once, then loop"""
51 | try:
52 | iterator.peek()
53 | except StopIteration:
54 | pass
55 | for _ in iterator:
56 | pass
57 |
58 | def bool_in_loop(iterator):
59 | """test for values in every loop"""
60 | for _ in iterator:
61 | bool(iterator)
62 |
63 | def bool_before_loop(iterator):
64 | """test for values once, then loop"""
65 | bool(iterator)
66 | for _ in iterator:
67 | pass
68 |
69 |
70 | def time_benchmark(fun, wrappers, iterator):
71 | """profile benchmark `fun` with `iterator` wrapped in `wrappers`"""
72 |
73 | print( fun.__doc__, "({0:s})".format(iterator) )
74 | setup = "import iterqueue_speed_test\nimport iterqueue"
75 | benchmark = "iterqueue_speed_test.{0!s}(iterqueue.{1!s}(iter({2!r})))"
76 | stmts = [benchmark.format(fun.__name__, wrapper.__name__, iterator)
77 | for wrapper in wrappers]
78 | timers = [Timer(stmt=stmt, setup=setup) for stmt in stmts]
79 |
80 | t_i = [min(timer.repeat(number=1, repeat=3)) for timer in timers]
81 |
82 | results = ["%.5f s %s"%(t, wrapper.__name__)
83 | for t, wrapper in zip(t_i, wrappers)]
84 | results.sort()
85 | print( "\n".join(results) )
86 |
87 | Typical use case: ``time_benchmark(loop, [iterqueue.XIter], xrange(1000))``
88 |
89 | ::
90 |
91 | time_benchmark(loop, wrappers, range(1000))
92 | print()
93 | time_benchmark(peek_before_loop, peekables, range(1000))
94 | print()
95 | time_benchmark(peek_in_loop, peekables, range(1000))
96 | print()
97 | time_benchmark(bool_before_loop, state_reporters, range(1000))
98 | print()
99 | time_benchmark(bool_in_loop, state_reporters, range(1000))
100 |
101 |
--------------------------------------------------------------------------------
/docs/index.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | PyLit
4 | *****
5 |
6 | `Literate Programming`_ with reStructuredText_
7 |
8 | .. epigraph::
9 |
10 | The idea is that you do not document programs (after the fact), but
11 | write documents that *contain* the programs. [1]_
12 |
13 | Features
14 | --------
15 |
16 | PyLit (Python Literate) provides a plain but efficient tool for
17 | literate programming: a `bidirectional text/code converter`_.
18 |
19 | .. toctree::
20 | :maxdepth: 2
21 |
22 | features
23 |
24 | .. _bidirectional text/code converter: features.html#dual-source
25 | .. _literate programming: literate-programming.html
26 |
27 |
28 | Documentation
29 | -------------
30 |
31 | .. toctree::
32 | :maxdepth: 1
33 |
34 | usage
35 | tutorial/index
36 | examples/index
37 | literate-programming
38 | filename-extensions
39 | updates
40 |
41 |
42 | Download
43 | --------
44 |
45 | .. toctree::
46 | :maxdepth: 1
47 |
48 | download/index
49 |
50 | Project page
51 | ------------
52 |
53 | The PyLit3 project is hosted on GitHub.
54 |
55 | https://github.com/slott56/PyLit-3
56 |
57 | Legacy
58 | ---------
59 |
60 | The original PyLit project was hosted at `BerliOS`_.
61 |
62 | .. _BerliOS: http://developer.berlios.de/projects/pylit/
63 |
64 |
65 | Changes
66 | ~~~~~~~~~
67 |
68 | The `PyLit source`_ has `change history`_ and chapter on `open questions`_ and ideas.
69 |
70 | .. _`PyLit source`: https://slott56.github.io/PyLit-3/_build/html/examples/pylit.py.html
71 | .. _`change history`: https://slott56.github.io/PyLit-3/_build/html/examples/pylit.py.html#changelog
72 | .. _`open questions`: https://slott56.github.io/PyLit-3/_build/html/examples/pylit.py.html#open-questions
73 |
74 | Copyright
75 | ~~~~~~~~~~
76 |
77 | Copyright
78 | © 2005, 2009 Günter Milde.
79 |
80 | License
81 | PyLit is `free software`_, released under the `GNU General Public License`_
82 | (GPL)
83 |
84 | PyLit is distributed in the hope that it will be useful, but WITHOUT ANY
85 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
86 | FOR A PARTICULAR PURPOSE. See the `GNU General Public License`_ for more
87 | details.
88 |
89 | I am using PyLit in my daily work for more than two years now without major
90 | problems. It works for me, but your mileage might vary.
91 |
92 | Remember to back up your data. A version control system is recommended.
93 |
94 | .. _`free software`: http://www.gnu.org/philosophy/free-sw.html
95 | .. _`GNU General Public License`: http://www.gnu.org/copyleft/gpl.html
96 |
97 |
98 | About this site
99 | ---------------
100 |
101 | The PyLit site is created from `reStructuredText`_ sources with Sphinx_.
102 | (Earlier versions used the rest2web_ site builder.)
103 |
104 | It is located at https://github.com/slott56/PyLit-3.
105 | Documentation is located at http://slott56.github.io/PyLit-3/.
106 |
107 | .. [1] John Max Skaller in a `Charming Python interview`_
108 |
109 | .. _reStructuredText: http://docutils.sourceforge.net/rst.html
110 | .. _rest2web: http://www.voidspace.org.uk/python/rest2web/
111 | .. _Sphinx: http://sphinx.pocoo.org/
112 |
113 |
114 | .. _Python: http://www.python.org
115 | .. _Docutils: http://docutils.sourceforge.net/
116 |
117 | .. _Charming Python interview:
118 | http://www.ibm.com/developerworks/library/l-pyth7.html
119 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/iterqueue_speed_test.py.txt:
--------------------------------------------------------------------------------
1 | iterqueue_speed_test.py
2 | =======================
3 | Profiling the iterqueue extended iterator classes
4 | -------------------------------------------------
5 |
6 | ::
7 |
8 | import sys, os, itertools
9 | from timeit import Timer
10 | import iterqueue
11 | from iterqueue_test import wrappers, peekables, pushables, \
12 | state_reporters, iqueues
13 |
14 |
15 | def print_iterator_lists():
16 | print( "Wrappers" )
17 | print( " ","\n ".join(wrapper.__name__ for wrapper in wrappers) )
18 | print( "Peekables" )
19 | print( " ","\n ".join(peekable.__name__ for peekable in peekables) )
20 | print( "Pushables" )
21 | print( " ","\n ".join(pushable.__name__ for pushable in pushables) )
22 | print( "State Reporters" )
23 | print( " ","\n ".join(state_reporter.__name__
24 | for state_reporter in state_reporters) )
25 | print( "Iterator Queues" )
26 | print( " ","\n ".join(iqueue.__name__ for iqueue in iqueues) )
27 |
28 |
29 | #print_iterator_lists()
30 |
31 | use cases (benchmarks)
32 | ~~~~~~~~~~~~~~~~~~~~~~
33 |
34 | ::
35 |
36 | def loop(iterator):
37 | """baseline: empty `for` loop"""
38 | for _ in iterator:
39 | pass
40 |
41 | def peek_in_loop(iterator):
42 | """peek in every loop"""
43 | for _ in iterator:
44 | try:
45 | iterator.peek()
46 | except StopIteration:
47 | pass
48 |
49 | def peek_before_loop(iterator):
50 | """peek at first value once, then loop"""
51 | try:
52 | iterator.peek()
53 | except StopIteration:
54 | pass
55 | for _ in iterator:
56 | pass
57 |
58 | def bool_in_loop(iterator):
59 | """test for values in every loop"""
60 | for _ in iterator:
61 | bool(iterator)
62 |
63 | def bool_before_loop(iterator):
64 | """test for values once, then loop"""
65 | bool(iterator)
66 | for _ in iterator:
67 | pass
68 |
69 |
70 | def time_benchmark(fun, wrappers, iterator):
71 | """profile benchmark `fun` with `iterator` wrapped in `wrappers`"""
72 |
73 | print( fun.__doc__, "({0:s})".format(iterator) )
74 | setup = "import iterqueue_speed_test\nimport iterqueue"
75 | benchmark = "iterqueue_speed_test.{0!s}(iterqueue.{1!s}(iter({2!r})))"
76 | stmts = [benchmark.format(fun.__name__, wrapper.__name__, iterator)
77 | for wrapper in wrappers]
78 | timers = [Timer(stmt=stmt, setup=setup) for stmt in stmts]
79 |
80 | t_i = [min(timer.repeat(number=1, repeat=3)) for timer in timers]
81 |
82 | results = ["%.5f s %s"%(t, wrapper.__name__)
83 | for t, wrapper in zip(t_i, wrappers)]
84 | results.sort()
85 | print( "\n".join(results) )
86 |
87 | Typical use case: ``time_benchmark(loop, [iterqueue.XIter], xrange(1000))``
88 |
89 | ::
90 |
91 | time_benchmark(loop, wrappers, range(1000))
92 | print()
93 | time_benchmark(peek_before_loop, peekables, range(1000))
94 | print()
95 | time_benchmark(peek_in_loop, peekables, range(1000))
96 | print()
97 | time_benchmark(bool_before_loop, state_reporters, range(1000))
98 | print()
99 | time_benchmark(bool_in_loop, state_reporters, range(1000))
100 |
101 |
--------------------------------------------------------------------------------
/_build/html/_sources/index.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | PyLit
4 | *****
5 |
6 | `Literate Programming`_ with reStructuredText_
7 |
8 | .. epigraph::
9 |
10 | The idea is that you do not document programs (after the fact), but
11 | write documents that *contain* the programs. [1]_
12 |
13 | Features
14 | --------
15 |
16 | PyLit (Python Literate) provides a plain but efficient tool for
17 | literate programming: a `bidirectional text/code converter`_.
18 |
19 | .. toctree::
20 | :maxdepth: 2
21 |
22 | features
23 |
24 | .. _bidirectional text/code converter: features.html#dual-source
25 | .. _literate programming: literate-programming.html
26 |
27 |
28 | Documentation
29 | -------------
30 |
31 | .. toctree::
32 | :maxdepth: 1
33 |
34 | usage
35 | tutorial/index
36 | examples/index
37 | literate-programming
38 | filename-extensions
39 | updates
40 |
41 |
42 | Download
43 | --------
44 |
45 | .. toctree::
46 | :maxdepth: 1
47 |
48 | download/index
49 |
50 | Project page
51 | ------------
52 |
53 | The PyLit3 project is hosted on GitHub.
54 |
55 | https://github.com/slott56/PyLit-3
56 |
57 | Legacy
58 | ---------
59 |
60 | The original PyLit project was hosted at `BerliOS`_.
61 |
62 | .. _BerliOS: http://developer.berlios.de/projects/pylit/
63 |
64 |
65 | Changes
66 | ~~~~~~~~~
67 |
68 | The `PyLit source`_ has `change history`_ and chapter on `open questions`_ and ideas.
69 |
70 | .. _`PyLit source`: https://slott56.github.io/PyLit-3/_build/html/examples/pylit.py.html
71 | .. _`change history`: https://slott56.github.io/PyLit-3/_build/html/examples/pylit.py.html#changelog
72 | .. _`open questions`: https://slott56.github.io/PyLit-3/_build/html/examples/pylit.py.html#open-questions
73 |
74 | Copyright
75 | ~~~~~~~~~~
76 |
77 | Copyright
78 | © 2005, 2009 Günter Milde.
79 |
80 | License
81 | PyLit is `free software`_, released under the `GNU General Public License`_
82 | (GPL)
83 |
84 | PyLit is distributed in the hope that it will be useful, but WITHOUT ANY
85 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
86 | FOR A PARTICULAR PURPOSE. See the `GNU General Public License`_ for more
87 | details.
88 |
89 | I am using PyLit in my daily work for more than two years now without major
90 | problems. It works for me, but your mileage might vary.
91 |
92 | Remember to back up your data. A version control system is recommended.
93 |
94 | .. _`free software`: http://www.gnu.org/philosophy/free-sw.html
95 | .. _`GNU General Public License`: http://www.gnu.org/copyleft/gpl.html
96 |
97 |
98 | About this site
99 | ---------------
100 |
101 | The PyLit site is created from `reStructuredText`_ sources with Sphinx_.
102 | (Earlier versions used the rest2web_ site builder.)
103 |
104 | It is located at https://github.com/slott56/PyLit-3.
105 | Documentation is located at http://slott56.github.io/PyLit-3/.
106 |
107 | .. [1] John Max Skaller in a `Charming Python interview`_
108 |
109 | .. _reStructuredText: http://docutils.sourceforge.net/rst.html
110 | .. _rest2web: http://www.voidspace.org.uk/python/rest2web/
111 | .. _Sphinx: http://sphinx.pocoo.org/
112 |
113 |
114 | .. _Python: http://www.python.org
115 | .. _Docutils: http://docutils.sourceforge.net/
116 |
117 | .. _Charming Python interview:
118 | http://www.ibm.com/developerworks/library/l-pyth7.html
119 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/iterqueue_speed_test.py.txt:
--------------------------------------------------------------------------------
1 | iterqueue_speed_test.py
2 | =======================
3 | Profiling the iterqueue extended iterator classes
4 | -------------------------------------------------
5 |
6 | ::
7 |
8 | import sys, os, itertools
9 | from timeit import Timer
10 | import iterqueue
11 | from iterqueue_test import wrappers, peekables, pushables, \
12 | state_reporters, iqueues
13 |
14 |
15 | def print_iterator_lists():
16 | print( "Wrappers" )
17 | print( " ","\n ".join(wrapper.__name__ for wrapper in wrappers) )
18 | print( "Peekables" )
19 | print( " ","\n ".join(peekable.__name__ for peekable in peekables) )
20 | print( "Pushables" )
21 | print( " ","\n ".join(pushable.__name__ for pushable in pushables) )
22 | print( "State Reporters" )
23 | print( " ","\n ".join(state_reporter.__name__
24 | for state_reporter in state_reporters) )
25 | print( "Iterator Queues" )
26 | print( " ","\n ".join(iqueue.__name__ for iqueue in iqueues) )
27 |
28 |
29 | #print_iterator_lists()
30 |
31 | use cases (benchmarks)
32 | ~~~~~~~~~~~~~~~~~~~~~~
33 |
34 | ::
35 |
36 | def loop(iterator):
37 | """baseline: empty `for` loop"""
38 | for _ in iterator:
39 | pass
40 |
41 | def peek_in_loop(iterator):
42 | """peek in every loop"""
43 | for _ in iterator:
44 | try:
45 | iterator.peek()
46 | except StopIteration:
47 | pass
48 |
49 | def peek_before_loop(iterator):
50 | """peek at first value once, then loop"""
51 | try:
52 | iterator.peek()
53 | except StopIteration:
54 | pass
55 | for _ in iterator:
56 | pass
57 |
58 | def bool_in_loop(iterator):
59 | """test for values in every loop"""
60 | for _ in iterator:
61 | bool(iterator)
62 |
63 | def bool_before_loop(iterator):
64 | """test for values once, then loop"""
65 | bool(iterator)
66 | for _ in iterator:
67 | pass
68 |
69 |
70 | def time_benchmark(fun, wrappers, iterator):
71 | """profile benchmark `fun` with `iterator` wrapped in `wrappers`"""
72 |
73 | print( fun.__doc__, "({0:s})".format(iterator) )
74 | setup = "import iterqueue_speed_test\nimport iterqueue"
75 | benchmark = "iterqueue_speed_test.{0!s}(iterqueue.{1!s}(iter({2!r})))"
76 | stmts = [benchmark.format(fun.__name__, wrapper.__name__, iterator)
77 | for wrapper in wrappers]
78 | timers = [Timer(stmt=stmt, setup=setup) for stmt in stmts]
79 |
80 | t_i = [min(timer.repeat(number=1, repeat=3)) for timer in timers]
81 |
82 | results = ["%.5f s %s"%(t, wrapper.__name__)
83 | for t, wrapper in zip(t_i, wrappers)]
84 | results.sort()
85 | print( "\n".join(results) )
86 |
87 | Typical use case: ``time_benchmark(loop, [iterqueue.XIter], xrange(1000))``
88 |
89 | ::
90 |
91 | time_benchmark(loop, wrappers, range(1000))
92 | print()
93 | time_benchmark(peek_before_loop, peekables, range(1000))
94 | print()
95 | time_benchmark(peek_in_loop, peekables, range(1000))
96 | print()
97 | time_benchmark(bool_before_loop, state_reporters, range(1000))
98 | print()
99 | time_benchmark(bool_in_loop, state_reporters, range(1000))
100 |
101 |
--------------------------------------------------------------------------------
/docs/.templates/layout.html:
--------------------------------------------------------------------------------
1 | {# Layout modifications for the Pylit documentation #}
2 | {# Filename: .templates/layout.html #}
3 | {% extends '!layout.html' %}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {%- block relbaritems %}
12 | {{ title }}
13 |
14 |
15 |
16 |
17 |
18 | {% endblock %}
19 |
20 |
21 | {%- set reldelim1 = ' / ' %}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | {%- block sidebartoc %}
33 | {%- if display_toc %}
34 | Contents
35 |
36 | {{ toc }}
37 |
38 |
39 |
40 | {%- endif %}
41 | {%- endblock %}
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | {%- block sidebarrel %}
51 | {%- if prev %}
52 | Previous Page
53 |
54 | {{ prev.title }}
55 |
56 | {%- endif %}
57 | {%- if next %}
58 | Next Page
59 |
60 | {{ next.title }}
61 |
62 | {%- endif %}
63 | {%- if pagename != "index" %}
64 | Up
65 |
66 | {%- if parents %}
67 | {{ parents[-1].title }}
68 | {%- else %}
69 | {{ shorttitle }}
70 | {%- endif %}
71 |
72 | {%- endif %}
73 |
74 | {%- endblock %}
75 |
76 |
77 |
78 |
79 |
80 | {%- block sidebarsearch %}
81 | {%- if pagename != "search" %}
82 | Search this site
83 |
89 | {%- if builder == 'web' %}
90 | Enter a module, class or function name.
91 | {%- endif %}
92 | {%- endif %}
93 | {%- endblock %}
94 |
95 |
96 |
97 |
98 |
99 | {% block footer %}
100 |
101 | Thanks to
102 |
103 |
105 |
106 | for hosting this site.
107 |
108 | {% endblock %}
109 |
--------------------------------------------------------------------------------
/docs/pylit.css:
--------------------------------------------------------------------------------
1 | /* Stylesheet for the PyLit site (for use with rest2web)
2 |
3 | :Author: Guenter Milde
4 | :Copyright: 2007 G. Milde
5 | This stylesheet is released under the GPL v. 2 or later
6 |
7 | */
8 |
9 | @import url("html4css1.css"); /* docutils style sheet */
10 | /* @import url("pygments-default.css"); */ /* code syntax highlight */
11 |
12 | /* r2w stylesheet variants and expamples */
13 |
14 | /* @import url('pysrc.css'); */ /* Python code syntax highlight */
15 | /* @import url("voidspace_docutils2.css"); */ /* rounded boxes around headers */
16 | /* @import url("rest2web.css"); */ /* ditto */
17 | /* @import url("test.css"); */ /* greyish background */
18 | /* @import url("rest.css"); */
19 |
20 | /* PyLit customizations */
21 | /* -------------------- */
22 |
23 | div#Inhalt {
24 | margin-left: 0em;
25 | /* padding-left: 0.5em; */
26 | /* border: 1px dashed silver; */
27 | /* border-left-width: 1px */
28 | /* border-color: silver */
29 | min-width: 16em; /* Mindestbreite verhindert Anzeigefehler in modernen Browsern */
30 | }
31 | h1.title {
32 | text-align: left;
33 | background-color: silver;
34 | padding: 5px;
35 | }
36 | h1 {
37 | font-size: 1.5em;
38 | /* padding-left: 0.5em; */
39 | }
40 | h2 {
41 | font-size: 1.2em;
42 | }
43 | /* bold definition terms */
44 | dt {
45 | font-weight: bold;
46 | }
47 |
48 | /* background colour for literal blocks*/
49 | pre.literal-block, pre.doctest-block {
50 | background-color: #FEFDD8; }
51 | /* ... and inline literal */
52 | tt.docutils {
53 | background-color: white; }
54 |
55 | /* last line with Berlios logo */
56 | p.thanks {
57 | text-align: right;
58 | background-color: silver;
59 | }
60 |
61 | /* div.contents { margin: 5px } */
62 |
63 | .logo {
64 | vertical-align:middle;
65 | background-color: white;
66 | }
67 |
68 | /* Breadcrumps list as top bar: from the r2w standard functions doc */
69 | #crumbs {
70 | background-color: #db8;
71 | padding: 3px;
72 | text-align: left;
73 | /* font-size:15pt; */
74 | font-weight:bold;
75 | }
76 |
77 | #crumbs .top-navigation {
78 | margin: 0.5em;
79 | color: black
80 | background-color: silver
81 |
82 |
83 | /* #crumbs li { */
84 | /* display:inline; */
85 | /* list-style:none; */
86 | /* margin:0; */
87 | /* padding:5px; */
88 | /* } */
89 | /* */
90 | /* #crumbs ul { */
91 | /* margin:0; */
92 | /* padding:0 */
93 | /* } */
94 |
95 |
96 | /* Navigation sidebar (currently not used)
97 | (from http://de.selfhtml.org/css/layouts/mehrspaltige.htm ) */
98 |
99 | ul#Navigation {
100 | /* font-size: 0.8em; */
101 | float: left; width: 13em;
102 | margin: 0;
103 | padding: 0;
104 | /* border: 1px dashed silver; */
105 | /* background-color: #eee; */
106 | background-color: #fee;
107 | }
108 | ul#Navigation li {
109 | list-style: none;
110 | margin: 0;
111 | padding: 0.2em;
112 | /* border: 1px grey; */
113 | }
114 | ul#Navigation a {
115 | display: block;
116 | /* padding: 0.2em; */
117 | font-weight: bold;
118 | }
119 | ul#Navigation a:link {
120 | color: black;
121 | }
122 | ul#Navigation a:visited {
123 | color: #666;
124 | }
125 | ul#Navigation a:hover {
126 | color: black;
127 | background-color: #ffe;
128 | }
129 | ul#Navigation a:active {
130 | color: white;
131 | background-color: gray;
132 | }
133 | div.sidebar-links{
134 | margin-left: 0.5em
135 | }
136 |
137 | img { border:none }
138 |
--------------------------------------------------------------------------------
/docs/usage.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | Usage
4 | =====
5 |
6 | Command line use
7 | ----------------
8 |
9 | ::
10 |
11 | #> python pylit.py [options] INFILE [OUTFILE]
12 |
13 | ..
14 |
15 | Convert between (reStructured) text source with embedded code, and code
16 | source with embedded documentation (comment blocks)
17 |
18 | The special file name ``'-'`` stands for standard in or standard out.
19 |
20 | Find more details in the tutorial_.
21 |
22 | .. _tutorial: tutorial/index.html
23 |
24 | Options
25 | ~~~~~~~
26 |
27 | --version show program's version number and exit
28 | -h, --help show this help message and exit
29 | -c, --code2txt convert code source to text source
30 | -t, --txt2code convert text source to code source
31 | --language=LANGUAGE use LANGUAGE native comment style
32 | --comment-string=COMMENT_STRING
33 | documentation block marker in code source (including
34 | trailing whitespace, default: language dependent)
35 | -m CODE_BLOCK_MARKER, --code-block-marker=CODE_BLOCK_MARKER
36 | syntax token starting a code block. (default '::')
37 | --codeindent=CODEINDENT
38 | Number of spaces to indent code blocks with text2code
39 | (default 2)
40 | --overwrite=OVERWRITE
41 | overwrite output file (default 'update')
42 | --replace move infile to a backup copy (appending '~')
43 | -s, --strip "export" by stripping documentation or code
44 | -d, --diff test for differences to existing file
45 | --doctest run doctest.testfile() on the text version
46 | -e, --execute execute code (Python only)
47 |
48 |
49 | Filename Extensions
50 | ~~~~~~~~~~~~~~~~~~~
51 |
52 | By default ``.txt`` will be appended for literate code and stripped by the
53 | conversion to executable code. I.e. for a Python module `foo`:
54 |
55 | * the code source is called ``foo.py``
56 | * the text source is called ``foo.py.txt``
57 | * the HTML rendering is called ``foo.py.html``
58 |
59 | See also `filename extensions `_.
60 |
61 | Programmatic use
62 | ----------------
63 |
64 | If pylit.py is in the Python Module Path, it can be imported and used from
65 | other Python programs. The simplest example is the executable wrapper script
66 | pylit that can also be used for customisation_:
67 |
68 | .. include:: download/pylit
69 | :literal:
70 |
71 | For more details see e.g. the `helper functions`_ in the `literate source`_.
72 |
73 | .. _helper functions: examples/pylit.py.html#helper-functions
74 | .. _literate source: examples/pylit.py.html
75 | .. _pylit: download/pylit
76 |
77 | Customisation
78 | -------------
79 |
80 | Customisation is possible by overwriting `default values`_ in a wrapper
81 | script like pylit_, e.g. ::
82 |
83 | #!/usr/bin/env python
84 |
85 | import pylit
86 |
87 | pylit.defaults.code_block_marker = '.. code-block:: python'
88 | pylit.defaults.comment_string = "## "
89 | pylit.defaults.codeindent = 4
90 | defaults.text_extensions = [".rst"]
91 |
92 | pylit.main()
93 |
94 | To overwrite the "intelligent guesses" by PylitOptions_ and command line
95 | options, pass the option as argument to `pylit.main()`_, e.g.::
96 |
97 | #!/usr/bin/env python
98 |
99 | import pylit
100 | pylit.main(comment_string = "## ")
101 |
102 |
103 | .. _default values: examples/pylit.py.html#defaults
104 | .. _PylitOptions: examples/pylit.py.html#PylitOptions
105 | .. _pylit.main(): examples/pylit.py.html#main
106 |
--------------------------------------------------------------------------------
/_build/html/_sources/usage.txt:
--------------------------------------------------------------------------------
1 | .. -*- rst-mode -*-
2 |
3 | Usage
4 | =====
5 |
6 | Command line use
7 | ----------------
8 |
9 | ::
10 |
11 | #> python pylit.py [options] INFILE [OUTFILE]
12 |
13 | ..
14 |
15 | Convert between (reStructured) text source with embedded code, and code
16 | source with embedded documentation (comment blocks)
17 |
18 | The special file name ``'-'`` stands for standard in or standard out.
19 |
20 | Find more details in the tutorial_.
21 |
22 | .. _tutorial: tutorial/index.html
23 |
24 | Options
25 | ~~~~~~~
26 |
27 | --version show program's version number and exit
28 | -h, --help show this help message and exit
29 | -c, --code2txt convert code source to text source
30 | -t, --txt2code convert text source to code source
31 | --language=LANGUAGE use LANGUAGE native comment style
32 | --comment-string=COMMENT_STRING
33 | documentation block marker in code source (including
34 | trailing whitespace, default: language dependent)
35 | -m CODE_BLOCK_MARKER, --code-block-marker=CODE_BLOCK_MARKER
36 | syntax token starting a code block. (default '::')
37 | --codeindent=CODEINDENT
38 | Number of spaces to indent code blocks with text2code
39 | (default 2)
40 | --overwrite=OVERWRITE
41 | overwrite output file (default 'update')
42 | --replace move infile to a backup copy (appending '~')
43 | -s, --strip "export" by stripping documentation or code
44 | -d, --diff test for differences to existing file
45 | --doctest run doctest.testfile() on the text version
46 | -e, --execute execute code (Python only)
47 |
48 |
49 | Filename Extensions
50 | ~~~~~~~~~~~~~~~~~~~
51 |
52 | By default ``.txt`` will be appended for literate code and stripped by the
53 | conversion to executable code. I.e. for a Python module `foo`:
54 |
55 | * the code source is called ``foo.py``
56 | * the text source is called ``foo.py.txt``
57 | * the HTML rendering is called ``foo.py.html``
58 |
59 | See also `filename extensions `_.
60 |
61 | Programmatic use
62 | ----------------
63 |
64 | If pylit.py is in the Python Module Path, it can be imported and used from
65 | other Python programs. The simplest example is the executable wrapper script
66 | pylit that can also be used for customisation_:
67 |
68 | .. include:: download/pylit
69 | :literal:
70 |
71 | For more details see e.g. the `helper functions`_ in the `literate source`_.
72 |
73 | .. _helper functions: examples/pylit.py.html#helper-functions
74 | .. _literate source: examples/pylit.py.html
75 | .. _pylit: download/pylit
76 |
77 | Customisation
78 | -------------
79 |
80 | Customisation is possible by overwriting `default values`_ in a wrapper
81 | script like pylit_, e.g. ::
82 |
83 | #!/usr/bin/env python
84 |
85 | import pylit
86 |
87 | pylit.defaults.code_block_marker = '.. code-block:: python'
88 | pylit.defaults.comment_string = "## "
89 | pylit.defaults.codeindent = 4
90 | defaults.text_extensions = [".rst"]
91 |
92 | pylit.main()
93 |
94 | To overwrite the "intelligent guesses" by PylitOptions_ and command line
95 | options, pass the option as argument to `pylit.main()`_, e.g.::
96 |
97 | #!/usr/bin/env python
98 |
99 | import pylit
100 | pylit.main(comment_string = "## ")
101 |
102 |
103 | .. _default values: examples/pylit.py.html#defaults
104 | .. _PylitOptions: examples/pylit.py.html#PylitOptions
105 | .. _pylit.main(): examples/pylit.py.html#main
106 |
--------------------------------------------------------------------------------
/docs/examples/listings-python-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-python-options.sty
2 | ***************************
3 | Configure `listings` to highlight Python code
4 | =============================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | To use the listings package for syntax highlighting with Docutils, pass the
16 | ``--stylesheet=listings-python-options.sty --literal-block-env=lstlisting``
17 | options to ``rst2latex.py``.
18 |
19 | For full documentation see listings.pdf_.
20 |
21 | Implementation
22 | --------------
23 |
24 | .. highlight:: latex
25 |
26 | Identification::
27 |
28 | \ProvidesPackage{listings-python-options}
29 | [2009/03/02 v0.1 highlight Python with lstlistings]
30 |
31 | Of course, we need to load the listings package itself::
32 |
33 | \RequirePackage{listings}
34 |
35 | In a document with lots of lists and listings, separating paragraphs by
36 | vertical seems appropriate::
37 |
38 | \RequirePackage{parskip}
39 |
40 | Font settings
41 | ~~~~~~~~~~~~~
42 |
43 | Textfont::
44 |
45 | % \RequirePackage{mathptmx} % Times
46 | \RequirePackage{mathpazo} % Palatino
47 |
48 | We need a "rich" monospaced font. `txfonts`' typewriter font comes
49 | with bold, slanted, and small-caps variants and without the problems of
50 | `txfonts`' math fonts::
51 |
52 | \renewcommand{\ttdefault}{txtt}
53 |
54 | Default language
55 | ~~~~~~~~~~~~~~~~
56 | ::
57 |
58 | %\lstset{language={}}
59 |
60 | Highlight literal blocks as Python,
61 | add missing keywords::
62 |
63 | \lstset{language=Python,
64 | morekeywords=[1]{yield}
65 | }
66 |
67 | % pre-load the language
68 | \lstloadlanguages{Python} % comma separated list of languages
69 |
70 |
71 | Style
72 | ~~~~~
73 |
74 | Typeface settings::
75 |
76 | \lstset{
77 | basicstyle=\ttfamily, % print whole listing in tt
78 | % basicstyle=\ttfamily\small, % and, maybe small
79 | keywordstyle=\bfseries,
80 | % identifierstyle=\slshape, % object names
81 | commentstyle=\rmfamily\itshape, % italic comments
82 | stringstyle=\slshape, % strings
83 | }
84 |
85 | Visible whitespace::
86 |
87 | \lstset{showstringspaces=false} % no visible spaces in strings
88 | %\lstset{showspaces=true,
89 | % showtabs=true,
90 | % tab=\rightarrowfill}
91 |
92 | Line numbers::
93 |
94 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
95 |
96 | Frames around listings::
97 |
98 | %\lstset{frame=single}
99 |
100 |
101 | Extended characters in listings::
102 |
103 | %extendedchars=true
104 | %extendedchars=false
105 |
106 | Column alignment
107 | ~~~~~~~~~~~~~~~~
108 |
109 | (for typesetting with variable width fonts)
110 |
111 | ``columns=[c|l|r] ``
112 | in [fixed, flexible, spaceflexible, or fullflexible]
113 | The optional c, l, or r controls the horizontal orientation of smallest
114 | output units (keywords, identifiers, etc.).
115 |
116 | default: [c]fixed
117 |
118 | ``basewidth={fixed, flexible}``
119 | sets the width of a single character box for fixed and flexible column
120 | mode (both to the same value or individually).
121 |
122 | default: {0.6em,0.45em}
123 |
124 | ::
125 |
126 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
127 |
128 | .. _listings.pdf:
129 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
130 |
--------------------------------------------------------------------------------
/_build/html/examples/listings-python-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-python-options.sty
2 | ***************************
3 | Configure `listings` to highlight Python code
4 | =============================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | To use the listings package for syntax highlighting with Docutils, pass the
16 | ``--stylesheet=listings-python-options.sty --literal-block-env=lstlisting``
17 | options to ``rst2latex.py``.
18 |
19 | For full documentation see listings.pdf_.
20 |
21 | Implementation
22 | --------------
23 |
24 | .. highlight:: latex
25 |
26 | Identification::
27 |
28 | \ProvidesPackage{listings-python-options}
29 | [2009/03/02 v0.1 highlight Python with lstlistings]
30 |
31 | Of course, we need to load the listings package itself::
32 |
33 | \RequirePackage{listings}
34 |
35 | In a document with lots of lists and listings, separating paragraphs by
36 | vertical seems appropriate::
37 |
38 | \RequirePackage{parskip}
39 |
40 | Font settings
41 | ~~~~~~~~~~~~~
42 |
43 | Textfont::
44 |
45 | % \RequirePackage{mathptmx} % Times
46 | \RequirePackage{mathpazo} % Palatino
47 |
48 | We need a "rich" monospaced font. `txfonts`' typewriter font comes
49 | with bold, slanted, and small-caps variants and without the problems of
50 | `txfonts`' math fonts::
51 |
52 | \renewcommand{\ttdefault}{txtt}
53 |
54 | Default language
55 | ~~~~~~~~~~~~~~~~
56 | ::
57 |
58 | %\lstset{language={}}
59 |
60 | Highlight literal blocks as Python,
61 | add missing keywords::
62 |
63 | \lstset{language=Python,
64 | morekeywords=[1]{yield}
65 | }
66 |
67 | % pre-load the language
68 | \lstloadlanguages{Python} % comma separated list of languages
69 |
70 |
71 | Style
72 | ~~~~~
73 |
74 | Typeface settings::
75 |
76 | \lstset{
77 | basicstyle=\ttfamily, % print whole listing in tt
78 | % basicstyle=\ttfamily\small, % and, maybe small
79 | keywordstyle=\bfseries,
80 | % identifierstyle=\slshape, % object names
81 | commentstyle=\rmfamily\itshape, % italic comments
82 | stringstyle=\slshape, % strings
83 | }
84 |
85 | Visible whitespace::
86 |
87 | \lstset{showstringspaces=false} % no visible spaces in strings
88 | %\lstset{showspaces=true,
89 | % showtabs=true,
90 | % tab=\rightarrowfill}
91 |
92 | Line numbers::
93 |
94 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
95 |
96 | Frames around listings::
97 |
98 | %\lstset{frame=single}
99 |
100 |
101 | Extended characters in listings::
102 |
103 | %extendedchars=true
104 | %extendedchars=false
105 |
106 | Column alignment
107 | ~~~~~~~~~~~~~~~~
108 |
109 | (for typesetting with variable width fonts)
110 |
111 | ``columns=[c|l|r] ``
112 | in [fixed, flexible, spaceflexible, or fullflexible]
113 | The optional c, l, or r controls the horizontal orientation of smallest
114 | output units (keywords, identifiers, etc.).
115 |
116 | default: [c]fixed
117 |
118 | ``basewidth={fixed, flexible}``
119 | sets the width of a single character box for fixed and flexible column
120 | mode (both to the same value or individually).
121 |
122 | default: {0.6em,0.45em}
123 |
124 | ::
125 |
126 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
127 |
128 | .. _listings.pdf:
129 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
130 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/listings-python-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-python-options.sty
2 | ***************************
3 | Configure `listings` to highlight Python code
4 | =============================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | To use the listings package for syntax highlighting with Docutils, pass the
16 | ``--stylesheet=listings-python-options.sty --literal-block-env=lstlisting``
17 | options to ``rst2latex.py``.
18 |
19 | For full documentation see listings.pdf_.
20 |
21 | Implementation
22 | --------------
23 |
24 | .. highlight:: latex
25 |
26 | Identification::
27 |
28 | \ProvidesPackage{listings-python-options}
29 | [2009/03/02 v0.1 highlight Python with lstlistings]
30 |
31 | Of course, we need to load the listings package itself::
32 |
33 | \RequirePackage{listings}
34 |
35 | In a document with lots of lists and listings, separating paragraphs by
36 | vertical seems appropriate::
37 |
38 | \RequirePackage{parskip}
39 |
40 | Font settings
41 | ~~~~~~~~~~~~~
42 |
43 | Textfont::
44 |
45 | % \RequirePackage{mathptmx} % Times
46 | \RequirePackage{mathpazo} % Palatino
47 |
48 | We need a "rich" monospaced font. `txfonts`' typewriter font comes
49 | with bold, slanted, and small-caps variants and without the problems of
50 | `txfonts`' math fonts::
51 |
52 | \renewcommand{\ttdefault}{txtt}
53 |
54 | Default language
55 | ~~~~~~~~~~~~~~~~
56 | ::
57 |
58 | %\lstset{language={}}
59 |
60 | Highlight literal blocks as Python,
61 | add missing keywords::
62 |
63 | \lstset{language=Python,
64 | morekeywords=[1]{yield}
65 | }
66 |
67 | % pre-load the language
68 | \lstloadlanguages{Python} % comma separated list of languages
69 |
70 |
71 | Style
72 | ~~~~~
73 |
74 | Typeface settings::
75 |
76 | \lstset{
77 | basicstyle=\ttfamily, % print whole listing in tt
78 | % basicstyle=\ttfamily\small, % and, maybe small
79 | keywordstyle=\bfseries,
80 | % identifierstyle=\slshape, % object names
81 | commentstyle=\rmfamily\itshape, % italic comments
82 | stringstyle=\slshape, % strings
83 | }
84 |
85 | Visible whitespace::
86 |
87 | \lstset{showstringspaces=false} % no visible spaces in strings
88 | %\lstset{showspaces=true,
89 | % showtabs=true,
90 | % tab=\rightarrowfill}
91 |
92 | Line numbers::
93 |
94 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
95 |
96 | Frames around listings::
97 |
98 | %\lstset{frame=single}
99 |
100 |
101 | Extended characters in listings::
102 |
103 | %extendedchars=true
104 | %extendedchars=false
105 |
106 | Column alignment
107 | ~~~~~~~~~~~~~~~~
108 |
109 | (for typesetting with variable width fonts)
110 |
111 | ``columns=[c|l|r] ``
112 | in [fixed, flexible, spaceflexible, or fullflexible]
113 | The optional c, l, or r controls the horizontal orientation of smallest
114 | output units (keywords, identifiers, etc.).
115 |
116 | default: [c]fixed
117 |
118 | ``basewidth={fixed, flexible}``
119 | sets the width of a single character box for fixed and flexible column
120 | mode (both to the same value or individually).
121 |
122 | default: {0.6em,0.45em}
123 |
124 | ::
125 |
126 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
127 |
128 | .. _listings.pdf:
129 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
130 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/listings-python-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-python-options.sty
2 | ***************************
3 | Configure `listings` to highlight Python code
4 | =============================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | To use the listings package for syntax highlighting with Docutils, pass the
16 | ``--stylesheet=listings-python-options.sty --literal-block-env=lstlisting``
17 | options to ``rst2latex.py``.
18 |
19 | For full documentation see listings.pdf_.
20 |
21 | Implementation
22 | --------------
23 |
24 | .. highlight:: latex
25 |
26 | Identification::
27 |
28 | \ProvidesPackage{listings-python-options}
29 | [2009/03/02 v0.1 highlight Python with lstlistings]
30 |
31 | Of course, we need to load the listings package itself::
32 |
33 | \RequirePackage{listings}
34 |
35 | In a document with lots of lists and listings, separating paragraphs by
36 | vertical seems appropriate::
37 |
38 | \RequirePackage{parskip}
39 |
40 | Font settings
41 | ~~~~~~~~~~~~~
42 |
43 | Textfont::
44 |
45 | % \RequirePackage{mathptmx} % Times
46 | \RequirePackage{mathpazo} % Palatino
47 |
48 | We need a "rich" monospaced font. `txfonts`' typewriter font comes
49 | with bold, slanted, and small-caps variants and without the problems of
50 | `txfonts`' math fonts::
51 |
52 | \renewcommand{\ttdefault}{txtt}
53 |
54 | Default language
55 | ~~~~~~~~~~~~~~~~
56 | ::
57 |
58 | %\lstset{language={}}
59 |
60 | Highlight literal blocks as Python,
61 | add missing keywords::
62 |
63 | \lstset{language=Python,
64 | morekeywords=[1]{yield}
65 | }
66 |
67 | % pre-load the language
68 | \lstloadlanguages{Python} % comma separated list of languages
69 |
70 |
71 | Style
72 | ~~~~~
73 |
74 | Typeface settings::
75 |
76 | \lstset{
77 | basicstyle=\ttfamily, % print whole listing in tt
78 | % basicstyle=\ttfamily\small, % and, maybe small
79 | keywordstyle=\bfseries,
80 | % identifierstyle=\slshape, % object names
81 | commentstyle=\rmfamily\itshape, % italic comments
82 | stringstyle=\slshape, % strings
83 | }
84 |
85 | Visible whitespace::
86 |
87 | \lstset{showstringspaces=false} % no visible spaces in strings
88 | %\lstset{showspaces=true,
89 | % showtabs=true,
90 | % tab=\rightarrowfill}
91 |
92 | Line numbers::
93 |
94 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
95 |
96 | Frames around listings::
97 |
98 | %\lstset{frame=single}
99 |
100 |
101 | Extended characters in listings::
102 |
103 | %extendedchars=true
104 | %extendedchars=false
105 |
106 | Column alignment
107 | ~~~~~~~~~~~~~~~~
108 |
109 | (for typesetting with variable width fonts)
110 |
111 | ``columns=[c|l|r] ``
112 | in [fixed, flexible, spaceflexible, or fullflexible]
113 | The optional c, l, or r controls the horizontal orientation of smallest
114 | output units (keywords, identifiers, etc.).
115 |
116 | default: [c]fixed
117 |
118 | ``basewidth={fixed, flexible}``
119 | sets the width of a single character box for fixed and flexible column
120 | mode (both to the same value or individually).
121 |
122 | default: {0.6em,0.45em}
123 |
124 | ::
125 |
126 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
127 |
128 | .. _listings.pdf:
129 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
130 |
--------------------------------------------------------------------------------
/docs/examples/99bottles.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # :Copyright: 2007 Riccardo Murri, Guenter Milde.
4 | # Released under the terms of the GNU General Public License
5 | # (v. 2 or later)
6 |
7 | # 99bottles.py
8 | # ============
9 | # Introductory Example to Literate Programming
10 | # ++++++++++++++++++++++++++++++++++++++++++++
11 | #
12 | # Print the famous `99 bottles of beer` song lyrics
13 | #
14 | #
15 | # This was used as an introductory example to literate programming
16 | # in the (no longer available) `LiteratePrograms.org Wiki`.
17 | #
18 | # The lyrics
19 | # ----------
20 | #
21 | # We take the lyrics from the Wikipedia, which says in the
22 | # `99 bottles of beer`_ entry:
23 | #
24 | # The verse format is very formulaic, and can be expressed as follows:
25 | #
26 | # From 99 down to 1::
27 |
28 | verse_template = """
29 | bottles of beer on the wall
30 | bottles of beer!
31 | Take one down, pass it around
32 | bottles of beer on the wall!"""
33 |
34 | # There is much variation in the final verse. One common final verse (which
35 | # could potentially cause an infinite-loop motif) is::
36 |
37 | final_verse = """
38 | No bottles of beer on the wall!
39 | No bottles of beer!
40 | Go to the store and buy some more
41 | 99 bottles of beer on the wall!"""
42 |
43 | # The Python program
44 | # ------------------
45 | #
46 | # There are a countless number of ways to implement a program that prints the
47 | # whole song in Python. The following examples uses a `for` loop and the
48 | # `replace` method of string objects.
49 | #
50 | # Basic version
51 | #
52 | # Count down from 99 to 1 and print the verses::
53 |
54 | def print_verses_1(start_number=99):
55 | for number in range(start_number, 0, -1):
56 | verse = verse_template.replace("", str(number))
57 | print(verse.replace("", str(number-1 or "No")))
58 |
59 | # Consider the singular case
60 | #
61 | # There is one problem left, we should check whether to print 'bottles' or
62 | # 'bottle'.
63 | #
64 | # An improved version will replace the "bottles" with a construct that
65 | # takes into account the actual number of bottles::
66 |
67 | def print_verses_2(start_number=99):
68 | for number in range(start_number, 0, -1):
69 | verse = verse_template.replace("", str(number))
70 | verse = verse.replace("bottles", "bottle" + plural_suffix(number))
71 | print(verse.replace("", str(number-1 or "No")))
72 |
73 | # where an auxiliary function returns the matching suffix (or not)::
74 |
75 | def plural_suffix(number):
76 | if number != 1:
77 | return "s"
78 | else:
79 | return ""
80 |
81 | # Still, the last line come out wrong, as here we have bottles. To
82 | # treat this case we either could split the last line and treat it differently,
83 | # or use a modified template as e.g. ::
84 |
85 | verse_template_2 = """
86 | bottle of beer on the wall
87 | bottle of beer!
88 | Take one down, pass it around
89 | bottle of beer on the wall!"""
90 |
91 | # together with::
92 |
93 | def print_verses_3(start_number=99):
94 | for number in range(start_number, 0, -1):
95 | verse = verse_template_2.replace("", str(number))
96 | verse = verse.replace("", plural_suffix(number), 2)
97 | verse = verse.replace("", plural_suffix(number-1), 1)
98 | print(verse.replace("", str(number-1 or "No")))
99 |
100 |
101 | # Command line use
102 | # ----------------
103 | #
104 | # Print the lyrics if this script is called from the command line::
105 |
106 | if __name__ == "__main__":
107 | print_verses_3()
108 | print(final_verse)
109 |
110 |
111 | # .. _99 bottles of beer: http://en.wikipedia.org/wiki/99_Bottles_of_Beer
112 | # .. .. _LiteratePrograms.org Wiki:
113 | # http://en.literateprograms.org/LiteratePrograms:Welcome
114 |
--------------------------------------------------------------------------------
/docs/examples/99bottles.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | #
3 | # :Copyright: 2007 Riccardo Murri, Guenter Milde.
4 | # Released under the terms of the GNU General Public License
5 | # (v. 2 or later)
6 |
7 | 99bottles.py
8 | ============
9 | Introductory Example to Literate Programming
10 | ++++++++++++++++++++++++++++++++++++++++++++
11 |
12 | Print the famous `99 bottles of beer` song lyrics
13 |
14 |
15 | This was used as an introductory example to literate programming
16 | in the (no longer available) `LiteratePrograms.org Wiki`.
17 |
18 | This version uses Python3.
19 |
20 | The lyrics
21 | ----------
22 |
23 | We take the lyrics from the Wikipedia, which says in the
24 | `99 bottles of beer`_ entry:
25 |
26 | The verse format is very formulaic, and can be expressed as follows:
27 |
28 | From 99 down to 1::
29 |
30 | verse_template = """
31 | bottles of beer on the wall
32 | bottles of beer!
33 | Take one down, pass it around
34 | bottles of beer on the wall!"""
35 |
36 | There is much variation in the final verse. One common final verse (which
37 | could potentially cause an infinite-loop motif) is::
38 |
39 | final_verse = """
40 | No bottles of beer on the wall!
41 | No bottles of beer!
42 | Go to the store and buy some more
43 | 99 bottles of beer on the wall!"""
44 |
45 | The Python program
46 | ------------------
47 |
48 | There are a countless number of ways to implement a program that prints the
49 | whole song in Python. The following examples uses a `for` loop and the
50 | `replace` method of string objects.
51 |
52 | Basic version
53 |
54 | Count down from 99 to 1 and print the verses::
55 |
56 | def print_verses_1(start_number=99):
57 | for number in range(start_number, 0, -1):
58 | verse = verse_template.replace("", str(number))
59 | print(verse.replace("", str(number-1 or "No")))
60 |
61 | Consider the singular case
62 |
63 | There is one problem left, we should check whether to print 'bottles' or
64 | 'bottle'.
65 |
66 | An improved version will replace the "bottles" with a construct that
67 | takes into account the actual number of bottles::
68 |
69 | def print_verses_2(start_number=99):
70 | for number in range(start_number, 0, -1):
71 | verse = verse_template.replace("", str(number))
72 | verse = verse.replace("bottles", "bottle" + plural_suffix(number))
73 | print(verse.replace("", str(number-1 or "No")))
74 |
75 | where an auxiliary function returns the matching suffix (or not)::
76 |
77 | def plural_suffix(number):
78 | if number != 1:
79 | return "s"
80 | else:
81 | return ""
82 |
83 | Still, the last line come out wrong, as here we have bottles. To
84 | treat this case we either could split the last line and treat it differently,
85 | or use a modified template as e.g. ::
86 |
87 | verse_template_2 = """
88 | bottle of beer on the wall
89 | bottle of beer!
90 | Take one down, pass it around
91 | bottle of beer on the wall!"""
92 |
93 | together with::
94 |
95 | def print_verses_3(start_number=99):
96 | for number in range(start_number, 0, -1):
97 | verse = verse_template_2.replace("", str(number))
98 | verse = verse.replace("", plural_suffix(number), 2)
99 | verse = verse.replace("", plural_suffix(number-1), 1)
100 | print(verse.replace("", str(number-1 or "No")))
101 |
102 |
103 | Command line use
104 | ----------------
105 |
106 | Print the lyrics if this script is called from the command line::
107 |
108 | if __name__ == "__main__":
109 | print_verses_3()
110 | print(final_verse)
111 |
112 |
113 | .. _99 bottles of beer: http://en.wikipedia.org/wiki/99_Bottles_of_Beer
114 | .. .. _LiteratePrograms.org Wiki:
115 | http://en.literateprograms.org/LiteratePrograms:Welcome
116 |
--------------------------------------------------------------------------------
/_build/html/examples/99bottles.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | #
3 | # :Copyright: 2007 Riccardo Murri, Guenter Milde.
4 | # Released under the terms of the GNU General Public License
5 | # (v. 2 or later)
6 |
7 | 99bottles.py
8 | ============
9 | Introductory Example to Literate Programming
10 | ++++++++++++++++++++++++++++++++++++++++++++
11 |
12 | Print the famous `99 bottles of beer` song lyrics
13 |
14 |
15 | This was used as an introductory example to literate programming
16 | in the (no longer available) `LiteratePrograms.org Wiki`.
17 |
18 | This version uses Python3.
19 |
20 | The lyrics
21 | ----------
22 |
23 | We take the lyrics from the Wikipedia, which says in the
24 | `99 bottles of beer`_ entry:
25 |
26 | The verse format is very formulaic, and can be expressed as follows:
27 |
28 | From 99 down to 1::
29 |
30 | verse_template = """
31 | bottles of beer on the wall
32 | bottles of beer!
33 | Take one down, pass it around
34 | bottles of beer on the wall!"""
35 |
36 | There is much variation in the final verse. One common final verse (which
37 | could potentially cause an infinite-loop motif) is::
38 |
39 | final_verse = """
40 | No bottles of beer on the wall!
41 | No bottles of beer!
42 | Go to the store and buy some more
43 | 99 bottles of beer on the wall!"""
44 |
45 | The Python program
46 | ------------------
47 |
48 | There are a countless number of ways to implement a program that prints the
49 | whole song in Python. The following examples uses a `for` loop and the
50 | `replace` method of string objects.
51 |
52 | Basic version
53 |
54 | Count down from 99 to 1 and print the verses::
55 |
56 | def print_verses_1(start_number=99):
57 | for number in range(start_number, 0, -1):
58 | verse = verse_template.replace("", str(number))
59 | print(verse.replace("", str(number-1 or "No")))
60 |
61 | Consider the singular case
62 |
63 | There is one problem left, we should check whether to print 'bottles' or
64 | 'bottle'.
65 |
66 | An improved version will replace the "bottles" with a construct that
67 | takes into account the actual number of bottles::
68 |
69 | def print_verses_2(start_number=99):
70 | for number in range(start_number, 0, -1):
71 | verse = verse_template.replace("", str(number))
72 | verse = verse.replace("bottles", "bottle" + plural_suffix(number))
73 | print(verse.replace("", str(number-1 or "No")))
74 |
75 | where an auxiliary function returns the matching suffix (or not)::
76 |
77 | def plural_suffix(number):
78 | if number != 1:
79 | return "s"
80 | else:
81 | return ""
82 |
83 | Still, the last line come out wrong, as here we have bottles. To
84 | treat this case we either could split the last line and treat it differently,
85 | or use a modified template as e.g. ::
86 |
87 | verse_template_2 = """
88 | bottle of beer on the wall
89 | bottle of beer!
90 | Take one down, pass it around
91 | bottle of beer on the wall!"""
92 |
93 | together with::
94 |
95 | def print_verses_3(start_number=99):
96 | for number in range(start_number, 0, -1):
97 | verse = verse_template_2.replace("", str(number))
98 | verse = verse.replace("", plural_suffix(number), 2)
99 | verse = verse.replace("", plural_suffix(number-1), 1)
100 | print(verse.replace("", str(number-1 or "No")))
101 |
102 |
103 | Command line use
104 | ----------------
105 |
106 | Print the lyrics if this script is called from the command line::
107 |
108 | if __name__ == "__main__":
109 | print_verses_3()
110 | print(final_verse)
111 |
112 |
113 | .. _99 bottles of beer: http://en.wikipedia.org/wiki/99_Bottles_of_Beer
114 | .. .. _LiteratePrograms.org Wiki:
115 | http://en.literateprograms.org/LiteratePrograms:Welcome
116 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/99bottles.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | #
3 | # :Copyright: 2007 Riccardo Murri, Guenter Milde.
4 | # Released under the terms of the GNU General Public License
5 | # (v. 2 or later)
6 |
7 | 99bottles.py
8 | ============
9 | Introductory Example to Literate Programming
10 | ++++++++++++++++++++++++++++++++++++++++++++
11 |
12 | Print the famous `99 bottles of beer` song lyrics
13 |
14 |
15 | This was used as an introductory example to literate programming
16 | in the (no longer available) `LiteratePrograms.org Wiki`.
17 |
18 | This version uses Python3.
19 |
20 | The lyrics
21 | ----------
22 |
23 | We take the lyrics from the Wikipedia, which says in the
24 | `99 bottles of beer`_ entry:
25 |
26 | The verse format is very formulaic, and can be expressed as follows:
27 |
28 | From 99 down to 1::
29 |
30 | verse_template = """
31 | bottles of beer on the wall
32 | bottles of beer!
33 | Take one down, pass it around
34 | bottles of beer on the wall!"""
35 |
36 | There is much variation in the final verse. One common final verse (which
37 | could potentially cause an infinite-loop motif) is::
38 |
39 | final_verse = """
40 | No bottles of beer on the wall!
41 | No bottles of beer!
42 | Go to the store and buy some more
43 | 99 bottles of beer on the wall!"""
44 |
45 | The Python program
46 | ------------------
47 |
48 | There are a countless number of ways to implement a program that prints the
49 | whole song in Python. The following examples uses a `for` loop and the
50 | `replace` method of string objects.
51 |
52 | Basic version
53 |
54 | Count down from 99 to 1 and print the verses::
55 |
56 | def print_verses_1(start_number=99):
57 | for number in range(start_number, 0, -1):
58 | verse = verse_template.replace("", str(number))
59 | print(verse.replace("", str(number-1 or "No")))
60 |
61 | Consider the singular case
62 |
63 | There is one problem left, we should check whether to print 'bottles' or
64 | 'bottle'.
65 |
66 | An improved version will replace the "bottles" with a construct that
67 | takes into account the actual number of bottles::
68 |
69 | def print_verses_2(start_number=99):
70 | for number in range(start_number, 0, -1):
71 | verse = verse_template.replace("", str(number))
72 | verse = verse.replace("bottles", "bottle" + plural_suffix(number))
73 | print(verse.replace("", str(number-1 or "No")))
74 |
75 | where an auxiliary function returns the matching suffix (or not)::
76 |
77 | def plural_suffix(number):
78 | if number != 1:
79 | return "s"
80 | else:
81 | return ""
82 |
83 | Still, the last line come out wrong, as here we have bottles. To
84 | treat this case we either could split the last line and treat it differently,
85 | or use a modified template as e.g. ::
86 |
87 | verse_template_2 = """
88 | bottle of beer on the wall
89 | bottle of beer!
90 | Take one down, pass it around
91 | bottle of beer on the wall!"""
92 |
93 | together with::
94 |
95 | def print_verses_3(start_number=99):
96 | for number in range(start_number, 0, -1):
97 | verse = verse_template_2.replace("", str(number))
98 | verse = verse.replace("", plural_suffix(number), 2)
99 | verse = verse.replace("", plural_suffix(number-1), 1)
100 | print(verse.replace("", str(number-1 or "No")))
101 |
102 |
103 | Command line use
104 | ----------------
105 |
106 | Print the lyrics if this script is called from the command line::
107 |
108 | if __name__ == "__main__":
109 | print_verses_3()
110 | print(final_verse)
111 |
112 |
113 | .. _99 bottles of beer: http://en.wikipedia.org/wiki/99_Bottles_of_Beer
114 | .. .. _LiteratePrograms.org Wiki:
115 | http://en.literateprograms.org/LiteratePrograms:Welcome
116 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/99bottles.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | #
3 | # :Copyright: 2007 Riccardo Murri, Guenter Milde.
4 | # Released under the terms of the GNU General Public License
5 | # (v. 2 or later)
6 |
7 | 99bottles.py
8 | ============
9 | Introductory Example to Literate Programming
10 | ++++++++++++++++++++++++++++++++++++++++++++
11 |
12 | Print the famous `99 bottles of beer` song lyrics
13 |
14 |
15 | This was used as an introductory example to literate programming
16 | in the (no longer available) `LiteratePrograms.org Wiki`.
17 |
18 | This version uses Python3.
19 |
20 | The lyrics
21 | ----------
22 |
23 | We take the lyrics from the Wikipedia, which says in the
24 | `99 bottles of beer`_ entry:
25 |
26 | The verse format is very formulaic, and can be expressed as follows:
27 |
28 | From 99 down to 1::
29 |
30 | verse_template = """
31 | bottles of beer on the wall
32 | bottles of beer!
33 | Take one down, pass it around
34 | bottles of beer on the wall!"""
35 |
36 | There is much variation in the final verse. One common final verse (which
37 | could potentially cause an infinite-loop motif) is::
38 |
39 | final_verse = """
40 | No bottles of beer on the wall!
41 | No bottles of beer!
42 | Go to the store and buy some more
43 | 99 bottles of beer on the wall!"""
44 |
45 | The Python program
46 | ------------------
47 |
48 | There are a countless number of ways to implement a program that prints the
49 | whole song in Python. The following examples uses a `for` loop and the
50 | `replace` method of string objects.
51 |
52 | Basic version
53 |
54 | Count down from 99 to 1 and print the verses::
55 |
56 | def print_verses_1(start_number=99):
57 | for number in range(start_number, 0, -1):
58 | verse = verse_template.replace("", str(number))
59 | print(verse.replace("", str(number-1 or "No")))
60 |
61 | Consider the singular case
62 |
63 | There is one problem left, we should check whether to print 'bottles' or
64 | 'bottle'.
65 |
66 | An improved version will replace the "bottles" with a construct that
67 | takes into account the actual number of bottles::
68 |
69 | def print_verses_2(start_number=99):
70 | for number in range(start_number, 0, -1):
71 | verse = verse_template.replace("", str(number))
72 | verse = verse.replace("bottles", "bottle" + plural_suffix(number))
73 | print(verse.replace("", str(number-1 or "No")))
74 |
75 | where an auxiliary function returns the matching suffix (or not)::
76 |
77 | def plural_suffix(number):
78 | if number != 1:
79 | return "s"
80 | else:
81 | return ""
82 |
83 | Still, the last line come out wrong, as here we have bottles. To
84 | treat this case we either could split the last line and treat it differently,
85 | or use a modified template as e.g. ::
86 |
87 | verse_template_2 = """
88 | bottle of beer on the wall
89 | bottle of beer!
90 | Take one down, pass it around
91 | bottle of beer on the wall!"""
92 |
93 | together with::
94 |
95 | def print_verses_3(start_number=99):
96 | for number in range(start_number, 0, -1):
97 | verse = verse_template_2.replace("", str(number))
98 | verse = verse.replace("", plural_suffix(number), 2)
99 | verse = verse.replace("", plural_suffix(number-1), 1)
100 | print(verse.replace("", str(number-1 or "No")))
101 |
102 |
103 | Command line use
104 | ----------------
105 |
106 | Print the lyrics if this script is called from the command line::
107 |
108 | if __name__ == "__main__":
109 | print_verses_3()
110 | print(final_verse)
111 |
112 |
113 | .. _99 bottles of beer: http://en.wikipedia.org/wiki/99_Bottles_of_Beer
114 | .. .. _LiteratePrograms.org Wiki:
115 | http://en.literateprograms.org/LiteratePrograms:Welcome
116 |
--------------------------------------------------------------------------------
/contribs/pylit_elisp.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | # ===============================================================
5 | # pylit_elisp.py: Settings and filters for elisp conversion
6 | # ===============================================================
7 | #
8 | # :Date: $Date: 2007-05-14 14:14:54 +0200$
9 | # :Version: SVN-Revision $Revision: 105 $
10 | # :URL: $URL$
11 | # :Copyright: 2007 Riccardo Murri
12 | # Released under the terms of the GNU General Public License
13 | # (v. 2 or later)
14 | #
15 | # .. sectnum::
16 | # .. contents::
17 |
18 | # Frontmatter
19 | # ===========
20 | #
21 | # Changelog
22 | # ---------
23 | #
24 | # :0.2: Complete rewrite, following G. Milde's suggestions.
25 | # :0.3: * Rewrite filter as iterator generators, the filter interface is
26 | # moved to pylit.py(GM)
27 | # * require three semicolons (``;;;``) in section header regexp
28 | # ::
29 |
30 | """Emacs lisp for the PyLit code<->text converter.
31 |
32 | Defaults and filters for elisp (emacs lisp) code
33 | """
34 |
35 | __docformat__ = 'restructuredtext'
36 |
37 | _version = "0.3"
38 |
39 |
40 | # Requirements
41 | # ------------
42 | #
43 | # Regular espressions are used in `ELISP filters` to match
44 | # the ELisp sectioning comments::
45 |
46 | import re
47 |
48 | import pylit
49 |
50 | # Emacs Lisp filters
51 | # ==================
52 | #
53 | #
54 | # ::
55 |
56 | def elisp_code_preprocessor(data):
57 | """Convert Emacs Lisp comment sectioning markers to reST comments.
58 |
59 | The special headers listed at:
60 |
61 | http://www.gnu.org/software/emacs/elisp/html_node/Library-Headers.html#Library-Headers
62 |
63 | are converted to reST comment lines and prefixed with the comment
64 | line marker (taken from keyword arguments); all other content is
65 | passed through unchanged.
66 |
67 | For instance, ELisp code:
68 |
69 | ;;; Code:
70 |
71 | ;; here begins the real coding
72 | (defun my-elisp-function () ...)
73 |
74 | is translated to:
75 |
76 | ;; .. |elisp> ;;; Code:
77 |
78 | ;; here begins the real coding
79 | (defun my-elisp-function () ...)
80 | """
81 |
82 | # Regular expression matching the special ELisp headers::
83 |
84 | SECTION_PATTERN = \
85 | re.compile(';;; *(Change *Log|Code|Commentary|Documentation|History):',\
86 | re.IGNORECASE)
87 |
88 | # Prepend ``.. |elisp> `` to matching headers, one line at a time::
89 |
90 | for line in data:
91 | if SECTION_PATTERN.match(line):
92 | yield pylit.defaults.comment_strings["elisp"] + '.. |elisp> ' + line
93 | else:
94 | yield line
95 |
96 |
97 | def elisp_code_postprocessor(data):
98 | """Convert specially-marked reST comments to Emacs Lisp code.
99 |
100 | In all lines, the prefix ``.. |elisp> `` (note
101 | the trailing space!) is stripped from the begin of a line.
102 |
103 | For instance, the block:
104 |
105 | .. |elisp> ;;; Code:
106 | .. |elisp> (some-elisp-incantation)
107 | (another-one)
108 |
109 | is translated to:
110 |
111 | ;;; Code:
112 | (some-elisp-incantation)
113 | (another-one)
114 | """
115 |
116 | # Set the prefix to be stripped
117 | prefix = pylit.defaults.comment_strings["elisp"] + '.. |elisp> '
118 |
119 | for line in data:
120 | if line.startswith(prefix):
121 | yield line[len(prefix):]
122 | else:
123 | yield line
124 |
125 |
126 |
127 | # Register elisp
128 | # ==============
129 | #
130 | # Add default values for "elisp" to the `defaults` object from PyLit.
131 | #
132 | # The following code assumes that this plug-in is always evaluated in the
133 | # pylit namespace and after pylit.py
134 | #
135 | # ::
136 |
137 | pylit.defaults.languages[".el"] = "elisp"
138 | pylit.defaults.comment_strings["elisp"] = ';; '
139 |
140 | # Filters
141 | pylit.defaults.preprocessors["elisp2text"] = elisp_code_preprocessor
142 | pylit.defaults.postprocessors["text2elisp"] = elisp_code_postprocessor
143 |
144 |
--------------------------------------------------------------------------------
/docs/examples/pygments-default.css.txt:
--------------------------------------------------------------------------------
1 | Stylesheet for reStructured Text code blocks
2 | ============================================
3 |
4 | :Author: Guenter Milde
5 | :Copyright: © 2007, 2011 G. Milde
6 | This stylesheet is released under the GPL v. 2 or later
7 |
8 | This stylesheet provides syntax highlight for documents using
9 | the `code` directive (new in Docutils 0.9).
10 |
11 | Import the default docutils style sheet
12 | ---------------------------------------
13 | ::
14 |
15 | @import url("/stylesheets/html4css1.css");
16 |
17 | Style code block
18 | ---------------------
19 |
20 | Content copied from the `html4css1.css` rule for literal blocks::
21 |
22 | pre.code {
23 | margin-left: 2em ;
24 | margin-right: 2em ;
25 | background-color: #eeeeee
26 | }
27 |
28 | pre.code .ln { /* line numbers */
29 | // color: grey;
30 | font-size: small;
31 | }
32 |
33 | Syntax highlight
34 | ----------------
35 |
36 | Pygments_ has an option to generate stylesheets for html and latex.
37 | The following code is generated with the command
38 | `pygmentize -S default -f html > pygments-default.css`::
39 |
40 | .c { color: #008800; font-style: italic } /* Comment */
41 | .err { border: 1px solid #FF0000 } /* Error */
42 | .k { color: #AA22FF; font-weight: bold } /* Keyword */
43 | .o { color: #666666 } /* Operator */
44 | .cm { color: #008800; font-style: italic } /* Comment.Multiline */
45 | .cp { color: #008800 } /* Comment.Preproc */
46 | .c1 { color: #008800; font-style: italic } /* Comment.Single */
47 | .gd { color: #A00000 } /* Generic.Deleted */
48 | .ge { font-style: italic } /* Generic.Emph */
49 | .gr { color: #FF0000 } /* Generic.Error */
50 | .gh { color: #000080; font-weight: bold } /* Generic.Heading */
51 | .gi { color: #00A000 } /* Generic.Inserted */
52 | .go { color: #808080 } /* Generic.Output */
53 | .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
54 | .gs { font-weight: bold } /* Generic.Strong */
55 | .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
56 | .gt { color: #0040D0 } /* Generic.Traceback */
57 | .kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */
58 | .kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */
59 | .kp { color: #AA22FF } /* Keyword.Pseudo */
60 | .kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */
61 | .kt { color: #AA22FF; font-weight: bold } /* Keyword.Type */
62 | .m { color: #666666 } /* Literal.Number */
63 | .s { color: #BB4444 } /* Literal.String */
64 | .na { color: #BB4444 } /* Name.Attribute */
65 | .nb { color: #AA22FF } /* Name.Builtin */
66 | .nc { color: #0000FF } /* Name.Class */
67 | .no { color: #880000 } /* Name.Constant */
68 | .nd { color: #AA22FF } /* Name.Decorator */
69 | .ni { color: #999999; font-weight: bold } /* Name.Entity */
70 | .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
71 | .nf { color: #00A000 } /* Name.Function */
72 | .nl { color: #A0A000 } /* Name.Label */
73 | .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
74 | .nt { color: #008000; font-weight: bold } /* Name.Tag */
75 | .nv { color: #B8860B } /* Name.Variable */
76 | .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
77 | .mf { color: #666666 } /* Literal.Number.Float */
78 | .mh { color: #666666 } /* Literal.Number.Hex */
79 | .mi { color: #666666 } /* Literal.Number.Integer */
80 | .mo { color: #666666 } /* Literal.Number.Oct */
81 | .sb { color: #BB4444 } /* Literal.String.Backtick */
82 | .sc { color: #BB4444 } /* Literal.String.Char */
83 | .sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */
84 | .s2 { color: #BB4444 } /* Literal.String.Double */
85 | .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
86 | .sh { color: #BB4444 } /* Literal.String.Heredoc */
87 | .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
88 | .sx { color: #008000 } /* Literal.String.Other */
89 | .sr { color: #BB6688 } /* Literal.String.Regex */
90 | .s1 { color: #BB4444 } /* Literal.String.Single */
91 | .ss { color: #B8860B } /* Literal.String.Symbol */
92 | .bp { color: #AA22FF } /* Name.Builtin.Pseudo */
93 | .vc { color: #B8860B } /* Name.Variable.Class */
94 | .vg { color: #B8860B } /* Name.Variable.Global */
95 | .vi { color: #B8860B } /* Name.Variable.Instance */
96 | .il { color: #666666 } /* Literal.Number.Integer.Long */
97 |
98 | .. _pygments: http://pygments.org/
99 |
--------------------------------------------------------------------------------
/_build/html/examples/pygments-default.css.txt:
--------------------------------------------------------------------------------
1 | Stylesheet for reStructured Text code blocks
2 | ============================================
3 |
4 | :Author: Guenter Milde
5 | :Copyright: © 2007, 2011 G. Milde
6 | This stylesheet is released under the GPL v. 2 or later
7 |
8 | This stylesheet provides syntax highlight for documents using
9 | the `code` directive (new in Docutils 0.9).
10 |
11 | Import the default docutils style sheet
12 | ---------------------------------------
13 | ::
14 |
15 | @import url("/stylesheets/html4css1.css");
16 |
17 | Style code block
18 | ---------------------
19 |
20 | Content copied from the `html4css1.css` rule for literal blocks::
21 |
22 | pre.code {
23 | margin-left: 2em ;
24 | margin-right: 2em ;
25 | background-color: #eeeeee
26 | }
27 |
28 | pre.code .ln { /* line numbers */
29 | // color: grey;
30 | font-size: small;
31 | }
32 |
33 | Syntax highlight
34 | ----------------
35 |
36 | Pygments_ has an option to generate stylesheets for html and latex.
37 | The following code is generated with the command
38 | `pygmentize -S default -f html > pygments-default.css`::
39 |
40 | .c { color: #008800; font-style: italic } /* Comment */
41 | .err { border: 1px solid #FF0000 } /* Error */
42 | .k { color: #AA22FF; font-weight: bold } /* Keyword */
43 | .o { color: #666666 } /* Operator */
44 | .cm { color: #008800; font-style: italic } /* Comment.Multiline */
45 | .cp { color: #008800 } /* Comment.Preproc */
46 | .c1 { color: #008800; font-style: italic } /* Comment.Single */
47 | .gd { color: #A00000 } /* Generic.Deleted */
48 | .ge { font-style: italic } /* Generic.Emph */
49 | .gr { color: #FF0000 } /* Generic.Error */
50 | .gh { color: #000080; font-weight: bold } /* Generic.Heading */
51 | .gi { color: #00A000 } /* Generic.Inserted */
52 | .go { color: #808080 } /* Generic.Output */
53 | .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
54 | .gs { font-weight: bold } /* Generic.Strong */
55 | .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
56 | .gt { color: #0040D0 } /* Generic.Traceback */
57 | .kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */
58 | .kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */
59 | .kp { color: #AA22FF } /* Keyword.Pseudo */
60 | .kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */
61 | .kt { color: #AA22FF; font-weight: bold } /* Keyword.Type */
62 | .m { color: #666666 } /* Literal.Number */
63 | .s { color: #BB4444 } /* Literal.String */
64 | .na { color: #BB4444 } /* Name.Attribute */
65 | .nb { color: #AA22FF } /* Name.Builtin */
66 | .nc { color: #0000FF } /* Name.Class */
67 | .no { color: #880000 } /* Name.Constant */
68 | .nd { color: #AA22FF } /* Name.Decorator */
69 | .ni { color: #999999; font-weight: bold } /* Name.Entity */
70 | .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
71 | .nf { color: #00A000 } /* Name.Function */
72 | .nl { color: #A0A000 } /* Name.Label */
73 | .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
74 | .nt { color: #008000; font-weight: bold } /* Name.Tag */
75 | .nv { color: #B8860B } /* Name.Variable */
76 | .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
77 | .mf { color: #666666 } /* Literal.Number.Float */
78 | .mh { color: #666666 } /* Literal.Number.Hex */
79 | .mi { color: #666666 } /* Literal.Number.Integer */
80 | .mo { color: #666666 } /* Literal.Number.Oct */
81 | .sb { color: #BB4444 } /* Literal.String.Backtick */
82 | .sc { color: #BB4444 } /* Literal.String.Char */
83 | .sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */
84 | .s2 { color: #BB4444 } /* Literal.String.Double */
85 | .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
86 | .sh { color: #BB4444 } /* Literal.String.Heredoc */
87 | .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
88 | .sx { color: #008000 } /* Literal.String.Other */
89 | .sr { color: #BB6688 } /* Literal.String.Regex */
90 | .s1 { color: #BB4444 } /* Literal.String.Single */
91 | .ss { color: #B8860B } /* Literal.String.Symbol */
92 | .bp { color: #AA22FF } /* Name.Builtin.Pseudo */
93 | .vc { color: #B8860B } /* Name.Variable.Class */
94 | .vg { color: #B8860B } /* Name.Variable.Global */
95 | .vi { color: #B8860B } /* Name.Variable.Instance */
96 | .il { color: #666666 } /* Literal.Number.Integer.Long */
97 |
98 | .. _pygments: http://pygments.org/
99 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/pygments-default.css.txt:
--------------------------------------------------------------------------------
1 | Stylesheet for reStructured Text code blocks
2 | ============================================
3 |
4 | :Author: Guenter Milde
5 | :Copyright: © 2007, 2011 G. Milde
6 | This stylesheet is released under the GPL v. 2 or later
7 |
8 | This stylesheet provides syntax highlight for documents using
9 | the `code` directive (new in Docutils 0.9).
10 |
11 | Import the default docutils style sheet
12 | ---------------------------------------
13 | ::
14 |
15 | @import url("/stylesheets/html4css1.css");
16 |
17 | Style code block
18 | ---------------------
19 |
20 | Content copied from the `html4css1.css` rule for literal blocks::
21 |
22 | pre.code {
23 | margin-left: 2em ;
24 | margin-right: 2em ;
25 | background-color: #eeeeee
26 | }
27 |
28 | pre.code .ln { /* line numbers */
29 | // color: grey;
30 | font-size: small;
31 | }
32 |
33 | Syntax highlight
34 | ----------------
35 |
36 | Pygments_ has an option to generate stylesheets for html and latex.
37 | The following code is generated with the command
38 | `pygmentize -S default -f html > pygments-default.css`::
39 |
40 | .c { color: #008800; font-style: italic } /* Comment */
41 | .err { border: 1px solid #FF0000 } /* Error */
42 | .k { color: #AA22FF; font-weight: bold } /* Keyword */
43 | .o { color: #666666 } /* Operator */
44 | .cm { color: #008800; font-style: italic } /* Comment.Multiline */
45 | .cp { color: #008800 } /* Comment.Preproc */
46 | .c1 { color: #008800; font-style: italic } /* Comment.Single */
47 | .gd { color: #A00000 } /* Generic.Deleted */
48 | .ge { font-style: italic } /* Generic.Emph */
49 | .gr { color: #FF0000 } /* Generic.Error */
50 | .gh { color: #000080; font-weight: bold } /* Generic.Heading */
51 | .gi { color: #00A000 } /* Generic.Inserted */
52 | .go { color: #808080 } /* Generic.Output */
53 | .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
54 | .gs { font-weight: bold } /* Generic.Strong */
55 | .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
56 | .gt { color: #0040D0 } /* Generic.Traceback */
57 | .kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */
58 | .kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */
59 | .kp { color: #AA22FF } /* Keyword.Pseudo */
60 | .kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */
61 | .kt { color: #AA22FF; font-weight: bold } /* Keyword.Type */
62 | .m { color: #666666 } /* Literal.Number */
63 | .s { color: #BB4444 } /* Literal.String */
64 | .na { color: #BB4444 } /* Name.Attribute */
65 | .nb { color: #AA22FF } /* Name.Builtin */
66 | .nc { color: #0000FF } /* Name.Class */
67 | .no { color: #880000 } /* Name.Constant */
68 | .nd { color: #AA22FF } /* Name.Decorator */
69 | .ni { color: #999999; font-weight: bold } /* Name.Entity */
70 | .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
71 | .nf { color: #00A000 } /* Name.Function */
72 | .nl { color: #A0A000 } /* Name.Label */
73 | .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
74 | .nt { color: #008000; font-weight: bold } /* Name.Tag */
75 | .nv { color: #B8860B } /* Name.Variable */
76 | .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
77 | .mf { color: #666666 } /* Literal.Number.Float */
78 | .mh { color: #666666 } /* Literal.Number.Hex */
79 | .mi { color: #666666 } /* Literal.Number.Integer */
80 | .mo { color: #666666 } /* Literal.Number.Oct */
81 | .sb { color: #BB4444 } /* Literal.String.Backtick */
82 | .sc { color: #BB4444 } /* Literal.String.Char */
83 | .sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */
84 | .s2 { color: #BB4444 } /* Literal.String.Double */
85 | .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
86 | .sh { color: #BB4444 } /* Literal.String.Heredoc */
87 | .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
88 | .sx { color: #008000 } /* Literal.String.Other */
89 | .sr { color: #BB6688 } /* Literal.String.Regex */
90 | .s1 { color: #BB4444 } /* Literal.String.Single */
91 | .ss { color: #B8860B } /* Literal.String.Symbol */
92 | .bp { color: #AA22FF } /* Name.Builtin.Pseudo */
93 | .vc { color: #B8860B } /* Name.Variable.Class */
94 | .vg { color: #B8860B } /* Name.Variable.Global */
95 | .vi { color: #B8860B } /* Name.Variable.Instance */
96 | .il { color: #666666 } /* Literal.Number.Integer.Long */
97 |
98 | .. _pygments: http://pygments.org/
99 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/pygments-default.css.txt:
--------------------------------------------------------------------------------
1 | Stylesheet for reStructured Text code blocks
2 | ============================================
3 |
4 | :Author: Guenter Milde
5 | :Copyright: © 2007, 2011 G. Milde
6 | This stylesheet is released under the GPL v. 2 or later
7 |
8 | This stylesheet provides syntax highlight for documents using
9 | the `code` directive (new in Docutils 0.9).
10 |
11 | Import the default docutils style sheet
12 | ---------------------------------------
13 | ::
14 |
15 | @import url("/stylesheets/html4css1.css");
16 |
17 | Style code block
18 | ---------------------
19 |
20 | Content copied from the `html4css1.css` rule for literal blocks::
21 |
22 | pre.code {
23 | margin-left: 2em ;
24 | margin-right: 2em ;
25 | background-color: #eeeeee
26 | }
27 |
28 | pre.code .ln { /* line numbers */
29 | // color: grey;
30 | font-size: small;
31 | }
32 |
33 | Syntax highlight
34 | ----------------
35 |
36 | Pygments_ has an option to generate stylesheets for html and latex.
37 | The following code is generated with the command
38 | `pygmentize -S default -f html > pygments-default.css`::
39 |
40 | .c { color: #008800; font-style: italic } /* Comment */
41 | .err { border: 1px solid #FF0000 } /* Error */
42 | .k { color: #AA22FF; font-weight: bold } /* Keyword */
43 | .o { color: #666666 } /* Operator */
44 | .cm { color: #008800; font-style: italic } /* Comment.Multiline */
45 | .cp { color: #008800 } /* Comment.Preproc */
46 | .c1 { color: #008800; font-style: italic } /* Comment.Single */
47 | .gd { color: #A00000 } /* Generic.Deleted */
48 | .ge { font-style: italic } /* Generic.Emph */
49 | .gr { color: #FF0000 } /* Generic.Error */
50 | .gh { color: #000080; font-weight: bold } /* Generic.Heading */
51 | .gi { color: #00A000 } /* Generic.Inserted */
52 | .go { color: #808080 } /* Generic.Output */
53 | .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
54 | .gs { font-weight: bold } /* Generic.Strong */
55 | .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
56 | .gt { color: #0040D0 } /* Generic.Traceback */
57 | .kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */
58 | .kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */
59 | .kp { color: #AA22FF } /* Keyword.Pseudo */
60 | .kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */
61 | .kt { color: #AA22FF; font-weight: bold } /* Keyword.Type */
62 | .m { color: #666666 } /* Literal.Number */
63 | .s { color: #BB4444 } /* Literal.String */
64 | .na { color: #BB4444 } /* Name.Attribute */
65 | .nb { color: #AA22FF } /* Name.Builtin */
66 | .nc { color: #0000FF } /* Name.Class */
67 | .no { color: #880000 } /* Name.Constant */
68 | .nd { color: #AA22FF } /* Name.Decorator */
69 | .ni { color: #999999; font-weight: bold } /* Name.Entity */
70 | .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
71 | .nf { color: #00A000 } /* Name.Function */
72 | .nl { color: #A0A000 } /* Name.Label */
73 | .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
74 | .nt { color: #008000; font-weight: bold } /* Name.Tag */
75 | .nv { color: #B8860B } /* Name.Variable */
76 | .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
77 | .mf { color: #666666 } /* Literal.Number.Float */
78 | .mh { color: #666666 } /* Literal.Number.Hex */
79 | .mi { color: #666666 } /* Literal.Number.Integer */
80 | .mo { color: #666666 } /* Literal.Number.Oct */
81 | .sb { color: #BB4444 } /* Literal.String.Backtick */
82 | .sc { color: #BB4444 } /* Literal.String.Char */
83 | .sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */
84 | .s2 { color: #BB4444 } /* Literal.String.Double */
85 | .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
86 | .sh { color: #BB4444 } /* Literal.String.Heredoc */
87 | .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
88 | .sx { color: #008000 } /* Literal.String.Other */
89 | .sr { color: #BB6688 } /* Literal.String.Regex */
90 | .s1 { color: #BB4444 } /* Literal.String.Single */
91 | .ss { color: #B8860B } /* Literal.String.Symbol */
92 | .bp { color: #AA22FF } /* Name.Builtin.Pseudo */
93 | .vc { color: #B8860B } /* Name.Variable.Class */
94 | .vg { color: #B8860B } /* Name.Variable.Global */
95 | .vi { color: #B8860B } /* Name.Variable.Instance */
96 | .il { color: #666666 } /* Literal.Number.Integer.Long */
97 |
98 | .. _pygments: http://pygments.org/
99 |
--------------------------------------------------------------------------------
/_build/html/_static/pygments.css:
--------------------------------------------------------------------------------
1 | .highlight .hll { background-color: #ffffcc }
2 | .highlight { background: #f0f0f0; }
3 | .highlight .c { color: #60a0b0; font-style: italic } /* Comment */
4 | .highlight .err { border: 1px solid #FF0000 } /* Error */
5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */
6 | .highlight .o { color: #666666 } /* Operator */
7 | .highlight .ch { color: #60a0b0; font-style: italic } /* Comment.Hashbang */
8 | .highlight .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
9 | .highlight .cp { color: #007020 } /* Comment.Preproc */
10 | .highlight .cpf { color: #60a0b0; font-style: italic } /* Comment.PreprocFile */
11 | .highlight .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
12 | .highlight .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */
14 | .highlight .ge { font-style: italic } /* Generic.Emph */
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */
18 | .highlight .go { color: #888888 } /* Generic.Output */
19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */
23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */
27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
28 | .highlight .kt { color: #902000 } /* Keyword.Type */
29 | .highlight .m { color: #40a070 } /* Literal.Number */
30 | .highlight .s { color: #4070a0 } /* Literal.String */
31 | .highlight .na { color: #4070a0 } /* Name.Attribute */
32 | .highlight .nb { color: #007020 } /* Name.Builtin */
33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
34 | .highlight .no { color: #60add5 } /* Name.Constant */
35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
37 | .highlight .ne { color: #007020 } /* Name.Exception */
38 | .highlight .nf { color: #06287e } /* Name.Function */
39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */
43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */
45 | .highlight .mb { color: #40a070 } /* Literal.Number.Bin */
46 | .highlight .mf { color: #40a070 } /* Literal.Number.Float */
47 | .highlight .mh { color: #40a070 } /* Literal.Number.Hex */
48 | .highlight .mi { color: #40a070 } /* Literal.Number.Integer */
49 | .highlight .mo { color: #40a070 } /* Literal.Number.Oct */
50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */
51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */
53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */
56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */
60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */
61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */
62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */
63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */
65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
69 | .highlight .il { color: #40a070 } /* Literal.Number.Integer.Long */
--------------------------------------------------------------------------------
/_build/html/tutorial/hello_with_doctest_2.py.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | <no title> — PyLit
12 |
13 |
14 |
15 |
16 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
The classical programming example in Python will print a familiar greeting:
50 |
>>> with open("rstdocs/tutorial/hello_with_doctest_2.py") as source:
51 | ... exec( compile( source.read(), source.name, 'exec' ) )
52 | Hello world.
53 |
54 |
55 |
print( "Hello world." )
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
87 |
88 |
89 |
100 |
101 | Thanks to
102 |
103 |
105 |
106 | for hosting this site.
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/contribs/test_filters.py:
--------------------------------------------------------------------------------
1 | # Tests
2 | # =====
3 | #
4 |
5 | from filters import *
6 |
7 |
8 | # comment string for Elisp
9 | COMMENT_STRING = ';; '
10 |
11 | # simulate calling from pylit main
12 | keyw = { 'comment_string':COMMENT_STRING }
13 |
14 |
15 | # Auxiliary functions
16 | # ===================
17 | #
18 |
19 | def test(actual_iter, expected_iter):
20 | """Compare all lines in `actual_iter` with lines in `expected_iter`"""
21 | actual = []
22 | for line in actual_iter:
23 | actual.append(line)
24 | expected = []
25 | for line in expected_iter:
26 | expected.append(line)
27 | if len(actual) == len(expected):
28 | result = True
29 | else:
30 | result = False
31 | for i in range(0, min(len(actual),len(expected))):
32 | if actual[i] != expected[i]:
33 | result = False
34 | if result:
35 | return "OK"
36 | else:
37 | return "Failed (expected: %s, got: %s)" \
38 | % (expected, actual)
39 |
40 |
41 | # Test fixtures
42 | # =============
43 | #
44 |
45 | sc_in = IdentityFilter([
46 | ";; This should be stripped.\n",
47 | "This should be not.\n"
48 | ])
49 | sc_out = IdentityFilter([
50 | "This should be stripped.\n",
51 | "This should be not.\n"
52 | ])
53 |
54 | blank_lines = IdentityFilter([
55 | "\n",
56 | "\n",
57 | "\n"
58 | ])
59 |
60 | c2t_in_1 = IdentityFilter([
61 | ";;;Commentary:\n"
62 | ])
63 | c2t_out_1 = IdentityFilter([
64 | ";; .. |elisp> ;;;Commentary:\n",
65 | ])
66 | c2t_in_2 = IdentityFilter([
67 | ";;;Commentary:\n",
68 | ";; This is\n",
69 | ";; a test."
70 | ])
71 | c2t_out_2 = IdentityFilter([
72 | ";; .. |elisp> ;;;Commentary:\n",
73 | ";; This is\n",
74 | ";; a test."
75 | ])
76 |
77 |
78 | # Test cases
79 | # ==========
80 | #
81 |
82 | # test ElispCode2TextFilter with one sample line
83 | f = ElispCode2TextFilter(c2t_in_1, **keyw)
84 | print "ElispCode2TextFilter with sample line: %s" \
85 | % test(f, c2t_out_1)
86 |
87 | # test ElispText2CodeFilter with one sample line
88 | f = ElispText2CodeFilter(c2t_out_1, **keyw)
89 | print "ElispText2CodeFilter with sample line: %s" \
90 | % test(f, c2t_in_1)
91 |
92 | # test ElispCode2TextFilter with one sample para
93 | f = ElispCode2TextFilter(c2t_in_2, **keyw)
94 | print "ElispCode2TextFilter with sample paragraph: %s" \
95 | % test(f, c2t_out_2)
96 |
97 | # test ElispText2CodeFilter with one sample para
98 | f = ElispText2CodeFilter(c2t_out_2, **keyw)
99 | print "ElispText2CodeFilter with sample paragraph: %s" \
100 | % test(f, c2t_in_2)
101 |
102 | # round-trip test code->txt->code with sample line
103 | f = ElispText2CodeFilter(ElispCode2TextFilter(c2t_in_1, **keyw), **keyw)
104 | print "round-trip test code->txt->code with sample line: %s" \
105 | % test(f, c2t_in_1)
106 |
107 | # round-trip test code->txt->code with sample line
108 | f = ElispCode2TextFilter(ElispText2CodeFilter(c2t_out_1, **keyw), **keyw)
109 | print "round-trip test txt->code->txt with sample line: %s" \
110 | % test(f, c2t_out_1)
111 |
112 | # DISABLED 2007-02-21 -- these need the reverse of strip_comments(),
113 | # that is a function that prefix comment_string to non-code lines.
114 | # But that would be duplicating PyLit's code here, so just forget it.
115 | #
116 | # round-trip test code->txt->code with sample para
117 | #f = ElispText2CodeFilter(IdentityFilter(ElispCode2TextFilter(c2t_in_2,
118 | # **keyw)), **keyw)
119 | #print "round-trip test code->txt->code with sample paragraph: %s" \
120 | # % test(f, c2t_in_2)
121 | #
122 | # round-trip test code->txt->code with sample para
123 | #f = strip_comments(ElispCode2TextFilter(
124 | # strip_indent(ElispText2CodeFilter(c2t_out_2, **keyw)), **keyw))
125 | #print "round-trip test txt->code->txt with sample paragraph: %s" \
126 | # % test(f, c2t_out_2)
127 |
128 | # txt->code should preserve blank lines
129 | f = ElispText2CodeFilter(blank_lines, **keyw)
130 | print "txt->code with blank lines: %s" \
131 | % test(f, blank_lines)
132 |
133 | # code->txt should preserve blank lines
134 | f = ElispCode2TextFilter(blank_lines, **keyw)
135 | print "code->txt with blank lines: %s" \
136 | % test(f, blank_lines)
137 |
138 | # round-trip test txt->code->txt
139 | f = ElispText2CodeFilter(ElispCode2TextFilter(blank_lines, **keyw), **keyw)
140 | print "round-trip test txt->code->txt with blank lines: %s" \
141 | % test(f, blank_lines)
142 |
143 | # round-trip test code->txt->code
144 | f = ElispCode2TextFilter(ElispText2CodeFilter(blank_lines, **keyw), **keyw)
145 | print "round-trip test txt->code->txt with blank lines: %s" \
146 | % test(f, blank_lines)
147 |
--------------------------------------------------------------------------------
/docs/examples/testmod_literate.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | :Date: $Date: 2009-03-05 11:16:49 -0500 (Thu, 05 Mar 2009) $
5 | :Version: SVN-Revision $Revision: 104 $
6 | :URL: $URL: $
7 | :Copyright: 2006 Guenter Milde.
8 | Released without any warranty under the terms of the
9 | GNU General Public License (v. 2 or later)
10 |
11 | testmod_literate
12 | ================
13 |
14 | The module docstring should give a concise description of the working,
15 | details are in the literate source so the docstrings are not bloated::
16 |
17 | """
18 | This is the "testmod_literate" module.
19 |
20 | It supplies one function, `factorial()`. For example,
21 |
22 | >>> factorial(5)
23 | 120
24 |
25 | """
26 |
27 | __docformat__ = 'restructuredtext'
28 |
29 |
30 | **Beware:** as the docstring is not parsed as separate unit but as part of
31 | the file, there must be a blank line also after the last doctest block.
32 | Otherwise `doctest` expects ``"""`` to be part of the output.
33 |
34 |
35 | factorial
36 | ---------
37 | The functions docstring can be kept concise and additional discussion
38 | referred to the text part of the literate source::
39 |
40 | def factorial(n):
41 | """Return the factorial of `n`, an exact integer >= 0.
42 |
43 | >>> [factorial(n) for n in range(6)]
44 | [1, 1, 2, 6, 24, 120]
45 | >>> factorial(30)
46 | 265252859812191058636308480000000
47 |
48 | Factorials of floats are OK, but the float must be an exact integer:
49 |
50 | >>> factorial(30.0)
51 | 265252859812191058636308480000000
52 |
53 | """
54 |
55 | import math
56 | if not n >= 0:
57 | raise ValueError("n must be >= 0")
58 | if math.floor(n) != n:
59 | raise ValueError("n must be exact integer")
60 | if n+1 == n: # catch a value like 1e300
61 | raise OverflowError("n too large")
62 | result = 1
63 | factor = 2
64 | while factor <= n:
65 | result *= factor
66 | factor += 1
67 | return result
68 |
69 |
70 | Discussion and test
71 | ~~~~~~~~~~~~~~~~~~~
72 |
73 | `factorial()` accepts input as int, long or float:
74 |
75 | >>> factorial(30)
76 | 265252859812191058636308480000000
77 | >>> factorial(30.0)
78 | 265252859812191058636308480000000
79 |
80 | However, the float must be an exact integer and it must also not be
81 | ridiculously large:
82 |
83 | >>> factorial(30.1)
84 | Traceback (most recent call last):
85 | ...
86 | ValueError: n must be exact integer
87 |
88 | >>> factorial(1e100)
89 | Traceback (most recent call last):
90 | ...
91 | OverflowError: n too large
92 |
93 | The factorial of negative values is not defined:
94 |
95 | >>> factorial(-1)
96 | Traceback (most recent call last):
97 | ...
98 | ValueError: n must be >= 0
99 |
100 | The type of the return value depends on the size of the result.
101 |
102 | If the result is small enough to fit in an int, return an int.
103 | Else return a long:
104 |
105 | >>> [factorial(n) for n in range(6)]
106 | [1, 1, 2, 6, 24, 120]
107 | >>> factorial(30)
108 | 265252859812191058636308480000000
109 |
110 |
111 | Self Test
112 | ---------
113 |
114 | The traditional test function parses the docstrings of all objects in this
115 | module. It misses doctests in comments::
116 |
117 | def _test():
118 | import doctest
119 | doctest.testmod()
120 |
121 | Test all doctest blocks (both in docstrings and in text parts (well
122 | formatted comments) if the module is called as `__main__` (i.e. from the
123 | command line)::
124 |
125 | def _test_all_doctests():
126 | import pylit, sys
127 | pylit.run_doctest(infile=sys.argv[0], txt2code=False,
128 | globs=sys.modules.get('__main__').__dict__)
129 |
130 | (Future versions of `pylit` might contain a convenience function for a simpler
131 | invocation of this test.)
132 |
133 | Doctests can still be disabled or commented - make sure they are not
134 | recognised as text block (no double colon here):
135 |
136 | # a silly doctest
137 | # >>> False
138 | # True
139 |
140 | or (with non-canonical comments)::
141 |
142 | # a silly doctest
143 | #>>> False
144 | #True
145 |
146 | Doctests in doc-strings can be skipped with the `strip` option::
147 |
148 | def _test_text_doctests():
149 | import pylit, sys
150 | pylit.run_doctest(infile=sys.argv[0], txt2code=False, strip=True,
151 | globs=sys.modules.get('__main__').__dict__)
152 |
153 |
154 |
155 | Do a self test::
156 |
157 | if __name__ == "__main__":
158 | #_test()
159 | _test_all_doctests()
160 |
161 |
--------------------------------------------------------------------------------
/_build/html/examples/testmod_literate.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | :Date: $Date: 2009-03-05 11:16:49 -0500 (Thu, 05 Mar 2009) $
5 | :Version: SVN-Revision $Revision: 104 $
6 | :URL: $URL: $
7 | :Copyright: 2006 Guenter Milde.
8 | Released without any warranty under the terms of the
9 | GNU General Public License (v. 2 or later)
10 |
11 | testmod_literate
12 | ================
13 |
14 | The module docstring should give a concise description of the working,
15 | details are in the literate source so the docstrings are not bloated::
16 |
17 | """
18 | This is the "testmod_literate" module.
19 |
20 | It supplies one function, `factorial()`. For example,
21 |
22 | >>> factorial(5)
23 | 120
24 |
25 | """
26 |
27 | __docformat__ = 'restructuredtext'
28 |
29 |
30 | **Beware:** as the docstring is not parsed as separate unit but as part of
31 | the file, there must be a blank line also after the last doctest block.
32 | Otherwise `doctest` expects ``"""`` to be part of the output.
33 |
34 |
35 | factorial
36 | ---------
37 | The functions docstring can be kept concise and additional discussion
38 | referred to the text part of the literate source::
39 |
40 | def factorial(n):
41 | """Return the factorial of `n`, an exact integer >= 0.
42 |
43 | >>> [factorial(n) for n in range(6)]
44 | [1, 1, 2, 6, 24, 120]
45 | >>> factorial(30)
46 | 265252859812191058636308480000000
47 |
48 | Factorials of floats are OK, but the float must be an exact integer:
49 |
50 | >>> factorial(30.0)
51 | 265252859812191058636308480000000
52 |
53 | """
54 |
55 | import math
56 | if not n >= 0:
57 | raise ValueError("n must be >= 0")
58 | if math.floor(n) != n:
59 | raise ValueError("n must be exact integer")
60 | if n+1 == n: # catch a value like 1e300
61 | raise OverflowError("n too large")
62 | result = 1
63 | factor = 2
64 | while factor <= n:
65 | result *= factor
66 | factor += 1
67 | return result
68 |
69 |
70 | Discussion and test
71 | ~~~~~~~~~~~~~~~~~~~
72 |
73 | `factorial()` accepts input as int, long or float:
74 |
75 | >>> factorial(30)
76 | 265252859812191058636308480000000
77 | >>> factorial(30.0)
78 | 265252859812191058636308480000000
79 |
80 | However, the float must be an exact integer and it must also not be
81 | ridiculously large:
82 |
83 | >>> factorial(30.1)
84 | Traceback (most recent call last):
85 | ...
86 | ValueError: n must be exact integer
87 |
88 | >>> factorial(1e100)
89 | Traceback (most recent call last):
90 | ...
91 | OverflowError: n too large
92 |
93 | The factorial of negative values is not defined:
94 |
95 | >>> factorial(-1)
96 | Traceback (most recent call last):
97 | ...
98 | ValueError: n must be >= 0
99 |
100 | The type of the return value depends on the size of the result.
101 |
102 | If the result is small enough to fit in an int, return an int.
103 | Else return a long:
104 |
105 | >>> [factorial(n) for n in range(6)]
106 | [1, 1, 2, 6, 24, 120]
107 | >>> factorial(30)
108 | 265252859812191058636308480000000
109 |
110 |
111 | Self Test
112 | ---------
113 |
114 | The traditional test function parses the docstrings of all objects in this
115 | module. It misses doctests in comments::
116 |
117 | def _test():
118 | import doctest
119 | doctest.testmod()
120 |
121 | Test all doctest blocks (both in docstrings and in text parts (well
122 | formatted comments) if the module is called as `__main__` (i.e. from the
123 | command line)::
124 |
125 | def _test_all_doctests():
126 | import pylit, sys
127 | pylit.run_doctest(infile=sys.argv[0], txt2code=False,
128 | globs=sys.modules.get('__main__').__dict__)
129 |
130 | (Future versions of `pylit` might contain a convenience function for a simpler
131 | invocation of this test.)
132 |
133 | Doctests can still be disabled or commented - make sure they are not
134 | recognised as text block (no double colon here):
135 |
136 | # a silly doctest
137 | # >>> False
138 | # True
139 |
140 | or (with non-canonical comments)::
141 |
142 | # a silly doctest
143 | #>>> False
144 | #True
145 |
146 | Doctests in doc-strings can be skipped with the `strip` option::
147 |
148 | def _test_text_doctests():
149 | import pylit, sys
150 | pylit.run_doctest(infile=sys.argv[0], txt2code=False, strip=True,
151 | globs=sys.modules.get('__main__').__dict__)
152 |
153 |
154 |
155 | Do a self test::
156 |
157 | if __name__ == "__main__":
158 | #_test()
159 | _test_all_doctests()
160 |
161 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/testmod_literate.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | :Date: $Date: 2009-03-05 11:16:49 -0500 (Thu, 05 Mar 2009) $
5 | :Version: SVN-Revision $Revision: 104 $
6 | :URL: $URL: $
7 | :Copyright: 2006 Guenter Milde.
8 | Released without any warranty under the terms of the
9 | GNU General Public License (v. 2 or later)
10 |
11 | testmod_literate
12 | ================
13 |
14 | The module docstring should give a concise description of the working,
15 | details are in the literate source so the docstrings are not bloated::
16 |
17 | """
18 | This is the "testmod_literate" module.
19 |
20 | It supplies one function, `factorial()`. For example,
21 |
22 | >>> factorial(5)
23 | 120
24 |
25 | """
26 |
27 | __docformat__ = 'restructuredtext'
28 |
29 |
30 | **Beware:** as the docstring is not parsed as separate unit but as part of
31 | the file, there must be a blank line also after the last doctest block.
32 | Otherwise `doctest` expects ``"""`` to be part of the output.
33 |
34 |
35 | factorial
36 | ---------
37 | The functions docstring can be kept concise and additional discussion
38 | referred to the text part of the literate source::
39 |
40 | def factorial(n):
41 | """Return the factorial of `n`, an exact integer >= 0.
42 |
43 | >>> [factorial(n) for n in range(6)]
44 | [1, 1, 2, 6, 24, 120]
45 | >>> factorial(30)
46 | 265252859812191058636308480000000
47 |
48 | Factorials of floats are OK, but the float must be an exact integer:
49 |
50 | >>> factorial(30.0)
51 | 265252859812191058636308480000000
52 |
53 | """
54 |
55 | import math
56 | if not n >= 0:
57 | raise ValueError("n must be >= 0")
58 | if math.floor(n) != n:
59 | raise ValueError("n must be exact integer")
60 | if n+1 == n: # catch a value like 1e300
61 | raise OverflowError("n too large")
62 | result = 1
63 | factor = 2
64 | while factor <= n:
65 | result *= factor
66 | factor += 1
67 | return result
68 |
69 |
70 | Discussion and test
71 | ~~~~~~~~~~~~~~~~~~~
72 |
73 | `factorial()` accepts input as int, long or float:
74 |
75 | >>> factorial(30)
76 | 265252859812191058636308480000000
77 | >>> factorial(30.0)
78 | 265252859812191058636308480000000
79 |
80 | However, the float must be an exact integer and it must also not be
81 | ridiculously large:
82 |
83 | >>> factorial(30.1)
84 | Traceback (most recent call last):
85 | ...
86 | ValueError: n must be exact integer
87 |
88 | >>> factorial(1e100)
89 | Traceback (most recent call last):
90 | ...
91 | OverflowError: n too large
92 |
93 | The factorial of negative values is not defined:
94 |
95 | >>> factorial(-1)
96 | Traceback (most recent call last):
97 | ...
98 | ValueError: n must be >= 0
99 |
100 | The type of the return value depends on the size of the result.
101 |
102 | If the result is small enough to fit in an int, return an int.
103 | Else return a long:
104 |
105 | >>> [factorial(n) for n in range(6)]
106 | [1, 1, 2, 6, 24, 120]
107 | >>> factorial(30)
108 | 265252859812191058636308480000000
109 |
110 |
111 | Self Test
112 | ---------
113 |
114 | The traditional test function parses the docstrings of all objects in this
115 | module. It misses doctests in comments::
116 |
117 | def _test():
118 | import doctest
119 | doctest.testmod()
120 |
121 | Test all doctest blocks (both in docstrings and in text parts (well
122 | formatted comments) if the module is called as `__main__` (i.e. from the
123 | command line)::
124 |
125 | def _test_all_doctests():
126 | import pylit, sys
127 | pylit.run_doctest(infile=sys.argv[0], txt2code=False,
128 | globs=sys.modules.get('__main__').__dict__)
129 |
130 | (Future versions of `pylit` might contain a convenience function for a simpler
131 | invocation of this test.)
132 |
133 | Doctests can still be disabled or commented - make sure they are not
134 | recognised as text block (no double colon here):
135 |
136 | # a silly doctest
137 | # >>> False
138 | # True
139 |
140 | or (with non-canonical comments)::
141 |
142 | # a silly doctest
143 | #>>> False
144 | #True
145 |
146 | Doctests in doc-strings can be skipped with the `strip` option::
147 |
148 | def _test_text_doctests():
149 | import pylit, sys
150 | pylit.run_doctest(infile=sys.argv[0], txt2code=False, strip=True,
151 | globs=sys.modules.get('__main__').__dict__)
152 |
153 |
154 |
155 | Do a self test::
156 |
157 | if __name__ == "__main__":
158 | #_test()
159 | _test_all_doctests()
160 |
161 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/testmod_literate.py.txt:
--------------------------------------------------------------------------------
1 | .. #!/usr/bin/env python
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | :Date: $Date: 2009-03-05 11:16:49 -0500 (Thu, 05 Mar 2009) $
5 | :Version: SVN-Revision $Revision: 104 $
6 | :URL: $URL: $
7 | :Copyright: 2006 Guenter Milde.
8 | Released without any warranty under the terms of the
9 | GNU General Public License (v. 2 or later)
10 |
11 | testmod_literate
12 | ================
13 |
14 | The module docstring should give a concise description of the working,
15 | details are in the literate source so the docstrings are not bloated::
16 |
17 | """
18 | This is the "testmod_literate" module.
19 |
20 | It supplies one function, `factorial()`. For example,
21 |
22 | >>> factorial(5)
23 | 120
24 |
25 | """
26 |
27 | __docformat__ = 'restructuredtext'
28 |
29 |
30 | **Beware:** as the docstring is not parsed as separate unit but as part of
31 | the file, there must be a blank line also after the last doctest block.
32 | Otherwise `doctest` expects ``"""`` to be part of the output.
33 |
34 |
35 | factorial
36 | ---------
37 | The functions docstring can be kept concise and additional discussion
38 | referred to the text part of the literate source::
39 |
40 | def factorial(n):
41 | """Return the factorial of `n`, an exact integer >= 0.
42 |
43 | >>> [factorial(n) for n in range(6)]
44 | [1, 1, 2, 6, 24, 120]
45 | >>> factorial(30)
46 | 265252859812191058636308480000000
47 |
48 | Factorials of floats are OK, but the float must be an exact integer:
49 |
50 | >>> factorial(30.0)
51 | 265252859812191058636308480000000
52 |
53 | """
54 |
55 | import math
56 | if not n >= 0:
57 | raise ValueError("n must be >= 0")
58 | if math.floor(n) != n:
59 | raise ValueError("n must be exact integer")
60 | if n+1 == n: # catch a value like 1e300
61 | raise OverflowError("n too large")
62 | result = 1
63 | factor = 2
64 | while factor <= n:
65 | result *= factor
66 | factor += 1
67 | return result
68 |
69 |
70 | Discussion and test
71 | ~~~~~~~~~~~~~~~~~~~
72 |
73 | `factorial()` accepts input as int, long or float:
74 |
75 | >>> factorial(30)
76 | 265252859812191058636308480000000
77 | >>> factorial(30.0)
78 | 265252859812191058636308480000000
79 |
80 | However, the float must be an exact integer and it must also not be
81 | ridiculously large:
82 |
83 | >>> factorial(30.1)
84 | Traceback (most recent call last):
85 | ...
86 | ValueError: n must be exact integer
87 |
88 | >>> factorial(1e100)
89 | Traceback (most recent call last):
90 | ...
91 | OverflowError: n too large
92 |
93 | The factorial of negative values is not defined:
94 |
95 | >>> factorial(-1)
96 | Traceback (most recent call last):
97 | ...
98 | ValueError: n must be >= 0
99 |
100 | The type of the return value depends on the size of the result.
101 |
102 | If the result is small enough to fit in an int, return an int.
103 | Else return a long:
104 |
105 | >>> [factorial(n) for n in range(6)]
106 | [1, 1, 2, 6, 24, 120]
107 | >>> factorial(30)
108 | 265252859812191058636308480000000
109 |
110 |
111 | Self Test
112 | ---------
113 |
114 | The traditional test function parses the docstrings of all objects in this
115 | module. It misses doctests in comments::
116 |
117 | def _test():
118 | import doctest
119 | doctest.testmod()
120 |
121 | Test all doctest blocks (both in docstrings and in text parts (well
122 | formatted comments) if the module is called as `__main__` (i.e. from the
123 | command line)::
124 |
125 | def _test_all_doctests():
126 | import pylit, sys
127 | pylit.run_doctest(infile=sys.argv[0], txt2code=False,
128 | globs=sys.modules.get('__main__').__dict__)
129 |
130 | (Future versions of `pylit` might contain a convenience function for a simpler
131 | invocation of this test.)
132 |
133 | Doctests can still be disabled or commented - make sure they are not
134 | recognised as text block (no double colon here):
135 |
136 | # a silly doctest
137 | # >>> False
138 | # True
139 |
140 | or (with non-canonical comments)::
141 |
142 | # a silly doctest
143 | #>>> False
144 | #True
145 |
146 | Doctests in doc-strings can be skipped with the `strip` option::
147 |
148 | def _test_text_doctests():
149 | import pylit, sys
150 | pylit.run_doctest(infile=sys.argv[0], txt2code=False, strip=True,
151 | globs=sys.modules.get('__main__').__dict__)
152 |
153 |
154 |
155 | Do a self test::
156 |
157 | if __name__ == "__main__":
158 | #_test()
159 | _test_all_doctests()
160 |
161 |
--------------------------------------------------------------------------------
/docs/examples/testmod_literate.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: iso-8859-1 -*-
3 |
4 | # :Date: $Date: 2009-03-05 11:16:49 -0500 (Thu, 05 Mar 2009) $
5 | # :Version: SVN-Revision $Revision: 104 $
6 | # :URL: $URL: $
7 | # :Copyright: 2006 Guenter Milde.
8 | # Released without any warranty under the terms of the
9 | # GNU General Public License (v. 2 or later)
10 | #
11 | # testmod_literate
12 | # ================
13 | #
14 | # The module docstring should give a concise description of the working,
15 | # details are in the literate source so the docstrings are not bloated::
16 |
17 | """
18 | This is the "testmod_literate" module.
19 |
20 | It supplies one function, `factorial()`. For example,
21 |
22 | >>> factorial(5)
23 | 120
24 |
25 | """
26 |
27 | __docformat__ = 'restructuredtext'
28 |
29 |
30 | # **Beware:** as the docstring is not parsed as separate unit but as part of
31 | # the file, there must be a blank line also after the last doctest block.
32 | # Otherwise `doctest` expects ``"""`` to be part of the output.
33 | #
34 | #
35 | # factorial
36 | # ---------
37 | # The functions docstring can be kept concise and additional discussion
38 | # referred to the text part of the literate source::
39 |
40 | def factorial(n):
41 | """Return the factorial of `n`, an exact integer >= 0.
42 |
43 | >>> [factorial(n) for n in range(6)]
44 | [1, 1, 2, 6, 24, 120]
45 | >>> factorial(30)
46 | 265252859812191058636308480000000
47 |
48 | Factorials of floats are OK, but the float must be an exact integer:
49 |
50 | >>> factorial(30.0)
51 | 265252859812191058636308480000000
52 |
53 | """
54 |
55 | import math
56 | if not n >= 0:
57 | raise ValueError("n must be >= 0")
58 | if math.floor(n) != n:
59 | raise ValueError("n must be exact integer")
60 | if n+1 == n: # catch a value like 1e300
61 | raise OverflowError("n too large")
62 | result = 1
63 | factor = 2
64 | while factor <= n:
65 | result *= factor
66 | factor += 1
67 | return result
68 |
69 |
70 | # Discussion and test
71 | # ~~~~~~~~~~~~~~~~~~~
72 | #
73 | # `factorial()` accepts input as int, long or float:
74 | #
75 | # >>> factorial(30)
76 | # 265252859812191058636308480000000
77 | # >>> factorial(30.0)
78 | # 265252859812191058636308480000000
79 | #
80 | # However, the float must be an exact integer and it must also not be
81 | # ridiculously large:
82 | #
83 | # >>> factorial(30.1)
84 | # Traceback (most recent call last):
85 | # ...
86 | # ValueError: n must be exact integer
87 | #
88 | # >>> factorial(1e100)
89 | # Traceback (most recent call last):
90 | # ...
91 | # OverflowError: n too large
92 | #
93 | # The factorial of negative values is not defined:
94 | #
95 | # >>> factorial(-1)
96 | # Traceback (most recent call last):
97 | # ...
98 | # ValueError: n must be >= 0
99 | #
100 | # The type of the return value depends on the size of the result.
101 | #
102 | # If the result is small enough to fit in an int, return an int.
103 | # Else return a long:
104 | #
105 | # >>> [factorial(n) for n in range(6)]
106 | # [1, 1, 2, 6, 24, 120]
107 | # >>> factorial(30)
108 | # 265252859812191058636308480000000
109 | #
110 | #
111 | # Self Test
112 | # ---------
113 | #
114 | # The traditional test function parses the docstrings of all objects in this
115 | # module. It misses doctests in comments::
116 |
117 | def _test():
118 | import doctest
119 | doctest.testmod()
120 |
121 | # Test all doctest blocks (both in docstrings and in text parts (well
122 | # formatted comments) if the module is called as `__main__` (i.e. from the
123 | # command line)::
124 |
125 | def _test_all_doctests():
126 | import pylit, sys
127 | pylit.run_doctest(infile=sys.argv[0], txt2code=False,
128 | globs=sys.modules.get('__main__').__dict__)
129 |
130 | # (Future versions of `pylit` might contain a convenience function for a simpler
131 | # invocation of this test.)
132 | #
133 | # Doctests can still be disabled or commented - make sure they are not
134 | # recognised as text block (no double colon here):
135 | #
136 | # # a silly doctest
137 | # # >>> False
138 | # # True
139 | #
140 | # or (with non-canonical comments)::
141 |
142 | # a silly doctest
143 | #>>> False
144 | #True
145 |
146 | # Doctests in doc-strings can be skipped with the `strip` option::
147 |
148 | def _test_text_doctests():
149 | import pylit, sys
150 | pylit.run_doctest(infile=sys.argv[0], txt2code=False, strip=True,
151 | globs=sys.modules.get('__main__').__dict__)
152 |
153 |
154 |
155 | # Do a self test::
156 |
157 | if __name__ == "__main__":
158 | #_test()
159 | _test_all_doctests()
160 |
161 |
--------------------------------------------------------------------------------
/docs/examples/listings-tex-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-tex-options.sty
2 | ************************
3 | highlight LaTeX code with lstlistings
4 | =====================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | Usage
16 | -----
17 |
18 | For syntax highlight of literal blocks with the `listings` LaTeX package,
19 | call ``rst2latex.py`` with the options
20 | ``--stylesheet=listings-tex-options.sty --literal-block-env=lstlisting``.
21 |
22 | Adapt the settings to your needs by either
23 |
24 | * modifying a copy of this file under a different name, or
25 | * copy parts of this file into your custom style sheet.
26 |
27 | See listings.pdf_ for configuration and usage of the listings package.
28 |
29 | Implementation
30 | --------------
31 |
32 | .. highlight:: latex
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{listings-tex-options}
37 | [2009/03/02 v0.1 highlight LaTeX with lstlistings]
38 |
39 | Of course, we need to load the listings package itself::
40 |
41 | \RequirePackage{listings}
42 |
43 | In a document with lots of lists and listings, separating paragraphs by
44 | vertical seems appropriate::
45 |
46 | \RequirePackage{parskip}
47 |
48 | load hyperref with blue citation colour::
49 |
50 | \RequirePackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=blue]
51 | {hyperref}
52 |
53 | In the References/Bibliography section,
54 | avoid holes in the title due to block alignment::
55 |
56 | \renewcommand{\titlereference}[1]{\raggedright\textsl{#1}}
57 |
58 | Omit the auto-inserted "References" heading, to be compatible with HTML
59 | output also if use latex references is set::
60 |
61 | \AtBeginDocument{\renewcommand{\refname}{\vspace{-2em}}}
62 |
63 | Font settings
64 | ~~~~~~~~~~~~~
65 |
66 | Times, Helvetica, Courier::
67 |
68 | %\RequirePackage{mathptmx}
69 | %\RequirePackage[scaled=.90]{helvet} % scaled to fit Times
70 | %\RequirePackage{courier}
71 |
72 | Palatino, Helvetica, Courier::
73 |
74 | \RequirePackage[sc]{mathpazo} % with small caps
75 | % \RequirePackage[sc,osf]{mathpazo} % with small caps and old style figures
76 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
77 | \RequirePackage{courier}
78 |
79 | (The TX typewriter font comes with bold, slanted, and small-caps variants
80 | and without the problems of `txfonts`' math fonts). However, `txfonts` is
81 | a contributed package, not necessarily available::
82 |
83 | %\renewcommand{\ttdefault}{txtt}
84 |
85 |
86 | Default language
87 | ~~~~~~~~~~~~~~~~
88 |
89 | Highlight literal blocks as TeX::
90 |
91 | \lstset{language=[LaTeX]TeX}
92 |
93 | pre-load the language::
94 |
95 | \lstloadlanguages{[LaTeX]TeX} % comma separated list of languages
96 |
97 | Style
98 | ~~~~~
99 |
100 | Typeface settings::
101 |
102 | \lstset{
103 | basicstyle=\ttfamily, % print whole listing in tt
104 | % basicstyle=\ttfamily\small,
105 | keywordstyle={}, % do not highlight keywords
106 | % identifierstyle=\slshape, % macros that are not keywords, args
107 | commentstyle=\rmfamily\itshape, % italic comments
108 | % stringstyle=\ttfamily, % typewriter type for strings
109 | % texcsstyle=\slshape,
110 | }
111 |
112 | Visible whitespace::
113 |
114 | \lstset{showstringspaces=false} % no visible spaces in strings
115 | %\lstset{showspaces=true,
116 | % showtabs=true,
117 | % tab=\rightarrowfill}
118 |
119 | Line numbers::
120 |
121 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
122 |
123 | Frames around listings::
124 |
125 | %\lstset{frame=single}
126 |
127 |
128 | Extended characters in listings::
129 |
130 | %extendedchars=true
131 | %extendedchars=false
132 |
133 | Column alignment
134 | ~~~~~~~~~~~~~~~~
135 |
136 | (for typesetting with variable width fonts)
137 |
138 | ``columns=[c|l|r] ``
139 | in [fixed, flexible, spaceflexible, or fullflexible]
140 |
141 | The optional c, l, or r controls the horizontal orientation of smallest
142 | output units (keywords, identifiers, etc.).
143 |
144 | default: [c]fixed
145 |
146 | ``basewidth={fixed, flexible}``
147 | ..
148 |
149 | sets the width of a single character box for fixed and flexible column
150 | mode (both to the same value or individually).
151 |
152 | default: {0.6em,0.45em}
153 |
154 | Free spacing for comments::
155 |
156 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
157 |
158 | .. _listings.pdf:
159 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
160 |
--------------------------------------------------------------------------------
/_build/html/examples/listings-tex-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-tex-options.sty
2 | ************************
3 | highlight LaTeX code with lstlistings
4 | =====================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | Usage
16 | -----
17 |
18 | For syntax highlight of literal blocks with the `listings` LaTeX package,
19 | call ``rst2latex.py`` with the options
20 | ``--stylesheet=listings-tex-options.sty --literal-block-env=lstlisting``.
21 |
22 | Adapt the settings to your needs by either
23 |
24 | * modifying a copy of this file under a different name, or
25 | * copy parts of this file into your custom style sheet.
26 |
27 | See listings.pdf_ for configuration and usage of the listings package.
28 |
29 | Implementation
30 | --------------
31 |
32 | .. highlight:: latex
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{listings-tex-options}
37 | [2009/03/02 v0.1 highlight LaTeX with lstlistings]
38 |
39 | Of course, we need to load the listings package itself::
40 |
41 | \RequirePackage{listings}
42 |
43 | In a document with lots of lists and listings, separating paragraphs by
44 | vertical seems appropriate::
45 |
46 | \RequirePackage{parskip}
47 |
48 | load hyperref with blue citation colour::
49 |
50 | \RequirePackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=blue]
51 | {hyperref}
52 |
53 | In the References/Bibliography section,
54 | avoid holes in the title due to block alignment::
55 |
56 | \renewcommand{\titlereference}[1]{\raggedright\textsl{#1}}
57 |
58 | Omit the auto-inserted "References" heading, to be compatible with HTML
59 | output also if use latex references is set::
60 |
61 | \AtBeginDocument{\renewcommand{\refname}{\vspace{-2em}}}
62 |
63 | Font settings
64 | ~~~~~~~~~~~~~
65 |
66 | Times, Helvetica, Courier::
67 |
68 | %\RequirePackage{mathptmx}
69 | %\RequirePackage[scaled=.90]{helvet} % scaled to fit Times
70 | %\RequirePackage{courier}
71 |
72 | Palatino, Helvetica, Courier::
73 |
74 | \RequirePackage[sc]{mathpazo} % with small caps
75 | % \RequirePackage[sc,osf]{mathpazo} % with small caps and old style figures
76 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
77 | \RequirePackage{courier}
78 |
79 | (The TX typewriter font comes with bold, slanted, and small-caps variants
80 | and without the problems of `txfonts`' math fonts). However, `txfonts` is
81 | a contributed package, not necessarily available::
82 |
83 | %\renewcommand{\ttdefault}{txtt}
84 |
85 |
86 | Default language
87 | ~~~~~~~~~~~~~~~~
88 |
89 | Highlight literal blocks as TeX::
90 |
91 | \lstset{language=[LaTeX]TeX}
92 |
93 | pre-load the language::
94 |
95 | \lstloadlanguages{[LaTeX]TeX} % comma separated list of languages
96 |
97 | Style
98 | ~~~~~
99 |
100 | Typeface settings::
101 |
102 | \lstset{
103 | basicstyle=\ttfamily, % print whole listing in tt
104 | % basicstyle=\ttfamily\small,
105 | keywordstyle={}, % do not highlight keywords
106 | % identifierstyle=\slshape, % macros that are not keywords, args
107 | commentstyle=\rmfamily\itshape, % italic comments
108 | % stringstyle=\ttfamily, % typewriter type for strings
109 | % texcsstyle=\slshape,
110 | }
111 |
112 | Visible whitespace::
113 |
114 | \lstset{showstringspaces=false} % no visible spaces in strings
115 | %\lstset{showspaces=true,
116 | % showtabs=true,
117 | % tab=\rightarrowfill}
118 |
119 | Line numbers::
120 |
121 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
122 |
123 | Frames around listings::
124 |
125 | %\lstset{frame=single}
126 |
127 |
128 | Extended characters in listings::
129 |
130 | %extendedchars=true
131 | %extendedchars=false
132 |
133 | Column alignment
134 | ~~~~~~~~~~~~~~~~
135 |
136 | (for typesetting with variable width fonts)
137 |
138 | ``columns=[c|l|r] ``
139 | in [fixed, flexible, spaceflexible, or fullflexible]
140 |
141 | The optional c, l, or r controls the horizontal orientation of smallest
142 | output units (keywords, identifiers, etc.).
143 |
144 | default: [c]fixed
145 |
146 | ``basewidth={fixed, flexible}``
147 | ..
148 |
149 | sets the width of a single character box for fixed and flexible column
150 | mode (both to the same value or individually).
151 |
152 | default: {0.6em,0.45em}
153 |
154 | Free spacing for comments::
155 |
156 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
157 |
158 | .. _listings.pdf:
159 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
160 |
--------------------------------------------------------------------------------
/_build/html/_sources/examples/listings-tex-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-tex-options.sty
2 | ************************
3 | highlight LaTeX code with lstlistings
4 | =====================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | Usage
16 | -----
17 |
18 | For syntax highlight of literal blocks with the `listings` LaTeX package,
19 | call ``rst2latex.py`` with the options
20 | ``--stylesheet=listings-tex-options.sty --literal-block-env=lstlisting``.
21 |
22 | Adapt the settings to your needs by either
23 |
24 | * modifying a copy of this file under a different name, or
25 | * copy parts of this file into your custom style sheet.
26 |
27 | See listings.pdf_ for configuration and usage of the listings package.
28 |
29 | Implementation
30 | --------------
31 |
32 | .. highlight:: latex
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{listings-tex-options}
37 | [2009/03/02 v0.1 highlight LaTeX with lstlistings]
38 |
39 | Of course, we need to load the listings package itself::
40 |
41 | \RequirePackage{listings}
42 |
43 | In a document with lots of lists and listings, separating paragraphs by
44 | vertical seems appropriate::
45 |
46 | \RequirePackage{parskip}
47 |
48 | load hyperref with blue citation colour::
49 |
50 | \RequirePackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=blue]
51 | {hyperref}
52 |
53 | In the References/Bibliography section,
54 | avoid holes in the title due to block alignment::
55 |
56 | \renewcommand{\titlereference}[1]{\raggedright\textsl{#1}}
57 |
58 | Omit the auto-inserted "References" heading, to be compatible with HTML
59 | output also if use latex references is set::
60 |
61 | \AtBeginDocument{\renewcommand{\refname}{\vspace{-2em}}}
62 |
63 | Font settings
64 | ~~~~~~~~~~~~~
65 |
66 | Times, Helvetica, Courier::
67 |
68 | %\RequirePackage{mathptmx}
69 | %\RequirePackage[scaled=.90]{helvet} % scaled to fit Times
70 | %\RequirePackage{courier}
71 |
72 | Palatino, Helvetica, Courier::
73 |
74 | \RequirePackage[sc]{mathpazo} % with small caps
75 | % \RequirePackage[sc,osf]{mathpazo} % with small caps and old style figures
76 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
77 | \RequirePackage{courier}
78 |
79 | (The TX typewriter font comes with bold, slanted, and small-caps variants
80 | and without the problems of `txfonts`' math fonts). However, `txfonts` is
81 | a contributed package, not necessarily available::
82 |
83 | %\renewcommand{\ttdefault}{txtt}
84 |
85 |
86 | Default language
87 | ~~~~~~~~~~~~~~~~
88 |
89 | Highlight literal blocks as TeX::
90 |
91 | \lstset{language=[LaTeX]TeX}
92 |
93 | pre-load the language::
94 |
95 | \lstloadlanguages{[LaTeX]TeX} % comma separated list of languages
96 |
97 | Style
98 | ~~~~~
99 |
100 | Typeface settings::
101 |
102 | \lstset{
103 | basicstyle=\ttfamily, % print whole listing in tt
104 | % basicstyle=\ttfamily\small,
105 | keywordstyle={}, % do not highlight keywords
106 | % identifierstyle=\slshape, % macros that are not keywords, args
107 | commentstyle=\rmfamily\itshape, % italic comments
108 | % stringstyle=\ttfamily, % typewriter type for strings
109 | % texcsstyle=\slshape,
110 | }
111 |
112 | Visible whitespace::
113 |
114 | \lstset{showstringspaces=false} % no visible spaces in strings
115 | %\lstset{showspaces=true,
116 | % showtabs=true,
117 | % tab=\rightarrowfill}
118 |
119 | Line numbers::
120 |
121 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
122 |
123 | Frames around listings::
124 |
125 | %\lstset{frame=single}
126 |
127 |
128 | Extended characters in listings::
129 |
130 | %extendedchars=true
131 | %extendedchars=false
132 |
133 | Column alignment
134 | ~~~~~~~~~~~~~~~~
135 |
136 | (for typesetting with variable width fonts)
137 |
138 | ``columns=[c|l|r] ``
139 | in [fixed, flexible, spaceflexible, or fullflexible]
140 |
141 | The optional c, l, or r controls the horizontal orientation of smallest
142 | output units (keywords, identifiers, etc.).
143 |
144 | default: [c]fixed
145 |
146 | ``basewidth={fixed, flexible}``
147 | ..
148 |
149 | sets the width of a single character box for fixed and flexible column
150 | mode (both to the same value or individually).
151 |
152 | default: {0.6em,0.45em}
153 |
154 | Free spacing for comments::
155 |
156 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
157 |
158 | .. _listings.pdf:
159 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
160 |
--------------------------------------------------------------------------------
/_build/html/_sources/_build/html/examples/listings-tex-options.sty.txt:
--------------------------------------------------------------------------------
1 | listings-tex-options.sty
2 | ************************
3 | highlight LaTeX code with lstlistings
4 | =====================================
5 |
6 | :Author: Günter Milde
7 | :Contact: milde@users.berlios.de
8 | :Revision: $Revision: 5534 $
9 | :Date: $Date: 2005-06-28$
10 | :Copyright: © 2007, 2009 G. Milde,
11 | Released without warranties or conditions of any kind
12 | under the terms of the Apache License, Version 2.0
13 | http://www.apache.org/licenses/LICENSE-2.0
14 |
15 | Usage
16 | -----
17 |
18 | For syntax highlight of literal blocks with the `listings` LaTeX package,
19 | call ``rst2latex.py`` with the options
20 | ``--stylesheet=listings-tex-options.sty --literal-block-env=lstlisting``.
21 |
22 | Adapt the settings to your needs by either
23 |
24 | * modifying a copy of this file under a different name, or
25 | * copy parts of this file into your custom style sheet.
26 |
27 | See listings.pdf_ for configuration and usage of the listings package.
28 |
29 | Implementation
30 | --------------
31 |
32 | .. highlight:: latex
33 |
34 | Identification::
35 |
36 | \ProvidesPackage{listings-tex-options}
37 | [2009/03/02 v0.1 highlight LaTeX with lstlistings]
38 |
39 | Of course, we need to load the listings package itself::
40 |
41 | \RequirePackage{listings}
42 |
43 | In a document with lots of lists and listings, separating paragraphs by
44 | vertical seems appropriate::
45 |
46 | \RequirePackage{parskip}
47 |
48 | load hyperref with blue citation colour::
49 |
50 | \RequirePackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=blue]
51 | {hyperref}
52 |
53 | In the References/Bibliography section,
54 | avoid holes in the title due to block alignment::
55 |
56 | \renewcommand{\titlereference}[1]{\raggedright\textsl{#1}}
57 |
58 | Omit the auto-inserted "References" heading, to be compatible with HTML
59 | output also if use latex references is set::
60 |
61 | \AtBeginDocument{\renewcommand{\refname}{\vspace{-2em}}}
62 |
63 | Font settings
64 | ~~~~~~~~~~~~~
65 |
66 | Times, Helvetica, Courier::
67 |
68 | %\RequirePackage{mathptmx}
69 | %\RequirePackage[scaled=.90]{helvet} % scaled to fit Times
70 | %\RequirePackage{courier}
71 |
72 | Palatino, Helvetica, Courier::
73 |
74 | \RequirePackage[sc]{mathpazo} % with small caps
75 | % \RequirePackage[sc,osf]{mathpazo} % with small caps and old style figures
76 | \RequirePackage[scaled=.95]{helvet} % scaled to fit Palatino
77 | \RequirePackage{courier}
78 |
79 | (The TX typewriter font comes with bold, slanted, and small-caps variants
80 | and without the problems of `txfonts`' math fonts). However, `txfonts` is
81 | a contributed package, not necessarily available::
82 |
83 | %\renewcommand{\ttdefault}{txtt}
84 |
85 |
86 | Default language
87 | ~~~~~~~~~~~~~~~~
88 |
89 | Highlight literal blocks as TeX::
90 |
91 | \lstset{language=[LaTeX]TeX}
92 |
93 | pre-load the language::
94 |
95 | \lstloadlanguages{[LaTeX]TeX} % comma separated list of languages
96 |
97 | Style
98 | ~~~~~
99 |
100 | Typeface settings::
101 |
102 | \lstset{
103 | basicstyle=\ttfamily, % print whole listing in tt
104 | % basicstyle=\ttfamily\small,
105 | keywordstyle={}, % do not highlight keywords
106 | % identifierstyle=\slshape, % macros that are not keywords, args
107 | commentstyle=\rmfamily\itshape, % italic comments
108 | % stringstyle=\ttfamily, % typewriter type for strings
109 | % texcsstyle=\slshape,
110 | }
111 |
112 | Visible whitespace::
113 |
114 | \lstset{showstringspaces=false} % no visible spaces in strings
115 | %\lstset{showspaces=true,
116 | % showtabs=true,
117 | % tab=\rightarrowfill}
118 |
119 | Line numbers::
120 |
121 | %\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
122 |
123 | Frames around listings::
124 |
125 | %\lstset{frame=single}
126 |
127 |
128 | Extended characters in listings::
129 |
130 | %extendedchars=true
131 | %extendedchars=false
132 |
133 | Column alignment
134 | ~~~~~~~~~~~~~~~~
135 |
136 | (for typesetting with variable width fonts)
137 |
138 | ``columns=[c|l|r] ``
139 | in [fixed, flexible, spaceflexible, or fullflexible]
140 |
141 | The optional c, l, or r controls the horizontal orientation of smallest
142 | output units (keywords, identifiers, etc.).
143 |
144 | default: [c]fixed
145 |
146 | ``basewidth={fixed, flexible}``
147 | ..
148 |
149 | sets the width of a single character box for fixed and flexible column
150 | mode (both to the same value or individually).
151 |
152 | default: {0.6em,0.45em}
153 |
154 | Free spacing for comments::
155 |
156 | \lstset{columns=fullflexible, basewidth={0.5em,0.4em}}
157 |
158 | .. _listings.pdf:
159 | ftp://dante.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf
160 |
--------------------------------------------------------------------------------
/_build/html/_build/html/tutorial/greeting.py.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 | <no title> — PyLit
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
a friendly greeting stored in a variable
38 |
greeting = "Hello world."
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
108 |
109 |
110 |
111 | Thanks to
112 |
113 |
115 |
116 | for hosting this site.
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------