Commit 01b1b23a authored by Julien Muchembled's avatar Julien Muchembled

PortalTransforms: merge upstream 1.4.2-final

Drop [6704] ("Make header level and report level configurable per-instance")

Conflicts:
	HISTORY.txt
	transforms/html_to_text.py
	transforms/rest.py
	transforms/safe_html.py
	version.txt

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41723 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f6a8f1d5
......@@ -47,6 +47,30 @@
transform tool will be copied and this transform will be removed
from copied one.
1.5.0-final - 2006-12-15
========================
* note for release-managers: The version-bump to 1.5 was a bit early, but now
as we have it, i keep it and next release number in the cycle needed for
Archetypes 1.4.2 (used for Plone 2.5.2) of PortalTransforms is then the 1.5
final.
We dont need increasing of release numbers because of Plone 3.0,
Archetypes 1.5, ... if theres no change in the dependen product, like
this one.
[jensens]
1.5.0-a1 - 2006-10-25
=====================
* casting to int is evil without previous check of the type. so we assume as
in CMFPlone just zero for non-int-castable values.
[jensens]
* the values in the safe_html valid tag dictionary can become strings when
modifying them via the ZMI. Explicitly convert them to integers before
testing their value.
[wichert]
1.4.1-final - 2006-09-08
========================
......
......@@ -88,6 +88,7 @@ class TransformsChain(Implicit, Item, RoleManager, Persistent):
It follows the transform API so that a chain is itself a transform.
"""
module = 'N/A'
meta_type = 'TransformsChain'
meta_types = all_meta_types = ()
......@@ -113,15 +114,6 @@ class TransformsChain(Implicit, Item, RoleManager, Persistent):
self.output = 'application/octet-stream'
self._chain = None
def __setstate__(self, state):
""" __setstate__ is called whenever the instance is loaded
from the ZODB, like when Zope is restarted.
We should rebuild the chain at this time
"""
TransformsChain.inheritedAttribute('__setstate__')(self, state)
self._chain = None
def _chain_init(self):
""" build the transforms chain """
tr_tool = getToolByName(self, 'portal_transforms')
......@@ -209,7 +201,7 @@ class TransformsChain(Implicit, Item, RoleManager, Persistent):
""" reload the module where the transformation class is defined """
for tr in self.objectValues():
tr.reload()
self._chain_init()
# utilities #
......
......@@ -4,6 +4,11 @@ import sys
from sgmllib import SGMLParser
try:
# Need to be imported before win32api to avoid dll loading
# problems.
import pywintypes
import pythoncom
import win32api
WIN32 = True
except ImportError:
......
<h2 class="title">Heading 1</h2>
<p>Some text.</p>
<div class="section" id="heading-2">
<h3><a name="heading-2">Heading 2</a></h3>
<div class="section">
<h3><a id="heading-2" name="heading-2">Heading 2</a></h3>
<p>Some text, bla ble bli blo blu. Yes, i know this is <a class="reference" href="http://www.example.com">Stupid</a>.</p>
</div>
<h2 class="title">Title</h2>
<h3 class="subtitle">Subtitle</h3>
<p>This is a test document to make sure subtitle gets the right heading.</p>
<div class="section" id="now-the-real-heading">
<h3><a name="now-the-real-heading">Now the real heading</a></h3>
<div class="section">
<h3><a id="now-the-real-heading" name="now-the-real-heading">Now the real heading</a></h3>
<p>The brown fox jumped over the lazy dog.</p>
<div class="section" id="with-a-subheading">
<h4><a name="with-a-subheading">With a subheading</a></h4>
<div class="section">
<h4><a id="with-a-subheading" name="with-a-subheading">With a subheading</a></h4>
<p>Some text, bla ble bli blo blu. Yes, i know this is <a class="reference" href="http://www.example.com">Stupid</a>.</p>
</div>
</div>
......@@ -22,7 +22,7 @@ Contact:
goodger&#64;users.sourceforge.net
Date:
2002-10-03
Web site:http://docutils.sourceforge.net/
Web site: http://docutils.sourceforge.net/
......@@ -33,9 +33,9 @@ copying or usage. The exceptions are:
docutils/optik.py, copyright Gregory P. Ward, released under a
BSD-style license (which can be found in the module's source code).
docutils/roman.py, copyright by Mark Pilgrim, released under the
Python 2.1.1 license.
Python 2.1.1 license .
test/difflib.py, copyright by the Python Software Foundation,
released under the Python 2.2 license. This file is included for
released under the Python 2.2 license . This file is included for
compatibility with Python versions less than 2.2; if you have Python
2.2 or higher, difflib.py is not needed and may be removed. (It's
only used to report test failures anyhow; it isn't installed
......@@ -43,7 +43,7 @@ anywhere. The included file is a pre-generator version of the
difflib.py module included in Python 2.2.)
(Disclaimer: I am not a lawyer.) Both the BSD license and the Python
license are OSI-approved and GPL-compatible. Although complicated
license are OSI-approved and GPL-compatible . Although complicated
by multiple owners and lots of legalese, the Python license basically
lets you copy, use, modify, and redistribute files as long as you keep
the copyright attribution intact, note any changes you make, and don't
......
import unittest
from zope.testing import doctestunit
modules = (
'Products.PortalTransforms.transforms.rest',
)
def test_suite():
return unittest.TestSuite(
[doctestunit.DocTestSuite(module=module) for module in modules]
)
......@@ -7,13 +7,13 @@ class html_to_text(retransform):
def register():
# XXX convert entites with htmlentitydefs.name2codepoint ?
return html_to_text("html_to_text",
('<script [^>]>.*</script>(?im)', ''),
('<style [^>]>.*</style>(?im)', ''),
('<head [^>]>.*</head>(?im)', ''),
('<script [^>]>.*</script>(?im)', ' '),
('<style [^>]>.*</style>(?im)', ' '),
('<head [^>]>.*</head>(?im)', ' '),
# added for ERP5, we want to transform <br/> in newlines
('<br\s*/?>(?im)', '\n'),
('(?im)<(h[1-6r]|address|p|ul|ol|dl|pre|div|center|blockquote|form|isindex|table)(?=\W)[^>]*>', ' '),
('<[^>]*>(?i)(?m)', ''),
('(?im)</?(font|em|i|strong|b)(?=\W)[^>]*>', ''),
('<[^>]*>(?i)(?m)', ' '),
)
......@@ -18,12 +18,12 @@ class lynx_dump(popentransform):
binaryName = "lynx"
# XXX does -stdin work on windows?
binaryArgs = "-dump -crawl -stdin"
binaryArgs = "-dump -stdin"
useStdin = True
def getData(self, couterr):
lines = [ line for line in couterr.readlines() ]
return ''.join(lines[3:])
return ''.join(lines)
class old_lynx_dump(commandtransform):
implements(itransform)
......
# Need to be imported first to avoid dll loading problems.
import pywintypes
import pythoncom
import os.path
import win32com, sys, string, win32api, traceback, re, tempfile, os
import win32com.client
# from win32com.test.util import CheckClean
import pythoncom
from win32com.client import gencache
from win32com.client import constants, Dispatch
from pywintypes import Unicode
import os.path
from Products.PortalTransforms.libtransforms.commandtransform import commandtransform
from Products.PortalTransforms.libtransforms.utils import bodyfinder, scrubHTML
......
......@@ -4,6 +4,37 @@ import sys
from zope.interface import implements
class rest:
r"""Converts from reST to HTML.
>>> transform = rest()
>>> class D:
... def setData(self, data):
... self.value = data
>>> data = transform.convert('*hello world*', D())
>>> print data.value
<p><em>hello world</em></p>
<BLANKLINE>
We want the 'raw' and 'include' directives to be disabled by
default:
>>> try:
... transform.convert('.. raw:: html\n :file: <isonum.txt>', D())
... except NotImplementedError:
... print 'Good'
... else:
... print 'Failure'
Good
>>> try:
... transform.convert('.. include:: <isonum.txt>', D())
... except NotImplementedError:
... print 'Good'
... else:
... print 'Failure'
Good
"""
implements(itransform)
__name__ = "rest_to_html"
......
1.4.1-nexedi
1.4.2-nexedi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment