# ChangeLog for dev-python/docutils
# Copyright 2000-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/ChangeLog,v 1.41 2006/02/14 16:44:36 marienz Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/ChangeLog,v 1.42 2006/02/16 23:05:51 marienz Exp $
+
+ 16 Feb 2006; Marien Zwart <marienz@gentoo.org> -files/glep-0.3-r1/glep.py,
+ -files/glep-0.3-r1/glep_htmlwrite.py,
+ -files/docutils-0.3.3-extramodules.patch,
+ -files/glep-0.3.3/glep_htmlwrite.py,
+ -files/docutils-0.3-extramodules.patch, -files/glep-0.3-r1/glepread.py,
+ -files/glep-0.3.3/glepread.py, -files/glep-0.3-r1/glepstrans.py,
+ -files/glep-0.3.3/glep.py, -files/glep-0.3.3/glepstrans.py,
+ -files/glep.py, -files/glep_htmlwrite.py, -files/glepread.py,
+ -files/glepstrans.py, -docutils-0.3_pre20030530-r3.ebuild,
+ -docutils-0.3-r1.ebuild, -docutils-0.3.3-r1.ebuild:
+ Remove old versions.
14 Feb 2006; Marien Zwart <marienz@gentoo.org> docutils-0.4.ebuild:
Fix bug breaking src_compile if docutils is not installed already. Thanks to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-MD5 228a69795aa57ed7f348cfac8c0520be ChangeLog 6616
-RMD160 85e0fe3b4158d57756b89bbbc73aa2d77c167a97 ChangeLog 6616
-SHA256 e21cc0b1c49c4f75ac78e4679f57339f42a16ec746228e58861ff3800a0939d8 ChangeLog 6616
-MD5 32c18f62ef442534b43d411bfd8c40a6 docutils-0.3-r1.ebuild 1770
-RMD160 fdf6a4ced1897f1c0ccb2e4a52955d056a24c20e docutils-0.3-r1.ebuild 1770
-SHA256 2d6f7b286490b2e9331fb9467f0e497fc9ddf746a131e6c17a6c32dca9743f7b docutils-0.3-r1.ebuild 1770
-MD5 dddf09e76c6f943ebc4931e2ff794320 docutils-0.3.3-r1.ebuild 1903
-RMD160 35741370b04785b9b41b6d162fcb816ce75eac6c docutils-0.3.3-r1.ebuild 1903
-SHA256 2cc6b9785822ee7eac77002a5a6d14e19448cb9f3aab91ff8328b6d5b4ebab57 docutils-0.3.3-r1.ebuild 1903
+MD5 f335d92904ac83f0597a1c33ac7593f6 ChangeLog 7222
+RMD160 d94d30ba211ebec8649feca5b794fe1505ae5fd2 ChangeLog 7222
+SHA256 b1e67d3dc457f84bf3f98ca14804abb2806b1de7e772f24066dc2e32dbec8894 ChangeLog 7222
MD5 c45be82484f7cc076c69a559e3133d62 docutils-0.3.5.ebuild 1969
RMD160 8b2f482bbe294e17cd099eff626aa9c9a47423b6 docutils-0.3.5.ebuild 1969
SHA256 9d06457a80e81babb465873f3546a5e254e78e24691c29c554f8843d81df9f5c docutils-0.3.5.ebuild 1969
MD5 1663689e9b352ee1dd81b9d6d78b2238 docutils-0.3.9.ebuild 2472
RMD160 560ccfd89af3d88c50d798445e51444803e94541 docutils-0.3.9.ebuild 2472
SHA256 0b42aa8d739d5e56b0356cd462ca6d8abf8473a06afbf046a3b0408856a7fd4d docutils-0.3.9.ebuild 2472
-MD5 74a7b1584824888016191380b65cea31 docutils-0.3_pre20030530-r3.ebuild 1541
-RMD160 60b30e84d385050f14a1b2e689ab16909bc4ce54 docutils-0.3_pre20030530-r3.ebuild 1541
-SHA256 ca3b29a595b3750d03063617cc76b74000df2c4d99c2a2f179f0445de5522d08 docutils-0.3_pre20030530-r3.ebuild 1541
MD5 26e11b99a559ef057054de986ac78f81 docutils-0.4.ebuild 2903
RMD160 f1f8f84afd81b7991a7017a8f8cd9e9ceab4459a docutils-0.4.ebuild 2903
SHA256 05be4623dcc1faa845a2389a188caf2350bcae0cdca8cf859375323587cc81e4 docutils-0.4.ebuild 2903
MD5 dac9480a7b5144f60cb48675c654f5a3 files/50docutils-gentoo.el 280
RMD160 d7a7c56fc93d93e2c0ca725c13a539b2d42489bf files/50docutils-gentoo.el 280
SHA256 18ead83f20f4de845dbd027b9d6845b3bb7d98933791b8c12b46528625d841cd files/50docutils-gentoo.el 280
-MD5 694b883b9a8f714dc375a547cdf62b1d files/digest-docutils-0.3-r1 64
-RMD160 3ec1a22a5ce57cec0fedb93df0322d0c35ac3ea9 files/digest-docutils-0.3-r1 64
-SHA256 7e6eaed20385bfe651b48901bbdc9a1cfc6dc9c2e47e05840ffd59603416d543 files/digest-docutils-0.3-r1 64
-MD5 d30e8a9c7f49c164696893c2f39f41ee files/digest-docutils-0.3.3-r1 72
-RMD160 17923600bad6814b1060cac223c70b9df25f9e18 files/digest-docutils-0.3.3-r1 72
-SHA256 70e0e126a1093ff04bf24202dbc494ed73a64fa5347f5463c13a060a8f4dc68e files/digest-docutils-0.3.3-r1 72
MD5 a88bbfee1135288043eeffcb178fab00 files/digest-docutils-0.3.5 124
RMD160 10dd1bcf48280bce443625342eebc1a7db79e06f files/digest-docutils-0.3.5 124
SHA256 cc22ef97819b6503159b9dd0b887ce9e0d4de22000bcd9449e05887591b8f51c files/digest-docutils-0.3.5 124
MD5 25c0102e3a347e2b80d72a778ae0549d files/digest-docutils-0.3.9 124
RMD160 ee2382dc076c8ed2a6526599294b88287f144825 files/digest-docutils-0.3.9 124
SHA256 f0d6cfd3e7f176db49a3d9b1f925521587f246ba8279f09bcb5e69c209f22305 files/digest-docutils-0.3.9 124
-MD5 8c6d9ea3ddd2e36b369112ee20b660fb files/digest-docutils-0.3_pre20030530-r3 73
-RMD160 cbdc80126cace4451b1cbc56f774af9871a6c47e files/digest-docutils-0.3_pre20030530-r3 73
-SHA256 69f56b4875c1ef7d02227e001c36f3e528a2fe38b27bf386c2714725c0d5c99a files/digest-docutils-0.3_pre20030530-r3 73
MD5 1dd3004476c8c1fc88936ead9bd41ddf files/digest-docutils-0.4 455
RMD160 c3786a9bff4a748d07c80cbdcd539e2eb572188e files/digest-docutils-0.4 455
SHA256 e2e3feb3122c7e17cc0f76de3699c794d854dfd456697037e7ea4c70d989423e files/digest-docutils-0.4 455
-MD5 7c025532adb8b09116980747be7ccc61 files/docutils-0.3-extramodules.patch 1155
-RMD160 4cd5e34d01f893fc9c2e25eaed9f7cf058162aaa files/docutils-0.3-extramodules.patch 1155
-SHA256 77438498810cd1dba21c3c817e499423b38bd54f403cf7c8a11e345200310301 files/docutils-0.3-extramodules.patch 1155
-MD5 fd7797bcc6dfaac58ec5408e4e3dac99 files/docutils-0.3.3-extramodules.patch 1159
-RMD160 ae59de52ab3daeb16d827a98288b9acca0a8d583 files/docutils-0.3.3-extramodules.patch 1159
-SHA256 1b9fd3cea6861af4e2f630ec12bf1298ed505c09ef7141f7e6d237b1ab944905 files/docutils-0.3.3-extramodules.patch 1159
MD5 9d184e504ea5367a9309b9a1691d5147 files/docutils-0.3.5-extramodules.patch 1163
RMD160 5d420446b752204a71e98f2a82f72d40265783f2 files/docutils-0.3.5-extramodules.patch 1163
SHA256 adc28a387a90b11771bd784452331da1b6a3ffed16c6ee2d1cc4899d63a5ba57 files/docutils-0.3.5-extramodules.patch 1163
MD5 4be747a533a3ba63b1cad7ced8b8ba04 files/docutils-0.3.7-extramodules.patch 1163
RMD160 4d7c0f935816f631b87cf58dbf228de931102e4f files/docutils-0.3.7-extramodules.patch 1163
SHA256 c375dc4d7228c051a6dc6dd586fea7789703fb4d3b7c8c5bad4375f0a9e74aaa files/docutils-0.3.7-extramodules.patch 1163
-MD5 770e48a59980bce89ab956ab96396a7c files/glep-0.3-r1/glep.py 699
-RMD160 6e247237cb4021cc6889109507bc963977405db0 files/glep-0.3-r1/glep.py 699
-SHA256 2f878654df28ba075a4466736c9c2eab6fdd885affd14827ef6efe73a0e51256 files/glep-0.3-r1/glep.py 699
-MD5 a273d63de34b5da93a15764998c054d2 files/glep-0.3-r1/glep_htmlwrite.py 4168
-RMD160 338ee019c9e991957c8109c28e80affff213111a files/glep-0.3-r1/glep_htmlwrite.py 4168
-SHA256 ead693215db03a1ddcaaef1f322e46990d6f90f22734e68b38773840caf69282 files/glep-0.3-r1/glep_htmlwrite.py 4168
-MD5 d6fc669e125324930e72f2421779a5c2 files/glep-0.3-r1/glepread.py 1647
-RMD160 83767cbf8c517cfab9fff5c16bbeca0d07e5dba3 files/glep-0.3-r1/glepread.py 1647
-SHA256 503fc5cc3ac122734429c0fdfb83a06f967ea64531e89c994ded57b70404a69f files/glep-0.3-r1/glepread.py 1647
-MD5 52f6ec87bfa6c5c8ec86c85e2a2ed58a files/glep-0.3-r1/glepstrans.py 10428
-RMD160 9bd7f24c770c2a161f65cb84918463fccff894f9 files/glep-0.3-r1/glepstrans.py 10428
-SHA256 8487a4e2588cb101c528e0733ced811c3b02bdb454afe6df32ac109bb2ce9b79 files/glep-0.3-r1/glepstrans.py 10428
-MD5 8a92d518608c84c83ce14ac840f96834 files/glep-0.3.3/glep.py 699
-RMD160 c796fd5a39966f1db876d1f443a13f3c9eb38f32 files/glep-0.3.3/glep.py 699
-SHA256 ea3d6287dd11e55b4033abddec20e4dd9944edc2ab11d0f2cd6ba5a8fd124f2b files/glep-0.3.3/glep.py 699
-MD5 bacb84b99614ef28729cb5adf4763242 files/glep-0.3.3/glep_htmlwrite.py 3246
-RMD160 ed9a44de06e18c4421a5fc65ec4196f311f36c8d files/glep-0.3.3/glep_htmlwrite.py 3246
-SHA256 ef48160ad7626091af42fdcfee6505df02684809e7553c3183baa48be4858a91 files/glep-0.3.3/glep_htmlwrite.py 3246
-MD5 f3c575d69568fafe2159283355e7efc0 files/glep-0.3.3/glepread.py 1833
-RMD160 0fd2e762abc6a00f9c3d1786b4b79881e5ac61f2 files/glep-0.3.3/glepread.py 1833
-SHA256 394d2467f3c7d5958930d55d20107949d94d3ebb19ecfc26b057df65c24c8b6d files/glep-0.3.3/glepread.py 1833
-MD5 bba4f5a38311f907d4ddb4a5514099ea files/glep-0.3.3/glepstrans.py 10898
-RMD160 07d11e917a3bfaf812f003d3d01b4ba0f83775d7 files/glep-0.3.3/glepstrans.py 10898
-SHA256 007ac7258459445355782c866e7a1ea5667fcae86e00514fbefa04eb7fa8a5fd files/glep-0.3.3/glepstrans.py 10898
-MD5 4787b6c5e6678d3f211ec7f8ec71aa03 files/glep.py 699
-RMD160 4f598f48e250a24786826a47109204318994e6e1 files/glep.py 699
-SHA256 720e2449772c5c06dfbfaca026ebdd5bad65b6a69004a22cbad54a245410a085 files/glep.py 699
-MD5 e3fa7c72245aae7d90beef3bf411583b files/glep_htmlwrite.py 4162
-RMD160 0dcc0e73aaefd9509444155c7111809404db801d files/glep_htmlwrite.py 4162
-SHA256 01c733116e783ac58a3399a87a8ab92f9325b7de62cc1d733c0118b4c08ac5dc files/glep_htmlwrite.py 4162
-MD5 0a2c7c1478f8b72f97b3d12534b4159e files/glepread.py 1647
-RMD160 664ea2446114cb1977ab9ab5359f5408d20848fd files/glepread.py 1647
-SHA256 75078a2036e309dfecf00de91c2a19f04391e29f87d7b0eb35533cfe3be5439a files/glepread.py 1647
-MD5 fded948d9eac24154eab24b2b56d15d6 files/glepstrans.py 10420
-RMD160 1a533210cdedfe194f2e549ee8d33972542727af files/glepstrans.py 10420
-SHA256 d7921025a32bf8e56e2877ab86eda34b0215615ce43ec33159b9bcc9d33e9f3a files/glepstrans.py 10420
MD5 71c4638c9c88af75b58e5f5cb54fe008 metadata.xml 159
RMD160 900a8c55d7a7d2f6312594769aaf941bf9e99c7f metadata.xml 159
SHA256 9f01104d3484792496faff4805eed0ecea2352a897151f3397d49a13800037b4 metadata.xml 159
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.2 (GNU/Linux)
+Version: GnuPG v1.4.2.1 (GNU/Linux)
-iD8DBQFD8gkEW78445TWHXcRAh7GAJ0RUOzhLuLfx8kwLOFxp24R54L0LgCaAl5r
-zNGKWCEObIALDQaXCFRQaVc=
-=LN/Y
+iD8DBQFD9QVfW78445TWHXcRArF/AJ9Nf8Q0AgsCWCjcwH5w9hP/ZXkiuwCfTD+L
+wm8b++sKDKsIkzlvriIFifw=
+=ggeJ
-----END PGP SIGNATURE-----
+++ /dev/null
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/docutils-0.3-r1.ebuild,v 1.10 2005/03/14 19:38:08 pythonhead Exp $
-
-inherit distutils eutils
-
-DESCRIPTION="Set of python tools for processing plaintext docs into HTML, XML, etc."
-HOMEPAGE="http://docutils.sourceforge.net/"
-SRC_URI="mirror://sourceforge/docutils/${P}.tar.gz"
-
-LICENSE="public-domain PYTHON BSD"
-SLOT="0"
-KEYWORDS="x86 ppc"
-IUSE=""
-
-DEPEND="<dev-lang/python-2.4"
-
-# GLEP version
-GLEP_SRC=${FILESDIR}/glep-${PVR}
-
-src_unpack() {
- unpack ${A}
- # simplified algorithm to select installing optparse and textwrap
- epatch ${FILESDIR}/${P}-extramodules.patch
-}
-
-src_compile() {
- distutils_src_compile
-
- # Generate html docs from reStructured text sources
- PYTHONPATH=${S}/build/lib ${python} \
- tools/buildhtml.py --config=tools/docutils.conf
-}
-
-
-install_txt_doc() {
- local doc=${1}
- local dir="txt/$(dirname ${doc})"
- docinto ${dir}
- dodoc ${doc}
-}
-
-src_install() {
- mydoc="MANIFEST.in *.txt"
- distutils_src_install
- # Tools
- cd ${S}/tools
- for tool in *.py
- do
- newbin ${tool} docutils-${tool}
- done
- # Docs
- cd ${S}
- dohtml -r docs spec tools
- for doc in $(find docs spec tools -name '*.txt')
- do
- install_txt_doc $doc
- done
-
- # installing Gentoo GLEP tools. Uses versioned GLEP distribution
- distutils_python_version
- newbin ${GLEP_SRC}/glep.py docutils-glep.py
- insinto /usr/lib/python${PYVER}/site-packages/docutils/readers
- newins ${GLEP_SRC}/glepread.py glep.py
- insinto /usr/lib/python${PYVER}/site-packages/docutils/transforms
- newins ${GLEP_SRC}/glepstrans.py gleps.py
- insinto /usr/lib/python${PYVER}/site-packages/docutils/writers
- newins ${GLEP_SRC}/glep_htmlwrite.py glep_html.py
-}
+++ /dev/null
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/docutils-0.3.3-r1.ebuild,v 1.9 2005/04/24 09:15:55 blubb Exp $
-
-inherit distutils eutils
-
-DESCRIPTION="Set of python tools for processing plaintext docs into HTML, XML, etc."
-HOMEPAGE="http://docutils.sourceforge.net/"
-SRC_URI="mirror://sourceforge/docutils/${P}-alpha.tar.gz"
-
-LICENSE="public-domain PYTHON BSD"
-SLOT="0"
-KEYWORDS="x86 ppc ~alpha amd64 ~sparc"
-IUSE=""
-
-DEPEND="<dev-lang/python-2.4"
-
-# GLEP version
-GLEP_SRC=${FILESDIR}/glep-${PV}
-
-src_unpack() {
- unpack ${A}
- # simplified algorithm to select installing optparse and textwrap
- epatch ${FILESDIR}/${P}-extramodules.patch
-}
-
-src_compile() {
- distutils_src_compile
-
- # Generate html docs from reStructured text sources
- PYTHONPATH=${S}/build/lib ${python} \
- tools/buildhtml.py --config=tools/docutils.conf
-}
-
-
-install_txt_doc() {
- local doc=${1}
- local dir="txt/$(dirname ${doc})"
- docinto ${dir}
- dodoc ${doc}
-}
-
-src_install() {
- mydoc="MANIFEST.in *.txt"
- distutils_src_install
- # Tools
- cd ${S}/tools
- for tool in *.py
- do
- newbin ${tool} docutils-${tool}
- done
- # Docs
- cd ${S}
- dohtml -r docs spec tools
- for doc in $(find docs spec tools -name '*.txt')
- do
- install_txt_doc $doc
- done
-
- # installing Gentoo GLEP tools. Uses versioned GLEP distribution
- distutils_python_version
- newbin ${GLEP_SRC}/glep.py docutils-glep.py || die "newbin failed"
- insinto /usr/lib/python${PYVER}/site-packages/docutils/readers
- newins ${GLEP_SRC}/glepread.py glep.py || die "newins reader failed"
- insinto /usr/lib/python${PYVER}/site-packages/docutils/transforms
- newins ${GLEP_SRC}/glepstrans.py gleps.py || "newins transform failed"
- insinto /usr/lib/python${PYVER}/site-packages/docutils/writers
- newins ${GLEP_SRC}/glep_htmlwrite.py glep_html.py || die "newins writer failed"
-}
+++ /dev/null
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/docutils/docutils-0.3_pre20030530-r3.ebuild,v 1.9 2005/03/14 19:38:08 pythonhead Exp $
-
-DESCRIPTION="Set of python tools for processing plaintext docs into HTML, XML, etc."
-HOMEPAGE="http://docutils.sourceforge.net/"
-SRC_URI="mirror://gentoo/${P}.tgz"
-
-LICENSE="public-domain PYTHON BSD"
-SLOT="0"
-KEYWORDS="x86 ~ppc"
-IUSE=""
-
-inherit distutils
-
-DEPEND="<dev-lang/python-2.4"
-S=${WORKDIR}/${PN}
-
-src_compile() {
- distutils_src_compile
-
- # Generate html docs from reStructured text sources
- PYTHONPATH=${S}/build/lib ${python} \
- tools/buildhtml.py --config=tools/docutils.conf
-}
-
-
-install_txt_doc() {
- local doc=${1}
- local dir="txt/$(dirname ${doc})"
- docinto ${dir}
- dodoc ${doc}
-}
-
-src_install() {
- mydoc="MANIFEST.in *.txt"
- distutils_src_install
- # Tools
- cd ${S}/tools
- for tool in *.py
- do
- newbin ${tool} docutils-${tool}
- done
- # Docs
- cd ${S}
- dohtml -r docs spec tools
- for doc in $(find docs spec tools -name '*.txt')
- do
- install_txt_doc $doc
- done
- # Gentoo GLEP tools
- newbin ${FILESDIR}/glep.py docutils-glep.py
- distutils_python_version
- insinto /usr/lib/python${PYVER}/site-packages/docutils/readers
- newins ${FILESDIR}/glepread.py glep.py
- insinto /usr/lib/python${PYVER}/site-packages/docutils/transforms
- newins ${FILESDIR}/glepstrans.py gleps.py
- insinto /usr/lib/python${PYVER}/site-packages/docutils/writers
- newins ${FILESDIR}/glep_htmlwrite.py glep_html.py
-}
-
+++ /dev/null
-MD5 d8c78dd09610055431ac8df30312bdb9 docutils-0.3.tar.gz 485575
+++ /dev/null
-MD5 e2ee36b7e878cb53fcee564aaba1f067 docutils-0.3.3-alpha.tar.gz 539340
+++ /dev/null
-MD5 fe067d12639ff29d2e307d36a52fcfe0 docutils-0.3_pre20030530.tgz 460854
+++ /dev/null
---- docutils-0.3/setup.py 2003-06-25 02:47:04.000000000 +0100
-+++ docutils-0.3/setup.py.new 2003-07-08 00:21:59.000000000 +0100
-@@ -78,20 +78,15 @@
- List of (module name, minimum __version__ string, [attribute names])."""
-
- def get_extras():
-- extras = []
-- for module_name, version, attributes in extra_modules:
-- try:
-- module = __import__(module_name)
-- if version and module.__version__ < version:
-- raise ValueError
-- for attribute in attributes or []:
-- getattr(module, attribute)
-- print ('"%s" module already present; ignoring extras/%s.py.'
-- % (module_name, module_name))
-- except (ImportError, AttributeError, ValueError):
-- extras.append(module_name)
-- return extras
--
-+ # old method does not work for upgrading/downgrading docutils.
-+ # so we use a simple rule, 'optparse' and 'textwrap' are not installed
-+ # for >=python-2.3
-+
-+ pyver = sys.version_info
-+ if pyver[0] == 2 and pyver[1] > 2:
-+ return ["roman"]
-+ else:
-+ return ["optparse","textwrap","roman"]
-
- class dual_build_py(build_py):
-
+++ /dev/null
---- docutils-0.3.3/setup.py 2003-06-25 02:47:04.000000000 +0100
-+++ docutils-0.3.3/setup.py.new 2003-07-08 00:21:59.000000000 +0100
-@@ -78,20 +78,15 @@
- List of (module name, minimum __version__ string, [attribute names])."""
-
- def get_extras():
-- extras = []
-- for module_name, version, attributes in extra_modules:
-- try:
-- module = __import__(module_name)
-- if version and module.__version__ < version:
-- raise ValueError
-- for attribute in attributes or []:
-- getattr(module, attribute)
-- print ('"%s" module already present; ignoring extras/%s.py.'
-- % (module_name, module_name))
-- except (ImportError, AttributeError, ValueError):
-- extras.append(module_name)
-- return extras
--
-+ # old method does not work for upgrading/downgrading docutils.
-+ # so we use a simple rule, 'optparse' and 'textwrap' are not installed
-+ # for >=python-2.3
-+
-+ pyver = sys.version_info
-+ if pyver[0] == 2 and pyver[1] > 2:
-+ return ["roman"]
-+ else:
-+ return ["optparse","textwrap","roman"]
-
- class dual_build_py(build_py):
-
+++ /dev/null
-#!/usr/bin/env python
-
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2003/07/07 23:39:10 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-A minimal front end to the Docutils Publisher, producing HTML from PEP
-(Python Enhancement Proposal) documents.
-"""
-
-import locale
-try:
- locale.setlocale(locale.LC_ALL, '')
-except:
- pass
-
-from docutils.core import publish_cmdline, default_description
-
-
-description = ('Generates (X)HTML from reStructuredText-format PEP files. '
- + default_description)
-
-publish_cmdline(reader_name='glep', writer_name='glep_html',
- description=description)
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2003/07/07 23:39:10 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-PEP HTML Writer.
-"""
-
-__docformat__ = 'reStructuredText'
-
-
-import sys
-import docutils
-from docutils import nodes, frontend, utils
-from docutils.writers import html4css1
-
-class Writer(html4css1.Writer):
-
- settings_spec = html4css1.Writer.settings_spec + (
- 'PEP/HTML-Specific Options',
- 'The HTML --footnote-references option is set to "brackets" by '
- 'default.',
- (('Specify a PEP stylesheet URL, used verbatim. Default is '
- '--stylesheet\'s value. If given, --pep-stylesheet overrides '
- '--stylesheet.',
- ['--pep-stylesheet'],
- {'metavar': '<URL>'}),
- ('Specify a PEP stylesheet file, relative to the current working '
- 'directory. The path is adjusted relative to the output HTML '
- 'file. Overrides --pep-stylesheet and --stylesheet-path.',
- ['--pep-stylesheet-path'],
- {'metavar': '<path>'}),
- ('Specify a template file. Default is "pep-html-template".',
- ['--pep-template'],
- {'default': 'pep-html-template', 'metavar': '<file>'}),
- ('Python\'s home URL. Default is ".." (parent directory).',
- ['--python-home'],
- {'default': '..', 'metavar': '<URL>'}),
- ('Home URL prefix for PEPs. Default is "." (current directory).',
- ['--pep-home'],
- {'default': '.', 'metavar': '<URL>'}),
- # Workaround for SourceForge's broken Python
- # (``import random`` causes a segfault).
- (frontend.SUPPRESS_HELP,
- ['--no-random'], {'action': 'store_true'}),))
-
- settings_default_overrides = {'footnote_references': 'brackets'}
-
- relative_path_settings = ('pep_stylesheet_path', 'pep_template')
-
- def __init__(self):
- html4css1.Writer.__init__(self)
- self.translator_class = HTMLTranslator
-
- def translate(self):
- html4css1.Writer.translate(self)
- settings = self.document.settings
- template = open(settings.pep_template).read()
- # Substitutions dict for template:
- subs = {}
- subs['encoding'] = settings.output_encoding
- subs['version'] = docutils.__version__
- subs['stylesheet'] = ''.join(self.stylesheet)
- pyhome = settings.python_home
- subs['pyhome'] = pyhome
- subs['pephome'] = settings.pep_home
- if pyhome == '..':
- subs['pepindex'] = '.'
- else:
- subs['pepindex'] = 'http://www.gentoo.org/proj/en/glep'
- index = self.document.first_child_matching_class(nodes.field_list)
- header = self.document[index]
- pepnum = header[0][1].astext()
- subs['pep'] = pepnum
- if settings.no_random:
- subs['banner'] = 0
- else:
- import random
- subs['banner'] = random.randrange(64)
- try:
- subs['pepnum'] = '%04i' % int(pepnum)
- except:
- subs['pepnum'] = pepnum
- subs['title'] = header[1][1].astext()
- subs['body'] = ''.join(
- self.body_pre_docinfo + self.docinfo + self.body)
- subs['body_suffix'] = ''.join(self.body_suffix)
- self.output = template % subs
-
-
-class HTMLTranslator(html4css1.HTMLTranslator):
-
- def get_stylesheet_reference(self, relative_to=None):
- settings = self.settings
- if relative_to == None:
- relative_to = settings._destination
- if settings.pep_stylesheet_path:
- return utils.relative_path(relative_to,
- settings.pep_stylesheet_path)
- elif settings.pep_stylesheet:
- return settings.pep_stylesheet
- elif settings._stylesheet_path:
- return utils.relative_path(relative_to, settings.stylesheet_path)
- else:
- return settings.stylesheet
-
- def depart_field_list(self, node):
- html4css1.HTMLTranslator.depart_field_list(self, node)
- if node.get('class') == 'rfc2822':
- self.body.append('<hr />\n')
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2003/07/07 23:39:10 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-Gentoo Linux Enhancement Proposal (GLEP) Reader.
-"""
-
-__docformat__ = 'reStructuredText'
-
-
-import sys
-import os
-import re
-from docutils import nodes
-from docutils.readers import standalone
-from docutils.transforms import gleps, references
-from docutils.parsers import rst
-
-
-class Reader(standalone.Reader):
-
- supported = ('glep',)
- """Contexts this reader supports."""
-
- settings_spec = (
- 'PEP Reader Option Defaults',
- 'The --pep-references and --rfc-references options (for the '
- 'reStructuredText parser) are on by default.',
- ())
-
- default_transforms = (references.Substitutions,
- gleps.Headers,
- gleps.Contents,
- references.ChainedTargets,
- references.AnonymousHyperlinks,
- references.IndirectHyperlinks,
- gleps.TargetNotes,
- references.Footnotes,
- references.ExternalTargets,
- references.InternalTargets,)
-
- settings_default_overrides = {'pep_references': 1, 'rfc_references': 1}
-
- inliner_class = rst.states.Inliner
-
- def __init__(self, parser=None, parser_name=None):
- """`parser` should be ``None``."""
- if parser is None:
- parser = rst.Parser(rfc2822=1, inliner=self.inliner_class())
- standalone.Reader.__init__(self, parser, '')
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.2 $
-# Date: $Date: 2003/07/29 00:15:37 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-Transforms for GLEP processing.
-
-- `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a
- field list, but some entries get processed.
-- `Contents`: Auto-inserts a table of contents.
-"""
-
-__docformat__ = 'reStructuredText'
-
-import sys
-import os
-import re
-import time
-from docutils import nodes, utils
-from docutils import ApplicationError, DataError
-from docutils.transforms import Transform, TransformError
-from docutils.transforms import parts, references, misc
-
-
-class Headers(Transform):
-
- """
- Process fields in a GLEP's initial RFC-2822 header.
- """
-
- default_priority = 360
-
- pep_url = 'glep-%04d.html'
- pep_cvs_url = ('http://www.gentoo.org/cgi-bin/viewcvs.cgi/'
- 'xml/htdocs/proj/en/glep/glep-%04d.txt?cvsroot=gentoo')
- rcs_keyword_substitutions = (
- (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'),
- (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),)
-
- def apply(self):
- if not len(self.document):
- # @@@ replace these DataErrors with proper system messages
- raise DataError('Document tree is empty.')
- header = self.document[0]
- if not isinstance(header, nodes.field_list) or \
- header.get('class') != 'rfc2822':
- raise DataError('Document does not begin with an RFC-2822 '
- 'header; it is not a PEP.')
- pep = None
- for field in header:
- if field[0].astext().lower() == 'glep': # should be the first field
- value = field[1].astext()
- try:
- pep = int(value)
- cvs_url = self.pep_cvs_url % pep
- except ValueError:
- pep = value
- cvs_url = None
- msg = self.document.reporter.warning(
- '"GLEP" header must contain an integer; "%s" is an '
- 'invalid value.' % pep, base_node=field)
- msgid = self.document.set_id(msg)
- prb = nodes.problematic(value, value or '(none)',
- refid=msgid)
- prbid = self.document.set_id(prb)
- msg.add_backref(prbid)
- if len(field[1]):
- field[1][0][:] = [prb]
- else:
- field[1] += nodes.paragraph('', '', prb)
- break
- if pep is None:
- raise DataError('Document does not contain an RFC-2822 "GLEP" '
- 'header.')
- if pep == 0:
- # Special processing for PEP 0.
- pending = nodes.pending(PEPZero)
- self.document.insert(1, pending)
- self.document.note_pending(pending)
- if len(header) < 2 or header[1][0].astext().lower() != 'title':
- raise DataError('No title!')
- for field in header:
- name = field[0].astext().lower()
- body = field[1]
- if len(body) > 1:
- raise DataError('GLEP header field body contains multiple '
- 'elements:\n%s' % field.pformat(level=1))
- elif len(body) == 1:
- if not isinstance(body[0], nodes.paragraph):
- raise DataError('GLEP header field body may only contain '
- 'a single paragraph:\n%s'
- % field.pformat(level=1))
- elif name == 'last-modified':
- date = time.strftime(
- '%d-%b-%Y',
- time.localtime(os.stat(self.document['source'])[8]))
- if cvs_url:
- body += nodes.paragraph(
- '', '', nodes.reference('', date, refuri=cvs_url))
- else:
- # empty
- continue
- para = body[0]
- if name == 'author':
- for node in para:
- if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node))
- elif name == 'discussions-to':
- for node in para:
- if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node, pep))
- elif name in ('replaces', 'replaced-by', 'requires'):
- newbody = []
- space = nodes.Text(' ')
- for refpep in re.split(',?\s+', body.astext()):
- pepno = int(refpep)
- newbody.append(nodes.reference(
- refpep, refpep, refuri=self.pep_url % pepno))
- newbody.append(space)
- para[:] = newbody[:-1] # drop trailing space
- elif name == 'last-modified':
- utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
- if cvs_url:
- date = para.astext()
- para[:] = [nodes.reference('', date, refuri=cvs_url)]
- elif name == 'content-type':
- pep_type = para.astext()
- uri = self.pep_url % 2
- para[:] = [nodes.reference('', pep_type, refuri=uri)]
- elif name == 'version' and len(body):
- utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
-
-
-class Contents(Transform):
-
- """
- Insert a table of contents transform placeholder into the document after
- the RFC 2822 header.
- """
-
- default_priority = 380
-
- def apply(self):
- pending = nodes.pending(parts.Contents, {'title': None})
- self.document.insert(1, pending)
- self.document.note_pending(pending)
-
-
-class TargetNotes(Transform):
-
- """
- Locate the "References" section, insert a placeholder for an external
- target footnote insertion transform at the end, and schedule the
- transform to run immediately.
- """
-
- default_priority = 520
-
- def apply(self):
- doc = self.document
- i = len(doc) - 1
- refsect = copyright = None
- while i >= 0 and isinstance(doc[i], nodes.section):
- title_words = doc[i][0].astext().lower().split()
- if 'references' in title_words:
- refsect = doc[i]
- break
- elif 'copyright' in title_words:
- copyright = i
- i -= 1
- if not refsect:
- refsect = nodes.section()
- refsect += nodes.title('', 'References')
- doc.set_id(refsect)
- if copyright:
- # Put the new "References" section before "Copyright":
- doc.insert(copyright, refsect)
- else:
- # Put the new "References" section at end of doc:
- doc.append(refsect)
- pending = nodes.pending(references.TargetNotes)
- refsect.append(pending)
- self.document.note_pending(pending, 0)
- pending = nodes.pending(misc.CallBack,
- details={'callback': self.cleanup_callback})
- refsect.append(pending)
- self.document.note_pending(pending, 1)
-
- def cleanup_callback(self, pending):
- """
- Remove an empty "References" section.
-
- Called after the `references.TargetNotes` transform is complete.
- """
- if len(pending.parent) == 2: # <title> and <pending>
- pending.parent.parent.remove(pending.parent)
-
-
-class PEPZero(Transform):
-
- """
- Special processing for PEP 0.
- """
-
- default_priority =760
-
- def apply(self):
- visitor = PEPZeroSpecial(self.document)
- self.document.walk(visitor)
- self.startnode.parent.remove(self.startnode)
-
-
-class PEPZeroSpecial(nodes.SparseNodeVisitor):
-
- """
- Perform the special processing needed by PEP 0:
-
- - Mask email addresses.
-
- - Link PEP numbers in the second column of 4-column tables to the PEPs
- themselves.
- """
-
- pep_url = Headers.pep_url
-
- def unknown_visit(self, node):
- pass
-
- def visit_reference(self, node):
- node.parent.replace(node, mask_email(node))
-
- def visit_field_list(self, node):
- if node.hasattr('class') and node['class'] == 'rfc2822':
- raise nodes.SkipNode
-
- def visit_tgroup(self, node):
- self.pep_table = node['cols'] == 4
- self.entry = 0
-
- def visit_colspec(self, node):
- self.entry += 1
- if self.pep_table and self.entry == 2:
- node['class'] = 'num'
-
- def visit_row(self, node):
- self.entry = 0
-
- def visit_entry(self, node):
- self.entry += 1
- if self.pep_table and self.entry == 2 and len(node) == 1:
- node['class'] = 'num'
- p = node[0]
- if isinstance(p, nodes.paragraph) and len(p) == 1:
- text = p.astext()
- try:
- pep = int(text)
- ref = self.pep_url % pep
- p[0] = nodes.reference(text, text, refuri=ref)
- except ValueError:
- pass
-
-
-non_masked_addresses = ('peps@python.org',
- 'python-list@python.org',
- 'python-dev@python.org')
-
-def mask_email(ref, pepno=None):
- """
- Mask the email address in `ref` and return a replacement node.
-
- `ref` is returned unchanged if it contains no email address.
-
- For email addresses such as "user@host", mask the address as "user at
- host" (text) to thwart simple email address harvesters (except for those
- listed in `non_masked_addresses`). If a PEP number (`pepno`) is given,
- return a reference including a default email subject.
- """
- if ref.hasattr('refuri') and ref['refuri'].startswith('mailto:'):
- if ref['refuri'][8:] in non_masked_addresses:
- replacement = ref[0]
- else:
- replacement_text = ref.astext().replace('@', ' at ')
- replacement = nodes.raw('', replacement_text, format='html')
- if pepno is None:
- return replacement
- else:
- ref['refuri'] += '?subject=PEP%%20%s' % pepno
- ref[:] = [replacement]
- return ref
- else:
- return ref
+++ /dev/null
-#!/usr/bin/env python
-
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2004/07/20 18:23:59 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-A minimal front end to the Docutils Publisher, producing HTML from PEP
-(Python Enhancement Proposal) documents.
-"""
-
-import locale
-try:
- locale.setlocale(locale.LC_ALL, '')
-except:
- pass
-
-from docutils.core import publish_cmdline, default_description
-
-
-description = ('Generates (X)HTML from reStructuredText-format PEP files. '
- + default_description)
-
-publish_cmdline(reader_name='glep', writer_name='glep_html',
- description=description)
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2004/07/20 18:23:59 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-PEP HTML Writer.
-"""
-
-__docformat__ = 'reStructuredText'
-
-
-import sys
-import docutils
-from docutils import frontend, nodes, utils
-from docutils.writers import html4css1
-
-
-class Writer(html4css1.Writer):
-
- settings_spec = html4css1.Writer.settings_spec + (
- 'PEP/HTML-Specific Options',
- """The HTML --footnote-references option's default is set to """
- '"brackets".',
- (('Specify a template file. Default is "pep-html-template".',
- ['--template'],
- {'default': 'pep-html-template', 'metavar': '<file>'}),
- ('Python\'s home URL. Default is ".." (parent directory).',
- ['--python-home'],
- {'default': '..', 'metavar': '<URL>'}),
- ('Home URL prefix for PEPs. Default is "." (current directory).',
- ['--pep-home'],
- {'default': '.', 'metavar': '<URL>'}),
- # Workaround for SourceForge's broken Python
- # (``import random`` causes a segfault).
- (frontend.SUPPRESS_HELP,
- ['--no-random'],
- {'action': 'store_true', 'validator': frontend.validate_boolean}),))
-
- settings_default_overrides = {'footnote_references': 'brackets'}
-
- relative_path_settings = (html4css1.Writer.relative_path_settings
- + ('template',))
-
- config_section = 'pep_html writer'
- config_section_dependencies = ('writers', 'html4css1 writer')
-
- def __init__(self):
- html4css1.Writer.__init__(self)
- self.translator_class = HTMLTranslator
-
- def translate(self):
- html4css1.Writer.translate(self)
- settings = self.document.settings
- template = open(settings.template).read()
- # Substitutions dict for template:
- subs = {}
- subs['encoding'] = settings.output_encoding
- subs['version'] = docutils.__version__
- subs['stylesheet'] = ''.join(self.stylesheet)
- pyhome = settings.python_home
- subs['pyhome'] = pyhome
- subs['pephome'] = settings.pep_home
- if pyhome == '..':
- subs['pepindex'] = '.'
- else:
- subs['pepindex'] = 'http://www.gentoo.org/proj/en/glep'
- index = self.document.first_child_matching_class(nodes.field_list)
- header = self.document[index]
- pepnum = header[0][1].astext()
- subs['pep'] = pepnum
- if settings.no_random:
- subs['banner'] = 0
- else:
- import random
- subs['banner'] = random.randrange(64)
- try:
- subs['pepnum'] = '%04i' % int(pepnum)
- except:
- subs['pepnum'] = pepnum
- subs['title'] = header[1][1].astext()
- subs['body'] = ''.join(
- self.body_pre_docinfo + self.docinfo + self.body)
- subs['body_suffix'] = ''.join(self.body_suffix)
- self.output = template % subs
-
-
-class HTMLTranslator(html4css1.HTMLTranslator):
-
- def depart_field_list(self, node):
- html4css1.HTMLTranslator.depart_field_list(self, node)
- if node.get('class') == 'rfc2822':
- self.body.append('<hr />\n')
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2004/07/20 18:23:59 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-Gentoo Linux Enhancement Proposal (GLEP) Reader.
-"""
-
-__docformat__ = 'reStructuredText'
-
-
-from docutils.readers import standalone
-from docutils.transforms import gleps, references
-from docutils.parsers import rst
-
-
-class Inliner(rst.states.Inliner):
-
- """
- Extend `rst.Inliner` for local PEP references.
- """
-
- pep_url = rst.states.Inliner.pep_url_local
-
-
-class Reader(standalone.Reader):
-
- supported = ('glep',)
- """Contexts this reader supports."""
-
- settings_spec = (
- 'PEP Reader Option Defaults',
- 'The --pep-references and --rfc-references options (for the '
- 'reStructuredText parser) are on by default.',
- ())
-
- config_section = 'pep reader'
- config_section_dependencies = ('readers', 'standalone reader')
-
- default_transforms = (references.Substitutions,
- gleps.Headers,
- gleps.Contents,
- references.ChainedTargets,
- references.AnonymousHyperlinks,
- references.IndirectHyperlinks,
- gleps.TargetNotes,
- references.Footnotes,
- references.ExternalTargets,
- references.InternalTargets,)
-
- settings_default_overrides = {'pep_references': 1, 'rfc_references': 1}
-
- inliner_class = Inliner
-
- def __init__(self, parser=None, parser_name=None):
- """`parser` should be ``None``."""
- if parser is None:
- parser = rst.Parser(rfc2822=1, inliner=self.inliner_class())
- standalone.Reader.__init__(self, parser, '')
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2004/07/20 18:23:59 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-Transforms for PEP processing.
-
-- `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a
- field list, but some entries get processed.
-- `Contents`: Auto-inserts a table of contents.
-- `PEPZero`: Special processing for PEP 0.
-"""
-
-__docformat__ = 'reStructuredText'
-
-import sys
-import os
-import re
-import time
-from docutils import nodes, utils, languages
-from docutils import ApplicationError, DataError
-from docutils.transforms import Transform, TransformError
-from docutils.transforms import parts, references, misc
-
-
-class Headers(Transform):
-
- """
- Process fields in a GLEP's initial RFC-2822 header.
- """
-
- default_priority = 360
-
- pep_url = 'glep-%04d.html'
- pep_cvs_url = ('http://www.gentoo.org/cgi-bin/viewcvs/'
- 'xml/htdocs/proj/en/glep/glep-%04d.txt?cvsroot=gentoo')
- rcs_keyword_substitutions = (
- (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'),
- (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),)
-
- def apply(self):
- if not len(self.document):
- # @@@ replace these DataErrors with proper system messages
- raise DataError('Document tree is empty.')
- header = self.document[0]
- if not isinstance(header, nodes.field_list) or \
- header.get('class') != 'rfc2822':
- raise DataError('Document does not begin with an RFC-2822 '
- 'header; it is not a GLEP.')
- pep = None
- for field in header:
- if field[0].astext().lower() == 'glep': # should be the first field
- value = field[1].astext()
- try:
- pep = int(value)
- cvs_url = self.pep_cvs_url % pep
- except ValueError:
- pep = value
- cvs_url = None
- msg = self.document.reporter.warning(
- '"GLEP" header must contain an integer; "%s" is an '
- 'invalid value.' % pep, base_node=field)
- msgid = self.document.set_id(msg)
- prb = nodes.problematic(value, value or '(none)',
- refid=msgid)
- prbid = self.document.set_id(prb)
- msg.add_backref(prbid)
- if len(field[1]):
- field[1][0][:] = [prb]
- else:
- field[1] += nodes.paragraph('', '', prb)
- break
- if pep is None:
- raise DataError('Document does not contain an RFC-2822 "GLEP" '
- 'header.')
- if pep == 0:
- # Special processing for PEP 0.
- pending = nodes.pending(PEPZero)
- self.document.insert(1, pending)
- self.document.note_pending(pending)
- if len(header) < 2 or header[1][0].astext().lower() != 'title':
- raise DataError('No title!')
- for field in header:
- name = field[0].astext().lower()
- body = field[1]
- if len(body) > 1:
- raise DataError('GLEP header field body contains multiple '
- 'elements:\n%s' % field.pformat(level=1))
- elif len(body) == 1:
- if not isinstance(body[0], nodes.paragraph):
- raise DataError('GLEP header field body may only contain '
- 'a single paragraph:\n%s'
- % field.pformat(level=1))
- elif name == 'last-modified':
- date = time.strftime(
- '%d-%b-%Y',
- time.localtime(os.stat(self.document['source'])[8]))
- if cvs_url:
- body += nodes.paragraph(
- '', '', nodes.reference('', date, refuri=cvs_url))
- else:
- # empty
- continue
- para = body[0]
- if name == 'author':
- for node in para:
- if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node))
- elif name == 'discussions-to':
- for node in para:
- if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node, pep))
- elif name in ('replaces', 'replaced-by', 'requires'):
- newbody = []
- space = nodes.Text(' ')
- for refpep in re.split(',?\s+', body.astext()):
- pepno = int(refpep)
- newbody.append(nodes.reference(
- refpep, refpep, refuri=self.pep_url % pepno))
- newbody.append(space)
- para[:] = newbody[:-1] # drop trailing space
- elif name == 'last-modified':
- utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
- if cvs_url:
- date = para.astext()
- para[:] = [nodes.reference('', date, refuri=cvs_url)]
- elif name == 'content-type':
- pep_type = para.astext()
- uri = self.pep_url % 12
- para[:] = [nodes.reference('', pep_type, refuri=uri)]
- elif name == 'version' and len(body):
- utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
-
-
-class Contents(Transform):
-
- """
- Insert an empty table of contents topic and a transform placeholder into
- the document after the RFC 2822 header.
- """
-
- default_priority = 380
-
- def apply(self):
- language = languages.get_language(self.document.settings.language_code)
- name = language.labels['contents']
- title = nodes.title('', name)
- topic = nodes.topic('', title, CLASS='contents')
- name = nodes.fully_normalize_name(name)
- if not self.document.has_name(name):
- topic['name'] = name
- self.document.note_implicit_target(topic)
- pending = nodes.pending(parts.Contents)
- topic += pending
- self.document.insert(1, topic)
- self.document.note_pending(pending)
-
-
-class TargetNotes(Transform):
-
- """
- Locate the "References" section, insert a placeholder for an external
- target footnote insertion transform at the end, and schedule the
- transform to run immediately.
- """
-
- default_priority = 520
-
- def apply(self):
- doc = self.document
- i = len(doc) - 1
- refsect = copyright = None
- while i >= 0 and isinstance(doc[i], nodes.section):
- title_words = doc[i][0].astext().lower().split()
- if 'references' in title_words:
- refsect = doc[i]
- break
- elif 'copyright' in title_words:
- copyright = i
- i -= 1
- if not refsect:
- refsect = nodes.section()
- refsect += nodes.title('', 'References')
- doc.set_id(refsect)
- if copyright:
- # Put the new "References" section before "Copyright":
- doc.insert(copyright, refsect)
- else:
- # Put the new "References" section at end of doc:
- doc.append(refsect)
- pending = nodes.pending(references.TargetNotes)
- refsect.append(pending)
- self.document.note_pending(pending, 0)
- pending = nodes.pending(misc.CallBack,
- details={'callback': self.cleanup_callback})
- refsect.append(pending)
- self.document.note_pending(pending, 1)
-
- def cleanup_callback(self, pending):
- """
- Remove an empty "References" section.
-
- Called after the `references.TargetNotes` transform is complete.
- """
- if len(pending.parent) == 2: # <title> and <pending>
- pending.parent.parent.remove(pending.parent)
-
-
-class PEPZero(Transform):
-
- """
- Special processing for PEP 0.
- """
-
- default_priority =760
-
- def apply(self):
- visitor = PEPZeroSpecial(self.document)
- self.document.walk(visitor)
- self.startnode.parent.remove(self.startnode)
-
-
-class PEPZeroSpecial(nodes.SparseNodeVisitor):
-
- """
- Perform the special processing needed by PEP 0:
-
- - Mask email addresses.
-
- - Link PEP numbers in the second column of 4-column tables to the PEPs
- themselves.
- """
-
- pep_url = Headers.pep_url
-
- def unknown_visit(self, node):
- pass
-
- def visit_reference(self, node):
- node.parent.replace(node, mask_email(node))
-
- def visit_field_list(self, node):
- if node.hasattr('class') and node['class'] == 'rfc2822':
- raise nodes.SkipNode
-
- def visit_tgroup(self, node):
- self.pep_table = node['cols'] == 4
- self.entry = 0
-
- def visit_colspec(self, node):
- self.entry += 1
- if self.pep_table and self.entry == 2:
- node['class'] = 'num'
-
- def visit_row(self, node):
- self.entry = 0
-
- def visit_entry(self, node):
- self.entry += 1
- if self.pep_table and self.entry == 2 and len(node) == 1:
- node['class'] = 'num'
- p = node[0]
- if isinstance(p, nodes.paragraph) and len(p) == 1:
- text = p.astext()
- try:
- pep = int(text)
- ref = self.pep_url % pep
- p[0] = nodes.reference(text, text, refuri=ref)
- except ValueError:
- pass
-
-
-non_masked_addresses = ('peps@python.org',
- 'python-list@python.org',
- 'python-dev@python.org')
-
-def mask_email(ref, pepno=None):
- """
- Mask the email address in `ref` and return a replacement node.
-
- `ref` is returned unchanged if it contains no email address.
-
- For email addresses such as "user@host", mask the address as "user at
- host" (text) to thwart simple email address harvesters (except for those
- listed in `non_masked_addresses`). If a PEP number (`pepno`) is given,
- return a reference including a default email subject.
- """
- if ref.hasattr('refuri') and ref['refuri'].startswith('mailto:'):
- if ref['refuri'][8:] in non_masked_addresses:
- replacement = ref[0]
- else:
- replacement_text = ref.astext().replace('@', ' at ')
- replacement = nodes.raw('', replacement_text, format='html')
- if pepno is None:
- return replacement
- else:
- ref['refuri'] += '?subject=PEP%%20%s' % pepno
- ref[:] = [replacement]
- return ref
- else:
- return ref
+++ /dev/null
-#!/usr/bin/env python
-
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2003/06/01 03:57:44 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-A minimal front end to the Docutils Publisher, producing HTML from PEP
-(Python Enhancement Proposal) documents.
-"""
-
-import locale
-try:
- locale.setlocale(locale.LC_ALL, '')
-except:
- pass
-
-from docutils.core import publish_cmdline, default_description
-
-
-description = ('Generates (X)HTML from reStructuredText-format PEP files. '
- + default_description)
-
-publish_cmdline(reader_name='glep', writer_name='glep_html',
- description=description)
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.3 $
-# Date: $Date: 2003/06/04 19:39:20 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-PEP HTML Writer.
-"""
-
-__docformat__ = 'reStructuredText'
-
-
-import sys
-import docutils
-from docutils import nodes, optik, utils
-from docutils.writers import html4css1
-
-class Writer(html4css1.Writer):
-
- settings_spec = html4css1.Writer.settings_spec + (
- 'PEP/HTML-Specific Options',
- 'The HTML --footnote-references option is set to "brackets" by '
- 'default.',
- (('Specify a PEP stylesheet URL, used verbatim. Default is '
- '--stylesheet\'s value. If given, --pep-stylesheet overrides '
- '--stylesheet.',
- ['--pep-stylesheet'],
- {'metavar': '<URL>'}),
- ('Specify a PEP stylesheet file, relative to the current working '
- 'directory. The path is adjusted relative to the output HTML '
- 'file. Overrides --pep-stylesheet and --stylesheet-path.',
- ['--pep-stylesheet-path'],
- {'metavar': '<path>'}),
- ('Specify a template file. Default is "pep-html-template".',
- ['--pep-template'],
- {'default': 'pep-html-template', 'metavar': '<file>'}),
- ('Python\'s home URL. Default is ".." (parent directory).',
- ['--python-home'],
- {'default': '..', 'metavar': '<URL>'}),
- ('Home URL prefix for PEPs. Default is "." (current directory).',
- ['--pep-home'],
- {'default': '.', 'metavar': '<URL>'}),
- # Workaround for SourceForge's broken Python
- # (``import random`` causes a segfault).
- (optik.SUPPRESS_HELP,
- ['--no-random'], {'action': 'store_true'}),))
-
- settings_default_overrides = {'footnote_references': 'brackets'}
-
- relative_path_settings = ('pep_stylesheet_path', 'pep_template')
-
- def __init__(self):
- html4css1.Writer.__init__(self)
- self.translator_class = HTMLTranslator
-
- def translate(self):
- html4css1.Writer.translate(self)
- settings = self.document.settings
- template = open(settings.pep_template).read()
- # Substitutions dict for template:
- subs = {}
- subs['encoding'] = settings.output_encoding
- subs['version'] = docutils.__version__
- subs['stylesheet'] = ''.join(self.stylesheet)
- pyhome = settings.python_home
- subs['pyhome'] = pyhome
- subs['pephome'] = settings.pep_home
- if pyhome == '..':
- subs['pepindex'] = '.'
- else:
- subs['pepindex'] = 'http://www.gentoo.org/proj/en/glep'
- index = self.document.first_child_matching_class(nodes.field_list)
- header = self.document[index]
- pepnum = header[0][1].astext()
- subs['pep'] = pepnum
- if settings.no_random:
- subs['banner'] = 0
- else:
- import random
- subs['banner'] = random.randrange(64)
- try:
- subs['pepnum'] = '%04i' % int(pepnum)
- except:
- subs['pepnum'] = pepnum
- subs['title'] = header[1][1].astext()
- subs['body'] = ''.join(
- self.body_pre_docinfo + self.docinfo + self.body)
- subs['body_suffix'] = ''.join(self.body_suffix)
- self.output = template % subs
-
-
-class HTMLTranslator(html4css1.HTMLTranslator):
-
- def get_stylesheet_reference(self, relative_to=None):
- settings = self.settings
- if relative_to == None:
- relative_to = settings._destination
- if settings.pep_stylesheet_path:
- return utils.relative_path(relative_to,
- settings.pep_stylesheet_path)
- elif settings.pep_stylesheet:
- return settings.pep_stylesheet
- elif settings._stylesheet_path:
- return utils.relative_path(relative_to, settings.stylesheet_path)
- else:
- return settings.stylesheet
-
- def depart_field_list(self, node):
- html4css1.HTMLTranslator.depart_field_list(self, node)
- if node.get('class') == 'rfc2822':
- self.body.append('<hr />\n')
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.1 $
-# Date: $Date: 2003/06/01 03:57:44 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-Gentoo Linux Enhancement Proposal (GLEP) Reader.
-"""
-
-__docformat__ = 'reStructuredText'
-
-
-import sys
-import os
-import re
-from docutils import nodes
-from docutils.readers import standalone
-from docutils.transforms import gleps, references
-from docutils.parsers import rst
-
-
-class Reader(standalone.Reader):
-
- supported = ('glep',)
- """Contexts this reader supports."""
-
- settings_spec = (
- 'PEP Reader Option Defaults',
- 'The --pep-references and --rfc-references options (for the '
- 'reStructuredText parser) are on by default.',
- ())
-
- default_transforms = (references.Substitutions,
- gleps.Headers,
- gleps.Contents,
- references.ChainedTargets,
- references.AnonymousHyperlinks,
- references.IndirectHyperlinks,
- gleps.TargetNotes,
- references.Footnotes,
- references.ExternalTargets,
- references.InternalTargets,)
-
- settings_default_overrides = {'pep_references': 1, 'rfc_references': 1}
-
- inliner_class = rst.states.Inliner
-
- def __init__(self, parser=None, parser_name=None):
- """`parser` should be ``None``."""
- if parser is None:
- parser = rst.Parser(rfc2822=1, inliner=self.inliner_class())
- standalone.Reader.__init__(self, parser, '')
+++ /dev/null
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
-# Revision: $Revision: 1.2 $
-# Date: $Date: 2003/06/04 19:39:20 $
-# Copyright: This module has been placed in the public domain.
-
-"""
-Transforms for GLEP processing.
-
-- `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a
- field list, but some entries get processed.
-- `Contents`: Auto-inserts a table of contents.
-"""
-
-__docformat__ = 'reStructuredText'
-
-import sys
-import os
-import re
-import time
-from docutils import nodes, utils
-from docutils import ApplicationError, DataError
-from docutils.transforms import Transform, TransformError
-from docutils.transforms import parts, references, misc
-
-
-class Headers(Transform):
-
- """
- Process fields in a GLEP's initial RFC-2822 header.
- """
-
- default_priority = 360
-
- pep_url = 'glep-%04d.html'
- pep_cvs_url = ('http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo/'
- 'xml/htdocs/proj/en/glep/glep-%04d.txt')
- rcs_keyword_substitutions = (
- (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'),
- (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),)
-
- def apply(self):
- if not len(self.document):
- # @@@ replace these DataErrors with proper system messages
- raise DataError('Document tree is empty.')
- header = self.document[0]
- if not isinstance(header, nodes.field_list) or \
- header.get('class') != 'rfc2822':
- raise DataError('Document does not begin with an RFC-2822 '
- 'header; it is not a PEP.')
- pep = None
- for field in header:
- if field[0].astext().lower() == 'glep': # should be the first field
- value = field[1].astext()
- try:
- pep = int(value)
- cvs_url = self.pep_cvs_url % pep
- except ValueError:
- pep = value
- cvs_url = None
- msg = self.document.reporter.warning(
- '"GLEP" header must contain an integer; "%s" is an '
- 'invalid value.' % pep, base_node=field)
- msgid = self.document.set_id(msg)
- prb = nodes.problematic(value, value or '(none)',
- refid=msgid)
- prbid = self.document.set_id(prb)
- msg.add_backref(prbid)
- if len(field[1]):
- field[1][0][:] = [prb]
- else:
- field[1] += nodes.paragraph('', '', prb)
- break
- if pep is None:
- raise DataError('Document does not contain an RFC-2822 "GLEP" '
- 'header.')
- if pep == 0:
- # Special processing for PEP 0.
- pending = nodes.pending(PEPZero)
- self.document.insert(1, pending)
- self.document.note_pending(pending)
- if len(header) < 2 or header[1][0].astext().lower() != 'title':
- raise DataError('No title!')
- for field in header:
- name = field[0].astext().lower()
- body = field[1]
- if len(body) > 1:
- raise DataError('GLEP header field body contains multiple '
- 'elements:\n%s' % field.pformat(level=1))
- elif len(body) == 1:
- if not isinstance(body[0], nodes.paragraph):
- raise DataError('GLEP header field body may only contain '
- 'a single paragraph:\n%s'
- % field.pformat(level=1))
- elif name == 'last-modified':
- date = time.strftime(
- '%d-%b-%Y',
- time.localtime(os.stat(self.document['source'])[8]))
- if cvs_url:
- body += nodes.paragraph(
- '', '', nodes.reference('', date, refuri=cvs_url))
- else:
- # empty
- continue
- para = body[0]
- if name == 'author':
- for node in para:
- if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node))
- elif name == 'discussions-to':
- for node in para:
- if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node, pep))
- elif name in ('replaces', 'replaced-by', 'requires'):
- newbody = []
- space = nodes.Text(' ')
- for refpep in re.split(',?\s+', body.astext()):
- pepno = int(refpep)
- newbody.append(nodes.reference(
- refpep, refpep, refuri=self.pep_url % pepno))
- newbody.append(space)
- para[:] = newbody[:-1] # drop trailing space
- elif name == 'last-modified':
- utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
- if cvs_url:
- date = para.astext()
- para[:] = [nodes.reference('', date, refuri=cvs_url)]
- elif name == 'content-type':
- pep_type = para.astext()
- uri = self.pep_url % 2
- para[:] = [nodes.reference('', pep_type, refuri=uri)]
- elif name == 'version' and len(body):
- utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions)
-
-
-class Contents(Transform):
-
- """
- Insert a table of contents transform placeholder into the document after
- the RFC 2822 header.
- """
-
- default_priority = 380
-
- def apply(self):
- pending = nodes.pending(parts.Contents, {'title': None})
- self.document.insert(1, pending)
- self.document.note_pending(pending)
-
-
-class TargetNotes(Transform):
-
- """
- Locate the "References" section, insert a placeholder for an external
- target footnote insertion transform at the end, and schedule the
- transform to run immediately.
- """
-
- default_priority = 520
-
- def apply(self):
- doc = self.document
- i = len(doc) - 1
- refsect = copyright = None
- while i >= 0 and isinstance(doc[i], nodes.section):
- title_words = doc[i][0].astext().lower().split()
- if 'references' in title_words:
- refsect = doc[i]
- break
- elif 'copyright' in title_words:
- copyright = i
- i -= 1
- if not refsect:
- refsect = nodes.section()
- refsect += nodes.title('', 'References')
- doc.set_id(refsect)
- if copyright:
- # Put the new "References" section before "Copyright":
- doc.insert(copyright, refsect)
- else:
- # Put the new "References" section at end of doc:
- doc.append(refsect)
- pending = nodes.pending(references.TargetNotes)
- refsect.append(pending)
- self.document.note_pending(pending, 0)
- pending = nodes.pending(misc.CallBack,
- details={'callback': self.cleanup_callback})
- refsect.append(pending)
- self.document.note_pending(pending, 1)
-
- def cleanup_callback(self, pending):
- """
- Remove an empty "References" section.
-
- Called after the `references.TargetNotes` transform is complete.
- """
- if len(pending.parent) == 2: # <title> and <pending>
- pending.parent.parent.remove(pending.parent)
-
-
-class PEPZero(Transform):
-
- """
- Special processing for PEP 0.
- """
-
- default_priority =760
-
- def apply(self):
- visitor = PEPZeroSpecial(self.document)
- self.document.walk(visitor)
- self.startnode.parent.remove(self.startnode)
-
-
-class PEPZeroSpecial(nodes.SparseNodeVisitor):
-
- """
- Perform the special processing needed by PEP 0:
-
- - Mask email addresses.
-
- - Link PEP numbers in the second column of 4-column tables to the PEPs
- themselves.
- """
-
- pep_url = Headers.pep_url
-
- def unknown_visit(self, node):
- pass
-
- def visit_reference(self, node):
- node.parent.replace(node, mask_email(node))
-
- def visit_field_list(self, node):
- if node.hasattr('class') and node['class'] == 'rfc2822':
- raise nodes.SkipNode
-
- def visit_tgroup(self, node):
- self.pep_table = node['cols'] == 4
- self.entry = 0
-
- def visit_colspec(self, node):
- self.entry += 1
- if self.pep_table and self.entry == 2:
- node['class'] = 'num'
-
- def visit_row(self, node):
- self.entry = 0
-
- def visit_entry(self, node):
- self.entry += 1
- if self.pep_table and self.entry == 2 and len(node) == 1:
- node['class'] = 'num'
- p = node[0]
- if isinstance(p, nodes.paragraph) and len(p) == 1:
- text = p.astext()
- try:
- pep = int(text)
- ref = self.pep_url % pep
- p[0] = nodes.reference(text, text, refuri=ref)
- except ValueError:
- pass
-
-
-non_masked_addresses = ('peps@python.org',
- 'python-list@python.org',
- 'python-dev@python.org')
-
-def mask_email(ref, pepno=None):
- """
- Mask the email address in `ref` and return a replacement node.
-
- `ref` is returned unchanged if it contains no email address.
-
- For email addresses such as "user@host", mask the address as "user at
- host" (text) to thwart simple email address harvesters (except for those
- listed in `non_masked_addresses`). If a PEP number (`pepno`) is given,
- return a reference including a default email subject.
- """
- if ref.hasattr('refuri') and ref['refuri'].startswith('mailto:'):
- if ref['refuri'][8:] in non_masked_addresses:
- replacement = ref[0]
- else:
- replacement_text = ref.astext().replace('@', ' at ')
- replacement = nodes.raw('', replacement_text, format='html')
- if pepno is None:
- return replacement
- else:
- ref['refuri'] += '?subject=PEP%%20%s' % pepno
- ref[:] = [replacement]
- return ref
- else:
- return ref