Commit 50392b74 authored by Julien Muchembled's avatar Julien Muchembled

PortalTransforms: merge upstream 1.6.0-a1

Conflicts:
	transforms/safe_html.py

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41724 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 01b1b23a
......@@ -3,6 +3,7 @@
* Use ImageMagick's 'convert' program instead of PIL to handle CMYK
images well.
* Merge upstream 1.6.0-a1
1.4.1-nexedi - 2009-03-03
=========================
......
......@@ -534,4 +534,17 @@ class TransformTool(UniqueObject, ActionProviderBase, Folder):
log('objectItems: catched MissingBinary exception')
return []
# available mimetypes ####################################################
def listAvailableTextInputs(self):
""" Returns a list of mimetypes that can be used as input for textfields
by building a list of the inputs beginning with "text/" of all transforms.
"""
available_types = []
candidate_transforms = [object[1] for object in self.objectItems()]
for candidate in candidate_transforms:
for input in candidate.inputs:
if input.startswith("text/") and input not in available_types:
available_types.append(input)
return available_types
InitializeClass(TransformTool)
h1. Textile test text
_This_ is quite *boring*, but it needs to be "done":http://plone.org, right?
h2. Cheeses
# Gouda
# Roquefort
# Emmentaler
h2. Episodes
* Bicycle Repairman
* Spanish Inquisition
* Fishslapping Dance
## Testing Markdown
`code` and _italic_ and *bold* and even a [link](http://plone.org).
<h2> Testing Markdown </h2>
<p> <code>code</code> and <em>italic</em> and <em>bold</em> and even a <a href="http://plone.org">link</a>.
</p>
<h2 class="title">Heading 1</h2>
<p>Some text.</p>
<div class="section">
<h3><a id="heading-2" name="heading-2">Heading 2</a></h3>
<div class="section" id="heading-2">
<h3><a 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">
<h3><a id="now-the-real-heading" name="now-the-real-heading">Now the real heading</a></h3>
<div class="section" id="now-the-real-heading">
<h3><a name="now-the-real-heading">Now the real heading</a></h3>
<p>The brown fox jumped over the lazy dog.</p>
<div class="section">
<h4><a id="with-a-subheading" name="with-a-subheading">With a subheading</a></h4>
<div class="section" id="with-a-subheading">
<h4><a 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>
Copying Docutils
Author: David Goodger
Contact: goodger@users.sourceforge.net
Contact: [1]goodger@users.sourceforge.net
Date: 2002-10-03
Web site: http://docutils.sourceforge.net/
Web site: [2]http://docutils.sourceforge.net/
Most of the files included in this project are in the public domain,
and therefore have no license requirement and no restrictions on
......@@ -12,22 +13,34 @@ Copying Docutils
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.
[3]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
compatibility with Python versions less than 2.2; if you have
released under the [4]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
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 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
use the owner's name in vain. The BSD license is similar.
license are [5]OSI-approved and [6]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 use the owner's name in vain. The BSD license is
similar.
_________________________________________________________________
Generated on: 2003-04-19 15:32 UTC. Generated by Docutils from
reStructuredText source.
Generated on: 2003-04-19 15:32 UTC. Generated by [7]Docutils from
[8]reStructuredText source.
References
1. mailto:goodger@users.sourceforge.net
2. http://docutils.sourceforge.net/
3. http://www.python.org/2.1.1/license.html
4. http://www.python.org/2.2/license.html
5. http://opensource.org/licenses/
6. http://www.gnu.org/philosophy/license-list.html
7. http://docutils.sourceforge.net/
8. http://docutils.sourceforge.net/rst.html
<h1>Textile test text</h1>
<p><em>This</em> is quite <strong>boring</strong>, but it needs to be <a href="http://plone.org">done</a>, right?</p>
<h2>Cheeses</h2>
<ol>
<li>Gouda</li>
<li>Roquefort</li>
<li>Emmentaler</li>
</ol>
<h2>Episodes</h2>
<ul>
<li>Bicycle Repairman</li>
<li>Spanish Inquisition</li>
<li>Fishslapping Dance</li>
</ul>
......@@ -179,7 +179,13 @@ TRANSFORMS_TESTINFO = (
('Products.PortalTransforms.transforms.image_to_pcx',
"logo.png", "logo.pcx", None, 0
),
)
('Products.PortalTransforms.transforms.markdown_to_html',
"markdown.txt", "markdown.html", None, 0
),
('Products.PortalTransforms.transforms.textile_to_html',
"input.textile", "textile.html", None, 0
),
)
def initialise(transform, normalize, pattern):
global TRANSFORMS_TESTINFO
......
......@@ -41,6 +41,8 @@ modules = [
'w3m_dump',
'python', # python source files, no dependancies
'identity', # identity transform, no dependancies
'markdown_to_html', # markdown, depends on http://surfnet.dl.sourceforge.net/sourceforge/python-markdown/markdown-1-5.py
'textile_to_html',# textile, depends on PyTextile http://dom.eav.free.fr/python/textile-mirror-2.0.10.tar.gz
]
g = globals()
......
......@@ -18,13 +18,9 @@ class lynx_dump(popentransform):
binaryName = "lynx"
# XXX does -stdin work on windows?
binaryArgs = "-dump -stdin"
binaryArgs = "-dump -stdin -force_html"
useStdin = True
def getData(self, couterr):
lines = [ line for line in couterr.readlines() ]
return ''.join(lines)
class old_lynx_dump(commandtransform):
implements(itransform)
......
"""
Uses the http://www.freewisdom.org/projects/python-markdown/ module to do its handy work
author: Tom Lazar <tom@tomster.org> at the archipelago sprint 2006
"""
from Products.PortalTransforms.interfaces import itransform
from Products.PortalTransforms.libtransforms.utils import bin_search, sansext
from Products.PortalTransforms.libtransforms.commandtransform import commandtransform
from Products.CMFDefault.utils import bodyfinder
import os
from zope.interface import implements
try:
import markdown as markdown_transformer
except ImportError:
HAS_MARKDOWN = False
else:
HAS_MARKDOWN = True
class markdown:
implements(itransform)
__name__ = "markdown_to_html"
inputs = ("text/x-web-markdown",)
output = "text/html"
def name(self):
return self.__name__
def convert(self, orig, data, **kwargs):
if HAS_MARKDOWN:
html = markdown_transformer.markdown(orig)
else:
html = orig
data.setData(html)
return data
def register():
return markdown()
"""
Uses Roberto A. F. De Almeida's http://dealmeida.net/ module to do its handy work
author: Tom Lazar <tom@tomster.org> at the archipelago sprint 2006
"""
from Products.PortalTransforms.interfaces import itransform
from Products.PortalTransforms.libtransforms.utils import bin_search, sansext
from Products.PortalTransforms.libtransforms.commandtransform import commandtransform
from Products.CMFDefault.utils import bodyfinder
import os
from zope.interface import implements
try:
import textile as textile_transformer
except ImportError:
HAS_TEXTILE = False
else:
HAS_TEXTILE = True
class textile:
implements(itransform)
__name__ = "textile_to_html"
inputs = ("text/x-web-textile",)
output = "text/html"
def name(self):
return self.__name__
def convert(self, orig, data, **kwargs):
if HAS_TEXTILE:
html = textile_transformer.textile(orig, encoding='utf-8', output='utf-8')
else:
html = orig
data.setData(html)
return data
def register():
return textile()
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