summaryrefslogtreecommitdiff
path: root/sandbox/code-block-directive/tools
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/code-block-directive/tools')
-rw-r--r--sandbox/code-block-directive/tools/makesty.py62
-rw-r--r--sandbox/code-block-directive/tools/pygments-docutilsroles.sty122
-rw-r--r--sandbox/code-block-directive/tools/pygments-enhanced-front-ends/README.txt69
-rw-r--r--sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py92
-rw-r--r--sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.htm185
-rw-r--r--sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.pdfbin77532 -> 0 bytes
-rw-r--r--sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.tex170
-rw-r--r--sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.txt92
-rwxr-xr-xsandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2html-pygments60
-rwxr-xr-xsandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2latex-pygments60
-rwxr-xr-xsandbox/code-block-directive/tools/test_pygments_code_block_directive.py64
11 files changed, 0 insertions, 976 deletions
diff --git a/sandbox/code-block-directive/tools/makesty.py b/sandbox/code-block-directive/tools/makesty.py
deleted file mode 100644
index 27e17bb09..000000000
--- a/sandbox/code-block-directive/tools/makesty.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#! /usr/bin/env python
-# coding: utf8
-# Copyright: Raphael 'kena' Poss <r.c.poss@uva.nl>
-# this file is placed in the public domain.
-#
-# Convert a CSS stylesheet into one for Docutils' LaTeX output.
-#
-# Usage example::
-#
-# pygmentize -S default -f html | python makesty.py >pygments-default.sty
-#
-# Versions:
-#
-# 2012-05-09: Günter Milde <milde@users.sf.net>:
-# Bugfix: do not fail at lines without comment.
-# Support for digits in role names.
-# ``\providecommand`` instead of ``\newcommand``.
-
-import sys
-import re
-
-print '% Stylesheet for syntax highlight with Docutils'
-print '% Generated by makesty.py from a Pygments CSS style'
-print '% (output of `pygmentize -S <style> -f html`).'
-print
-print r'\RequirePackage{color}'
-
-cnt = 0
-for l in sys.stdin:
-
- if '/*' in l:
- print "% " + l.split('*')[1]
- key = l.split(' ', 1)[0][1:]
-
- s = '#1'
-
- if 'color:' in l:
- col = l.split('#',1)[1][:6]
- r = float(int(col[0:2], 16)) / 255.
- g = float(int(col[2:4], 16)) / 255.
- b = float(int(col[4:6], 16)) / 255.
- s = r'\textcolor[rgb]{%.2f,%.2f,%.2f}{%s}' % (r, g, b, s)
-
- if 'font-style: italic' in l:
- s = r'\textit{%s}' % s
- if 'font-weight: bold' in l:
- s = r'\textbf{%s}' % s
-
- if 'border:' in l:
- col = l.split('#',1)[1][:6]
- r = float(int(col[0:2], 16)) / 255.
- g = float(int(col[2:4], 16)) / 255.
- b = float(int(col[4:6], 16)) / 255.
- cname = 'DUcolor%d' % cnt
- cnt += 1
- print r'\definecolor{%s}{rgb}{%.2f,%.2f,%.2f}' % (cname, r, g, b)
- s = r'\colorbox{%s}{%s}' % (cname, s)
-
- if re.match(r'.*[0-9]', key) is None:
- print r'\providecommand*\DUrole%s[1]{%s}' % (key, s)
- else:
- print r'\providecommand\csname DUrole%s\endcsname[1]{%s}' % (key, s)
diff --git a/sandbox/code-block-directive/tools/pygments-docutilsroles.sty b/sandbox/code-block-directive/tools/pygments-docutilsroles.sty
deleted file mode 100644
index a3caea642..000000000
--- a/sandbox/code-block-directive/tools/pygments-docutilsroles.sty
+++ /dev/null
@@ -1,122 +0,0 @@
-% Stylesheet generated by makesty.py
-\usepackage{color}
-% Comment
-\newcommand\docutilsrolec[1]{\textit{\textcolor[rgb]{0.25,0.50,0.50}{#1}}}
-% Error
-\definecolor{ducolor0}{rgb}{1.00,0.00,0.00}
-\newcommand\docutilsroleerr[1]{\colorbox{ducolor0}{#1}}
-% Keyword
-\newcommand\docutilsrolek[1]{\textbf{\textcolor[rgb]{0.00,0.50,0.00}{#1}}}
-% Operator
-\newcommand\docutilsroleo[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-% Comment.Multiline
-\newcommand\docutilsrolecm[1]{\textit{\textcolor[rgb]{0.25,0.50,0.50}{#1}}}
-% Comment.Preproc
-\newcommand\docutilsrolecp[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}}
-% Comment.Single
-% Can't generate style for 'c1' because 'docutilsrolec1' is not a valid macro id.
-% Comment.Special
-\newcommand\docutilsrolecs[1]{\textit{\textcolor[rgb]{0.25,0.50,0.50}{#1}}}
-% Generic.Deleted
-\newcommand\docutilsrolegd[1]{\textcolor[rgb]{0.63,0.00,0.00}{#1}}
-% Generic.Emph
-\newcommand\docutilsrolege[1]{\textit{#1}}
-% Generic.Error
-\newcommand\docutilsrolegr[1]{\textcolor[rgb]{1.00,0.00,0.00}{#1}}
-% Generic.Heading
-\newcommand\docutilsrolegh[1]{\textbf{\textcolor[rgb]{0.00,0.00,0.50}{#1}}}
-% Generic.Inserted
-\newcommand\docutilsrolegi[1]{\textcolor[rgb]{0.00,0.63,0.00}{#1}}
-% Generic.Output
-\newcommand\docutilsrolego[1]{\textcolor[rgb]{0.50,0.50,0.50}{#1}}
-% Generic.Prompt
-\newcommand\docutilsrolegp[1]{\textbf{\textcolor[rgb]{0.00,0.00,0.50}{#1}}}
-% Generic.Strong
-\newcommand\docutilsrolegs[1]{\textbf{#1}}
-% Generic.Subheading
-\newcommand\docutilsrolegu[1]{\textbf{\textcolor[rgb]{0.50,0.00,0.50}{#1}}}
-% Generic.Traceback
-\newcommand\docutilsrolegt[1]{\textcolor[rgb]{0.00,0.25,0.82}{#1}}
-% Keyword.Constant
-\newcommand\docutilsrolekc[1]{\textbf{\textcolor[rgb]{0.00,0.50,0.00}{#1}}}
-% Keyword.Declaration
-\newcommand\docutilsrolekd[1]{\textbf{\textcolor[rgb]{0.00,0.50,0.00}{#1}}}
-% Keyword.Pseudo
-\newcommand\docutilsrolekp[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
-% Keyword.Reserved
-\newcommand\docutilsrolekr[1]{\textbf{\textcolor[rgb]{0.00,0.50,0.00}{#1}}}
-% Keyword.Type
-\newcommand\docutilsrolekt[1]{\textcolor[rgb]{0.69,0.00,0.25}{#1}}
-% Literal.Number
-\newcommand\docutilsrolem[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-% Literal.String
-\newcommand\docutilsroles[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
-% Name.Attribute
-\newcommand\docutilsrolena[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}}
-% Name.Builtin
-\newcommand\docutilsrolenb[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
-% Name.Class
-\newcommand\docutilsrolenc[1]{\textbf{\textcolor[rgb]{0.00,0.00,1.00}{#1}}}
-% Name.Constant
-\newcommand\docutilsroleno[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}}
-% Name.Decorator
-\newcommand\docutilsrolend[1]{\textcolor[rgb]{0.67,0.13,1.00}{#1}}
-% Name.Entity
-\newcommand\docutilsroleni[1]{\textbf{\textcolor[rgb]{0.60,0.60,0.60}{#1}}}
-% Name.Exception
-\newcommand\docutilsrolene[1]{\textbf{\textcolor[rgb]{0.82,0.25,0.23}{#1}}}
-% Name.Function
-\newcommand\docutilsrolenf[1]{\textcolor[rgb]{0.00,0.00,1.00}{#1}}
-% Name.Label
-\newcommand\docutilsrolenl[1]{\textcolor[rgb]{0.63,0.63,0.00}{#1}}
-% Name.Namespace
-\newcommand\docutilsrolenn[1]{\textbf{\textcolor[rgb]{0.00,0.00,1.00}{#1}}}
-% Name.Tag
-\newcommand\docutilsrolent[1]{\textbf{\textcolor[rgb]{0.00,0.50,0.00}{#1}}}
-% Name.Variable
-\newcommand\docutilsrolenv[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
-% Operator.Word
-\newcommand\docutilsroleow[1]{\textbf{\textcolor[rgb]{0.67,0.13,1.00}{#1}}}
-% Text.Whitespace
-\newcommand\docutilsrolew[1]{\textcolor[rgb]{0.73,0.73,0.73}{#1}}
-% Literal.Number.Float
-\newcommand\docutilsrolemf[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-% Literal.Number.Hex
-\newcommand\docutilsrolemh[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-% Literal.Number.Integer
-\newcommand\docutilsrolemi[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-% Literal.Number.Oct
-\newcommand\docutilsrolemo[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-% Literal.String.Backtick
-\newcommand\docutilsrolesb[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
-% Literal.String.Char
-\newcommand\docutilsrolesc[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
-% Literal.String.Doc
-\newcommand\docutilsrolesd[1]{\textit{\textcolor[rgb]{0.73,0.13,0.13}{#1}}}
-% Literal.String.Double
-% Can't generate style for 's2' because 'docutilsroles2' is not a valid macro id.
-% Literal.String.Escape
-\newcommand\docutilsrolese[1]{\textbf{\textcolor[rgb]{0.73,0.40,0.13}{#1}}}
-% Literal.String.Heredoc
-\newcommand\docutilsrolesh[1]{\textcolor[rgb]{0.73,0.13,0.13}{#1}}
-% Literal.String.Interpol
-\newcommand\docutilsrolesi[1]{\textbf{\textcolor[rgb]{0.73,0.40,0.53}{#1}}}
-% Literal.String.Other
-\newcommand\docutilsrolesx[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
-% Literal.String.Regex
-\newcommand\docutilsrolesr[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}}
-% Literal.String.Single
-% Can't generate style for 's1' because 'docutilsroles1' is not a valid macro id.
-% Literal.String.Symbol
-\newcommand\docutilsroless[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
-% Name.Builtin.Pseudo
-\newcommand\docutilsrolebp[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
-% Name.Variable.Class
-\newcommand\docutilsrolevc[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
-% Name.Variable.Global
-\newcommand\docutilsrolevg[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
-% Name.Variable.Instance
-\newcommand\docutilsrolevi[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
-% Literal.Number.Integer.Long
-\newcommand\docutilsroleil[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-\newcommand\docutilsrolep[1]{#1}
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/README.txt b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/README.txt
deleted file mode 100644
index aa68c3d11..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/README.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-.. -*- rst-mode -*-
-
-Pygments enhanced docutils front-ends
--------------------------------------
-
-The example code in "`Using Pygments in ReST documents`_" defines a new
-"sourcecode" directive. The directive takes one argument `language` and uses
-the `Pygments`_ source highlighter to parse and render its content as a
-colourful source code block.
-
-Combining the pygments_ example code with the standard docutils_ front-ends,
-results in front-end scripts generating output documents with syntax colour.
-For consistency with the majority of existing add-ons, the directive is
-renamed to "code-block".
-
-`rst2html-pygments`_
- enhances the standard docutils ``rst2html`` front-end to
- generate a HTML rendering with syntax highlight.
-
-`rst2latex-pygments`_
- enhances docutils' ``rst2latex`` to generate LaTeX with syntax highlight.
-
-Advantages:
- + Easy implementation with no changes to the stock docutils_.
- + Separation of code blocks and ordinary literal blocks.
-
-Disadvantages:
- - "code-block" content is formatted by `pygments`_ and inserted in the
- document tree as a "raw" node making the approach writer-dependant.
- - documents are incompatible with the standard docutils because of the
- locally defined directive.
- - more "invasive" markup distracting from content
- - no "minimal" code block marker -- three additional lines per code block
-
-
-The disadvantages lead to the alternative implementation with the
-demonstrator front ends `rst2html-highlight`_ and `rst2latex-highlight`_.
-
-
-Example
-"""""""
-
-Python script:
- :text source: `for-else-test.py.txt`_
- :HTML: `for-else-test.py.htm`_
- :LaTeX: `for-else-test.py.tex`_
- :PDF: `for-else-test.py.pdf`_
-
-Stylesheets:
- :CSS stylesheet: `pygments-default.css`_
- :LaTeX style: `pygments-default.sty`_
-
-.. References
-
-.. _pygments: http://pygments.org/
-.. _docutils: http://docutils.sourceforge.net/
-.. _Using Pygments in ReST documents: http://pygments.org/docs/rstdirective/
-
-.. _rst2html-pygments: rst2html-pygments
-.. _rst2latex-pygments: rst2latex-pygments
-.. _rst2html-highlight: ../../rst2html-highlight
-.. _rst2latex-highlight: ../../rst2latex-highlight
-.. _for-else-test:
-.. _for-else-test.py.htm: for-else-test.py.htm
-.. _for-else-test.py.txt: for-else-test.py.txt
-.. _for-else-test.py.tex: for-else-test.py.tex
-.. _for-else-test.py.pdf: for-else-test.py.pdf
-.. _pygments-default.css: ../../data/pygments-default.css
-.. _pygments-default.sty: ../../data/pygments-default.sty
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py
deleted file mode 100644
index 4bb941dd6..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# Example for syntax highlight with Pygments
-# ==========================================
-#
-# Translate this document to HTML with a pygments enhanced frontend::
-#
-# rst2html-pygments --stylesheet=pygments-default.css
-#
-# or to LaTeX with::
-#
-# rst2latex-pygments --stylesheet=pygments-default.sty
-#
-# to gain syntax highlight in the output.
-#
-# Convert between text <-> code source formats with::
-#
-# pylit --code-block-marker='.. code-block:: python'
-#
-# Run the doctests with::
-#
-# pylit --doctest for-else-test.py
-#
-#
-# for-else-test
-# -------------
-#
-# Test the flow in a `for` loop with `else` statement.
-#
-# First define a simple `for` loop.
-#
-# .. code-block:: python
-
-def loop1(iterable):
- """simple for loop with `else` statement"""
- for i in iterable:
- print i
- else:
- print "iterable empty"
- print "Ende"
-
-# Now test it:
-#
-# The first test runs as I expect: iterator empty -> else clause applies:
-#
-# .. code-block:: pycon
-#
-# >>> execfile('for-else-test.py')
-# >>> loop1(range(0))
-# iterable empty
-# Ende
-#
-# However, the else clause even runs if the iterator is not empty in the first
-# place but after it is "spent":
-#
-# .. code-block:: pycon
-#
-# >>> loop1(range(3))
-# 0
-# 1
-# 2
-# iterable empty
-# Ende
-#
-# It seems like the else clause can only be prevented, if we break out of
-# the loop. Let's try
-#
-# .. code-block:: python
-
-def loop2(iterable):
- """for loop with `break` and `else` statement"""
- for i in iterable:
- print i
- break
- else:
- print "iterable empty"
- print "Ende"
-
-# And indeed, the else clause is skipped after breaking out of the loop:
-#
-# .. code-block:: pycon
-#
-# >>> loop2(range(3))
-# 0
-# Ende
-#
-# The empty iterator runs as expected:
-#
-# .. code-block:: pycon
-#
-# >>> loop2(range(0))
-# iterable empty
-# Ende
-#
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.htm b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.htm
deleted file mode 100644
index 1e6057be1..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.htm
+++ /dev/null
@@ -1,185 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
-<title>Example for syntax highlight with Pygments</title>
-<style type="text/css">
-
-/* Stylesheet for pygments enhanced reStructured Text */
-/* ================================================== */
-
-/* :Author: Guenter Milde */
-/* :Copyright: 2007 G. Milde */
-/* This stylesheet is released under the GPL v. 2 or later */
-
-/* This stylesheet provides syntax highlight for documents generated with a */
-/* pygments_ enhanced reStructured Text -> html converter. */
-
-/* Import the default docutils style sheet */
-/* --------------------------------------- */
-/* :: */
-
-@import url("/stylesheets/html4css1.css");
-
-/* Indent the code block */
-/* --------------------- */
-
-/* Content copied from the `html4css1.css` rule for literal blocks. */
-/* Selector adapted to the output of Pygments_. :: */
-
-div.highlight {
- margin-left: 2em ;
- margin-right: 2em ;
- background-color: #eeeeee
- }
-
-
-/* Colour code blocks */
-/* ------------------ */
-
-/* Pygments_ has an option to generate stylesheets for html and latex. */
-/* The following code is generated with the command */
-/* `pygmentize -S default -f html > pygments-default.css`:: */
-
-.c { color: #008800; font-style: italic } /* Comment */
-.err { border: 1px solid #FF0000 } /* Error */
-.k { color: #AA22FF; font-weight: bold } /* Keyword */
-.o { color: #666666 } /* Operator */
-.cm { color: #008800; font-style: italic } /* Comment.Multiline */
-.cp { color: #008800 } /* Comment.Preproc */
-.c1 { color: #008800; font-style: italic } /* Comment.Single */
-.gd { color: #A00000 } /* Generic.Deleted */
-.ge { font-style: italic } /* Generic.Emph */
-.gr { color: #FF0000 } /* Generic.Error */
-.gh { color: #000080; font-weight: bold } /* Generic.Heading */
-.gi { color: #00A000 } /* Generic.Inserted */
-.go { color: #808080 } /* Generic.Output */
-.gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-.gs { font-weight: bold } /* Generic.Strong */
-.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-.gt { color: #0040D0 } /* Generic.Traceback */
-.kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */
-.kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */
-.kp { color: #AA22FF } /* Keyword.Pseudo */
-.kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */
-.kt { color: #AA22FF; font-weight: bold } /* Keyword.Type */
-.m { color: #666666 } /* Literal.Number */
-.s { color: #BB4444 } /* Literal.String */
-.na { color: #BB4444 } /* Name.Attribute */
-.nb { color: #AA22FF } /* Name.Builtin */
-.nc { color: #0000FF } /* Name.Class */
-.no { color: #880000 } /* Name.Constant */
-.nd { color: #AA22FF } /* Name.Decorator */
-.ni { color: #999999; font-weight: bold } /* Name.Entity */
-.ne { color: #D2413A; font-weight: bold } /* Name.Exception */
-.nf { color: #00A000 } /* Name.Function */
-.nl { color: #A0A000 } /* Name.Label */
-.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
-.nt { color: #008000; font-weight: bold } /* Name.Tag */
-.nv { color: #B8860B } /* Name.Variable */
-.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
-.mf { color: #666666 } /* Literal.Number.Float */
-.mh { color: #666666 } /* Literal.Number.Hex */
-.mi { color: #666666 } /* Literal.Number.Integer */
-.mo { color: #666666 } /* Literal.Number.Oct */
-.sb { color: #BB4444 } /* Literal.String.Backtick */
-.sc { color: #BB4444 } /* Literal.String.Char */
-.sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */
-.s2 { color: #BB4444 } /* Literal.String.Double */
-.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
-.sh { color: #BB4444 } /* Literal.String.Heredoc */
-.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
-.sx { color: #008000 } /* Literal.String.Other */
-.sr { color: #BB6688 } /* Literal.String.Regex */
-.s1 { color: #BB4444 } /* Literal.String.Single */
-.ss { color: #B8860B } /* Literal.String.Symbol */
-.bp { color: #AA22FF } /* Name.Builtin.Pseudo */
-.vc { color: #B8860B } /* Name.Variable.Class */
-.vg { color: #B8860B } /* Name.Variable.Global */
-.vi { color: #B8860B } /* Name.Variable.Instance */
-.il { color: #666666 } /* Literal.Number.Integer.Long */
-
-/* .. _pygments: http://pygments.org/ */
-
-</style>
-</head>
-<body>
-<div class="document" id="example-for-syntax-highlight-with-pygments">
-<h1 class="title">Example for syntax highlight with Pygments</h1>
-<p>Translate this document to HTML with a pygments enhanced frontend:</p>
-<pre class="literal-block">
-rst2html-pygments --stylesheet=pygments-default.css
-</pre>
-<p>or to LaTeX with:</p>
-<pre class="literal-block">
-rst2latex-pygments --stylesheet=pygments-default.sty
-</pre>
-<p>to gain syntax highlight in the output.</p>
-<p>Convert between text &lt;-&gt; code source formats with:</p>
-<pre class="literal-block">
-pylit --code-block-marker='.. code-block:: python'
-</pre>
-<p>Run the doctests with:</p>
-<pre class="literal-block">
-pylit --doctest for-else-test.py
-</pre>
-<div class="section">
-<h1><a id="for-else-test" name="for-else-test">for-else-test</a></h1>
-<p>Test the flow in a <cite>for</cite> loop with <cite>else</cite> statement.</p>
-<p>First define a simple <cite>for</cite> loop.</p>
-<div class="highlight"><pre><span class="k">def</span> <span class="nf">loop1</span><span class="p">(</span><span class="n">iterable</span><span class="p">):</span>
- <span class="sd">&quot;&quot;&quot;simple for loop with `else` statement&quot;&quot;&quot;</span>
- <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">iterable</span><span class="p">:</span>
- <span class="k">print</span> <span class="n">i</span>
- <span class="k">else</span><span class="p">:</span>
- <span class="k">print</span> <span class="s">&quot;iterable empty&quot;</span>
- <span class="k">print</span> <span class="s">&quot;Ende&quot;</span>
-</pre></div>
-<p>Now test it:</p>
-<p>The first test runs as I expect: iterator empty -&gt; else clause applies:</p>
-<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">execfile</span><span class="p">(</span><span class="s">&#39;for-else-test.py&#39;</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">loop1</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
-<span class="go">iterable empty</span>
-<span class="go">Ende</span>
-</pre></div>
-<p>However, the else clause even runs if the iterator is not empty in the first
-place but after it is &quot;spent&quot;:</p>
-<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">loop1</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
-<span class="go">0</span>
-<span class="go">1</span>
-<span class="go">2</span>
-<span class="go">iterable empty</span>
-<span class="go">Ende</span>
-</pre></div>
-<p>It seems like the else clause can only be prevented, if we break out of
-the loop. Let's try</p>
-<div class="highlight"><pre><span class="k">def</span> <span class="nf">loop2</span><span class="p">(</span><span class="n">iterable</span><span class="p">):</span>
- <span class="sd">&quot;&quot;&quot;for loop with `break` and `else` statement&quot;&quot;&quot;</span>
- <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">iterable</span><span class="p">:</span>
- <span class="k">print</span> <span class="n">i</span>
- <span class="k">break</span>
- <span class="k">else</span><span class="p">:</span>
- <span class="k">print</span> <span class="s">&quot;iterable empty&quot;</span>
- <span class="k">print</span> <span class="s">&quot;Ende&quot;</span>
-</pre></div>
-<p>And indeed, the else clause is skipped after breaking out of the loop:</p>
-<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">loop2</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
-<span class="go">0</span>
-<span class="go">Ende</span>
-</pre></div>
-<p>The empty iterator runs as expected:</p>
-<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">loop2</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
-<span class="go">iterable empty</span>
-<span class="go">Ende</span>
-</pre></div>
-</div>
-</div>
-<div class="footer">
-<hr class="footer" />
-Generated on: 2007-06-21.
-
-</div>
-</body>
-</html>
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.pdf b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.pdf
deleted file mode 100644
index fa39a5967..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.pdf
+++ /dev/null
Binary files differ
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.tex b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.tex
deleted file mode 100644
index e16a5dd71..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.tex
+++ /dev/null
@@ -1,170 +0,0 @@
-\documentclass[10pt,a4paper,english]{scrartcl}
-\usepackage{babel}
-\usepackage[T1]{fontenc}
-\usepackage{shortvrb}
-\usepackage{ucs}
-\usepackage[utf8x]{inputenc}
-\usepackage{tabularx}
-\usepackage{longtable}
-\usepackage{booktabs}
-\setlength{\extrarowheight}{2pt}
-\usepackage{amsmath}
-\usepackage{graphicx}
-\usepackage{color}
-\usepackage{multirow}
-\usepackage{ifthen}
-\typearea{12}
-% generated by Docutils <http://docutils.sourceforge.net/>
-\newlength{\admonitionwidth}
-\setlength{\admonitionwidth}{0.9\textwidth}
-\newlength{\docinfowidth}
-\setlength{\docinfowidth}{0.9\textwidth}
-\newlength{\locallinewidth}
-\newcommand{\optionlistlabel}[1]{\bf #1 \hfill}
-\newenvironment{optionlist}[1]
-{\begin{list}{}
- {\setlength{\labelwidth}{#1}
- \setlength{\rightmargin}{1cm}
- \setlength{\leftmargin}{\rightmargin}
- \addtolength{\leftmargin}{\labelwidth}
- \addtolength{\leftmargin}{\labelsep}
- \renewcommand{\makelabel}{\optionlistlabel}}
-}{\end{list}}
-\newlength{\lineblockindentation}
-\setlength{\lineblockindentation}{2.5em}
-\newenvironment{lineblock}[1]
-{\begin{list}{}
- {\setlength{\partopsep}{\parskip}
- \addtolength{\partopsep}{\baselineskip}
- \topsep0pt\itemsep0.15\baselineskip\parsep0pt
- \leftmargin#1}
- \raggedright}
-{\end{list}}
-% begin: floats for footnotes tweaking.
-\setlength{\floatsep}{0.5em}
-\setlength{\textfloatsep}{\fill}
-\addtolength{\textfloatsep}{3em}
-\renewcommand{\textfraction}{0.5}
-\renewcommand{\topfraction}{0.5}
-\renewcommand{\bottomfraction}{0.5}
-\setcounter{totalnumber}{50}
-\setcounter{topnumber}{50}
-\setcounter{bottomnumber}{50}
-% end floats for footnotes
-% some commands, that could be overwritten in the style file.
-\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}}
-\newcommand{\titlereference}[1]{\textsl{#1}}
-% end of "some commands"
-% user specified packages and stylesheets:
-\usepackage{../../data/pygments-default}
-\ifthenelse{\isundefined{\hypersetup}}{
-\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
-}{}
-\title{Example for syntax highlight with Pygments}
-\author{}
-\date{}
-\hypersetup{
-pdftitle={Example for syntax highlight with Pygments}
-}
-\raggedbottom
-\begin{document}
-\maketitle
-
-\setlength{\locallinewidth}{\linewidth}
-
-Translate this document to HTML with a pygments enhanced frontend:
-\begin{quote}\begin{verbatim}
-rst2html-pygments --stylesheet=pygments-default.css
-\end{verbatim}
-\end{quote}
-
-or to LaTeX with:
-\begin{quote}\begin{verbatim}
-rst2latex-pygments --stylesheet=pygments-default.sty
-\end{verbatim}
-\end{quote}
-
-to gain syntax highlight in the output.
-
-Convert between text {\textless}-{\textgreater} code source formats with:
-\begin{quote}\begin{verbatim}
-pylit --code-block-marker='.. code-block:: python'
-\end{verbatim}
-\end{quote}
-
-Run the doctests with:
-\begin{quote}\begin{verbatim}
-pylit --doctest for-else-test.py
-\end{verbatim}
-\end{quote}
-
-
-%___________________________________________________________________________
-
-\hypertarget{for-else-test}{}
-\pdfbookmark[0]{for-else-test}{for-else-test}
-\section*{for-else-test}
-\label{for-else-test}
-
-Test the flow in a \titlereference{for} loop with \titlereference{else} statement.
-
-First define a simple \titlereference{for} loop.
-\begin{Verbatim}[commandchars=@\[\]]
-@PYay[def] @PYaK[loop1](iterable):
- @PYas["""simple for loop with `else` statement"""]
- @PYay[for] i @PYan[in] iterable:
- @PYay[print] i
- @PYay[else]:
- @PYay[print] @PYad["]@PYad[iterable empty]@PYad["]
- @PYay[print] @PYad["]@PYad[Ende]@PYad["]
-\end{Verbatim}
-
-Now test it:
-
-The first test runs as I expect: iterator empty -{\textgreater} else clause applies:
-\begin{Verbatim}[commandchars=@\[\]]
-@PYaO[>>> ]@PYaX[execfile](@PYad[']@PYad[for-else-test.py]@PYad['])
-@PYaO[>>> ]loop1(@PYaX[range](@PYaw[0]))
-@PYaa[iterable empty]
-@PYaa[Ende]
-\end{Verbatim}
-
-However, the else clause even runs if the iterator is not empty in the first
-place but after it is ``spent'':
-\begin{Verbatim}[commandchars=@\[\]]
-@PYaO[>>> ]loop1(@PYaX[range](@PYaw[3]))
-@PYaa[0]
-@PYaa[1]
-@PYaa[2]
-@PYaa[iterable empty]
-@PYaa[Ende]
-\end{Verbatim}
-
-It seems like the else clause can only be prevented, if we break out of
-the loop. Let's try
-\begin{Verbatim}[commandchars=@\[\]]
-@PYay[def] @PYaK[loop2](iterable):
- @PYas["""for loop with `break` and `else` statement"""]
- @PYay[for] i @PYan[in] iterable:
- @PYay[print] i
- @PYay[break]
- @PYay[else]:
- @PYay[print] @PYad["]@PYad[iterable empty]@PYad["]
- @PYay[print] @PYad["]@PYad[Ende]@PYad["]
-\end{Verbatim}
-
-And indeed, the else clause is skipped after breaking out of the loop:
-\begin{Verbatim}[commandchars=@\[\]]
-@PYaO[>>> ]loop2(@PYaX[range](@PYaw[3]))
-@PYaa[0]
-@PYaa[Ende]
-\end{Verbatim}
-
-The empty iterator runs as expected:
-\begin{Verbatim}[commandchars=@\[\]]
-@PYaO[>>> ]loop2(@PYaX[range](@PYaw[0]))
-@PYaa[iterable empty]
-@PYaa[Ende]
-\end{Verbatim}
-
-\end{document}
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.txt b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.txt
deleted file mode 100644
index d9687ecd5..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/for-else-test.py.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-Example for syntax highlight with Pygments
-==========================================
-
-Translate this document to HTML with a pygments enhanced frontend::
-
- rst2html-pygments --stylesheet=pygments-default.css
-
-or to LaTeX with::
-
- rst2latex-pygments --stylesheet=pygments-default.sty
-
-to gain syntax highlight in the output.
-
-Convert between text <-> code source formats with::
-
- pylit --code-block-marker='.. code-block:: python'
-
-Run the doctests with::
-
- pylit --doctest for-else-test.py
-
-
-for-else-test
--------------
-
-Test the flow in a `for` loop with `else` statement.
-
-First define a simple `for` loop.
-
-.. code-block:: python
-
- def loop1(iterable):
- """simple for loop with `else` statement"""
- for i in iterable:
- print i
- else:
- print "iterable empty"
- print "Ende"
-
-Now test it:
-
-The first test runs as I expect: iterator empty -> else clause applies:
-
-.. code-block:: pycon
-
- >>> execfile('for-else-test.py')
- >>> loop1(range(0))
- iterable empty
- Ende
-
-However, the else clause even runs if the iterator is not empty in the first
-place but after it is "spent":
-
-.. code-block:: pycon
-
- >>> loop1(range(3))
- 0
- 1
- 2
- iterable empty
- Ende
-
-It seems like the else clause can only be prevented, if we break out of
-the loop. Let's try
-
-.. code-block:: python
-
- def loop2(iterable):
- """for loop with `break` and `else` statement"""
- for i in iterable:
- print i
- break
- else:
- print "iterable empty"
- print "Ende"
-
-And indeed, the else clause is skipped after breaking out of the loop:
-
-.. code-block:: pycon
-
- >>> loop2(range(3))
- 0
- Ende
-
-The empty iterator runs as expected:
-
-.. code-block:: pycon
-
- >>> loop2(range(0))
- iterable empty
- Ende
-
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2html-pygments b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2html-pygments
deleted file mode 100755
index 706b25980..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2html-pygments
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-
-# :Author: David Goodger, the Pygments team, Guenter Milde
-# :Date: $Date: $
-# :Copyright: This module has been placed in the public domain.
-
-# This is a merge of the docutils_ `rst2html` front end with an extension
-# suggestion taken from the pygments_ documentation.
-
-"""
-A front end to docutils, producing HTML with syntax colouring using pygments
-"""
-
-try:
- import locale
- locale.setlocale(locale.LC_ALL, '')
-except:
- pass
-
-from docutils.core import publish_cmdline, default_description
-
-description = ('Generates (X)HTML documents from standalone reStructuredText '
- 'sources. Uses `pygments` to colorize the content of'
- '"code-block" directives. Needs an adapted stylesheet'
- + default_description)
-
-# Define a new directive `code-block` that uses the `pygments` source
-# highlighter to render code in color.
-#
-# Code from the `pygments`_ documentation for `Using Pygments in ReST
-# documents`_.
-
-from docutils import nodes
-from docutils.parsers.rst import directives
-from pygments import highlight
-from pygments.lexers import get_lexer_by_name
-from pygments.formatters import HtmlFormatter
-
-pygments_formatter = HtmlFormatter()
-
-def pygments_directive(name, arguments, options, content, lineno,
- content_offset, block_text, state, state_machine):
- try:
- lexer = get_lexer_by_name(arguments[0])
- except ValueError:
- # no lexer found - use the text one instead of an exception
- lexer = get_lexer_by_name('text')
- parsed = highlight(u'\n'.join(content), lexer, pygments_formatter)
- return [nodes.raw('', parsed, format='html')]
-pygments_directive.arguments = (1, 0, 1)
-pygments_directive.content = 1
-directives.register_directive('code-block', pygments_directive)
-
-# Call the docutils publisher to render the input as html::
-
-publish_cmdline(writer_name='html', description=description)
-
-# .. _doctutile: http://docutils.sf.net/
-# .. _pygments: http://pygments.org/
-# .. _Using Pygments in ReST documents: http://pygments.org/docs/rstdirective/
diff --git a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2latex-pygments b/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2latex-pygments
deleted file mode 100755
index c53c2aa74..000000000
--- a/sandbox/code-block-directive/tools/pygments-enhanced-front-ends/rst2latex-pygments
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-
-# Author: David Goodger, the Pygments team, Günter Milde
-# Date: $Date: $
-# Copyright: This module has been placed in the public domain.
-
-# This is a merge of the docutils_ `rst2latex` front end with an extension
-# suggestion taken from the pygments_ documentation.
-
-"""
-A front end to docutils, producing LaTeX with syntax colouring using pygments
-"""
-
-try:
- import locale
- locale.setlocale(locale.LC_ALL, '')
-except:
- pass
-
-from docutils.core import publish_cmdline, default_description
-
-description = ('Generates LaTeX documents from standalone reStructuredText '
- 'sources. Uses `pygments` to colorize the content of'
- '"code-block" directives. Needs an adapted stylesheet'
- + default_description)
-
-# Define a new directive `code-block` that uses the `pygments` source
-# highlighter to render code in color.
-#
-# Code from the `pygments`_ documentation for `Using Pygments in ReST
-# documents`_.
-
-from docutils import nodes
-from docutils.parsers.rst import directives
-from pygments import highlight
-from pygments.lexers import get_lexer_by_name
-from pygments.formatters import LatexFormatter
-
-pygments_formatter = LatexFormatter()
-
-def pygments_directive(name, arguments, options, content, lineno,
- content_offset, block_text, state, state_machine):
- try:
- lexer = get_lexer_by_name(arguments[0])
- except ValueError:
- # no lexer found - use the text one instead of an exception
- lexer = get_lexer_by_name('text')
- parsed = highlight(u'\n'.join(content), lexer, pygments_formatter)
- return [nodes.raw('', parsed, format='latex')]
-pygments_directive.arguments = (1, 0, 1)
-pygments_directive.content = 1
-directives.register_directive('code-block', pygments_directive)
-
-# Call the docutils publisher to render the input as latex::
-
-publish_cmdline(writer_name='latex', description=description)
-
-# .. _doctutile: http://docutils.sf.net/
-# .. _pygments: http://pygments.org/
-# .. _Using Pygments in ReST documents: http://pygments.org/docs/rstdirective/
diff --git a/sandbox/code-block-directive/tools/test_pygments_code_block_directive.py b/sandbox/code-block-directive/tools/test_pygments_code_block_directive.py
deleted file mode 100755
index def706889..000000000
--- a/sandbox/code-block-directive/tools/test_pygments_code_block_directive.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: iso-8859-1 -*-
-
-# Test the parsing and formatting by pygments:
-
-# :Author: Felix Wiemann; Günter Milde
-# :Date: $Date$
-# :Copyright: This module has been placed in the public domain.
-
-# Requirements
-# ------------
-
-from docutils import nodes, utils, core
-
-# Prepend parent dir to the PYTHONPATH (This is a hack to get this test
-# working without installing the pygments_code_block_directive module.
-# Not needed if the module is installed in the PYTHONPATH)
-import sys
-sys.path.insert(0, '..')
-
-from pygments_code_block_directive import DocutilsInterface
-
-# Test data
-# ---------
-
-code_sample = """\
-def my_function():
- "just a test"
- print 8/2
-"""
-
-language = "python"
-
-# Do not insert inline nodes for the following tokens.
-# (You could add e.g. Token.Punctuation like ``['', 'p']``.) ::
-unstyled_tokens = ['']
-
-# Set up a document tree
-# ----------------------
-
-document = utils.new_document('generated')
-literal_block = nodes.literal_block(classes=["code", language])
-document += literal_block
-
-
-# Parse code and fill the <literal_block>
-# ----------------------------------------
-
-for cls, value in DocutilsInterface(code_sample, language):
- if cls in unstyled_tokens:
- # insert as Text to decrease the verbosity of the output.
- node = nodes.Text(value, value)
- else:
- node = nodes.inline(value, value, classes=[cls])
- literal_block += node
-
-# Write
-# -----
-
-writer_names = ('html', 'pseudoxml', 'xml', 'latex', 'newlatex2e', 's5')
-for name in writer_names[:]:
- print "\nusing writer %r\n" % name
- print core.publish_from_doctree(document, writer_name=name)
-