[Checkins] SVN: z3c.pt/trunk/ Added support for comments.
Malthe Borch
mborch at gmail.com
Mon Mar 10 05:53:48 EDT 2008
Log message for revision 84563:
Added support for comments.
Changed:
U z3c.pt/trunk/docs/HISTORY.txt
U z3c.pt/trunk/setup.py
U z3c.pt/trunk/z3c/pt/translation.py
U z3c.pt/trunk/z3c/pt/translation.txt
-=-
Modified: z3c.pt/trunk/docs/HISTORY.txt
===================================================================
--- z3c.pt/trunk/docs/HISTORY.txt 2008-03-10 05:14:27 UTC (rev 84562)
+++ z3c.pt/trunk/docs/HISTORY.txt 2008-03-10 09:53:42 UTC (rev 84563)
@@ -1,6 +1,16 @@
Changelog
---------
+Version 0.7 - March 10, 2008
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Added support for comments; expressions are allowed
+ inside comments, i.e.
+
+ <!-- ${'Hello World!'} -->
+
+ Comments are always included.
+
Version 0.6 - February 24, 2008
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: z3c.pt/trunk/setup.py
===================================================================
--- z3c.pt/trunk/setup.py 2008-03-10 05:14:27 UTC (rev 84562)
+++ z3c.pt/trunk/setup.py 2008-03-10 09:53:42 UTC (rev 84563)
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-version = '0.6.2'
+version = '0.7'
setup(name='z3c.pt',
version=version,
Modified: z3c.pt/trunk/z3c/pt/translation.py
===================================================================
--- z3c.pt/trunk/z3c/pt/translation.py 2008-03-10 05:14:27 UTC (rev 84562)
+++ z3c.pt/trunk/z3c/pt/translation.py 2008-03-10 09:53:42 UTC (rev 84563)
@@ -74,6 +74,23 @@
def body(self, stream):
skip = self.replace or self.content or self.i18n_translate is not None
if not skip:
+ for element in list(self):
+ if isinstance(element, lxml.etree._Comment):
+ index = self.index(element)
+
+ t = parser.makeelement(
+ '{http://xml.zope.org/namespaces/tal}comment')
+
+ t.attrib['omit-tag'] = ''
+ t.tail = element.tail
+ t.text = '<!--' + element.text + '-->'
+
+ for child in element.getchildren():
+ t.append(child)
+
+ self.remove(element)
+ self.insert(index, t)
+
for element in self:
element.interpolate(stream)
for element in self:
Modified: z3c.pt/trunk/z3c/pt/translation.txt
===================================================================
--- z3c.pt/trunk/z3c/pt/translation.txt 2008-03-10 05:14:27 UTC (rev 84562)
+++ z3c.pt/trunk/z3c/pt/translation.txt 2008-03-10 09:53:42 UTC (rev 84563)
@@ -33,6 +33,10 @@
... <span tal:replace="'Item ' + str(i) + ')'" />
... </li>
... </ul>
+ ... <!-- a comment -->
+ ... <!-- a multi-
+ ... line comment -->
+ ... <!-- a comment with an ${'expression'} -->
... <tal:example replace="'Hello World!'" />
... <tal:div content="'Hello World!'" />
... <img alt="'Hello World!'" />
@@ -79,6 +83,10 @@
Item 4)
</li>
</ul>
+ <!-- a comment -->
+ <!-- a multi-
+ line comment -->
+ <!-- a comment with an expression -->
Hello World!
Hello World!
<img alt="'Hello World!'" />
More information about the Checkins
mailing list