id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
4317	IncludeSourcePartial does not handle case where one line is returned	chrisheller	chrisheller	In ticket:4315 there was an issue with line separators that caused the included source to end up as one line. That broke the macro because it assumed that the mimeview render() method would always return a Genshi object that could have generate() called on it.\r\n\r\nThe line separator issue has been fixed, but I'm not sure of the best answer for the case where the included source ends up being just one line anyways. \r\n\r\nThe render() docstring says it "Can return the generated XHTML text as a single string", so it seems something like this is the best course of action. \r\n\r\n{{{\r\n#!diff\r\nIndex: includesource/IncludeSource.py\r\n===================================================================\r\n--- includesource/IncludeSource.py_(revision 5038)\r\n+++ includesource/IncludeSource.py_(working copy)\r\n@@ -143,6 +143,10 @@\r\n         mv = Mimeview(self.env)\r\n         src = mv.render(formatter.context, mimetype, src, file_name, url, ['givenlineno'])\r\n \r\n+        if not hasattr(src, 'generate'):    # got XHTML string back\r\n+            from genshi.input import XML    # so we convert it to use\r\n+            src = XML(src)                  # with Transformers below\r\n+            \r\n         # the _render_source method will always set the CSS class\r\n         # of the annotator to it's name; there isn't an easy way\r\n         # to override that. We could create our own CSS class for\r\n}}}\r\n\r\nIf there are any Genshi experts that would like to comment, feel free to do so. Otherwise I'll commit this change after a bit more testing. \r\n	defect	closed	low	IncludeSourcePartialPlugin	normal	fixed			0.11
