Last modified: 2013-11-01 20:57:07 UTC
It seems that a newline is added when transcluding a template that ends with <div> (at least). Passing it to mw.text.trim before returning works.
please read </div> instead of <div>
Thanks for taking the time to report this! Is there an example wikipage/revision where this problem can be seen?
Seems to work fine here in local testing: I created a template with contents "<div>foo</div>", and no extra newline was included in the output of mw.getCurrentFrame():expandTemplate{title="foo"}. Please provide a test case that shows this problem.
Sorry in fact it does the same with simple template transclusion; I have made some tests in https://fr.wikibooks.org/wiki/Utilisateur:François_Melchior/Bac_à_sable/Lua/t5
(In reply to comment #4) > Sorry in fact it does the same with simple template transclusion; I have made > some tests in > https://fr.wikibooks.org/wiki/Utilisateur:François_Melchior/Bac_à_sable/Lua/ > t5 Your test cases aren't showing any extra newline, either. And even if it were happening, if it also happens with normal transclusion then it's not a bug in Scribunto. Do note that "x<div>Hello</div>z" is going to render with the "Hello" on a new line, because <div> is a block element. And that HTML Tidy as used on WMF wikis will insert a newline after the </div> as part of its "tidying" of the HTML for the same reason. I'm going to close this bug. If you can put together a test case that clearly shows something going wrong, feel free to reopen.
Ok