Edgewall Software

Ticket #110 (new enhancement)

Opened 20 months ago

Last modified 8 months ago

Genshi doesn't add newline char after "</html>"

Reported by: yaohua2000@… Owned by: cmlenz
Priority: minor Milestone:
Component: Template processing Version: 0.3.6
Keywords: Cc:

Description

My template ends with "</html>" and a newline char, but after "genshied", it removed my newline char at the end of file. A text file should be ended with a newline char. Please add it back.

Attachments

Change History

Changed 20 months ago by anonymous

While your template file might be a text file, (X)HTML output is not. And in XML, there is nothing outside the root element, so having no newline makes sense to me.

Changed 20 months ago by cmlenz

  • milestone changed from 0.4 to 0.4.1

I agree that Genshi shouldn't be stripping whitespace after the last close tag. Will look into this for 0.4.1.

Changed 19 months ago by anonymous

Well, generally spoken, whitespace after close tags *is* important to create far more readable output. So I agree in that Genshi shouldn't strip it.

Changed 19 months ago by cmlenz

Okay, the problem is that whitespace after the document element is “ignorable whitespace”, and thus not passed to Genshi as normal character data. The only way to learn about such whitespace is using the DefaultHandler (implemented by XMLParser._handle_other in Genshi), but then we also get a whole lot of other ignorable whitespace, which, well, ought to be ignored.

So right now I'm not sure what the right solution would be.

Changed 19 months ago by cmlenz

  • priority changed from major to minor
  • milestone changed from 0.4.1 to 0.5

For the reasons explained in my previous comment, I consider fixing this issue to high risk for the maintenance branch. I'll look into a proper solution for 0.5.

Changed 8 months ago by cmlenz

  • type changed from defect to enhancement
  • milestone 0.5 deleted

Postponing again, sorry. If anyone can come up with a patch for this, I'd be grateful.

Add/Change #110 (Genshi doesn't add newline char after "</html>")

Author



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.