Edgewall Software

Ticket #321 (new enhancement)

Opened 5 years ago

Last modified 11 months ago

(Wishlist) Support for outputting comments

Reported by: daniel-genshi@… Owned by: cmlenz
Priority: minor Milestone: 0.7
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

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

Change History

Changed 5 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

Changed 5 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 5 years ago by daniel-genshi@…

patch for py:comment feature

Changed 5 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 5 years ago by daniel-genshi@…

patch refresh

Changed 5 years ago by cmlenz

  • milestone changed from 0.6 to 0.7

Changed 5 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.

Changed 5 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.

Changed 5 years ago by Carsten Klein <carsten.klein@…>

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

Changed 11 months 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')

Add/Change #321 ((Wishlist) Support for outputting comments)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cmlenz. Next status will be 'new'
The owner will change from cmlenz to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.