[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - DT_Var.py:1.59
Andreas Jung
andreas@andreas-jung.com
Sat, 1 Feb 2003 04:26:31 -0500
Update of /cvs-repository/Zope/lib/python/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv18056/DocumentTemplate
Modified Files:
DT_Var.py
Log Message:
merge from ajung-restructuredtext-integration-branch
=== Zope/lib/python/DocumentTemplate/DT_Var.py 1.58 => 1.59 ===
--- Zope/lib/python/DocumentTemplate/DT_Var.py:1.58 Mon Sep 16 06:09:11 2002
+++ Zope/lib/python/DocumentTemplate/DT_Var.py Sat Feb 1 04:25:58 2003
@@ -396,6 +396,18 @@
def len_comma(v, name='(Unknown name)', md={}):
return thousands_commas(str(len(v)))
+def restructured_text(v, name='(Unknown name)', md={}):
+
+ from reStructuredText import HTML
+
+ if isinstance(v,StringType): txt = v
+ elif aq_base(v).meta_type in ['DTML Document','DTML Method']:
+ txt = aq_base(v).read_raw()
+ else: txt = str(v)
+
+ return HTML(txt)
+
+
StructuredText=None
def structured_text(v, name='(Unknown name)', md={}):
global StructuredText
@@ -428,6 +440,7 @@
'dollars-and-cents': dollars_and_cents,
'collection-length': len_format,
'structured-text': structured_text,
+ 'restructured-text': restructured_text,
# The rest are deprecated:
'sql-quote': sql_quote,