Edgewall Software

Opened 15 years ago

Last modified 8 years ago

#321 new enhancement

(Wishlist) Support for outputting comments

Reported by: daniel-genshi@… Owned by: cmlenz
Priority: minor Milestone: 0.9
Component: Template processing Version: 0.5.1
Keywords: comment Cc:

Description

It would be nice to have the ability to output comments in XML templates, much like you can in XSL with <xsl:comment>.

This would allow actual template data to be put in comments at the author's discretion.

Using an element like <py:comment> seems like the right way to approach this.

Attachments (2)

pycomments.patch (4.8 KB) - added by daniel-genshi@… 15 years ago.
patch for py:comment feature
pycomment1.patch (4.9 KB) - added by daniel-genshi@… 15 years ago.
patch refresh

Download all attachments as: .zip

Change History (11)

comment:1 Changed 15 years ago by anonymous

use may use "<--! this is a comment -->" construction. http://genshi.edgewall.org/wiki/Documentation/0.5.x/xml-templates.html#id11

comment:2 Changed 15 years ago by daniel-genshi@…

I know about that, and it's not what I'm describing. Here's a code example:

<py:comment>${1 + 1}</py:comment>

should yield:

<!--2-->

Notice that what is inside the comment is actually processed.

Changed 15 years ago by daniel-genshi@…

patch for py:comment feature

comment:3 Changed 15 years ago by daniel-genshi@…

I added a patch that creates a comment directive and should close this ticket. I included a set of tests in the patch as well. Please review at your convenience.

Changed 15 years ago by daniel-genshi@…

patch refresh

comment:4 Changed 15 years ago by cmlenz

  • Milestone changed from 0.6 to 0.7

comment:5 Changed 15 years ago by daniel-genshi@…

I noticed the milestone was changed to 0.7. Are you just paring back features to stabilize the release? Is the change unwelcome? If there is something wrong with the patch, please let me know.

comment:6 Changed 15 years ago by cmlenz

I just need to get a new stable release (0.6) out real soon, so a lot of tickets have been moved to the next major milestone.

The patch looks good.

comment:7 Changed 14 years ago by Carsten Klein <carsten.klein@…>

see also the initiative to support pluggable directives libraries in WorkInProgress/PluggableDirectivesLibraries and ticket #395 thereof.

comment:8 Changed 11 years ago by spaceone

The patch still applies and is working.

But i found a issue where it causes the process to not generate the template anymore (process status is R+, strace shows mremap(0xb6be5000, 1908736, 2146304, MREMAP_MAYMOVE) = 0xb6be5000).

from genshi.template import MarkupTemplate
s = '''<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/">
<?python from genshi import HTML ?>
<py:comment>${HTML(u"")}</py:comment>
</html>
'''
MarkupTemplate(s).generate(name='world').render('html')

comment:9 Changed 8 years ago by hodgestar

  • Milestone changed from 0.7 to 0.9

Moved to milestone 0.9.

Note: See TracTickets for help on using tickets.