e0e0687dc2
This commit fixes two problems: 1. Doctypes introducing too many newlines 2. Elements with siblings and a common parent not being closed properly == Doctypes When generating the XML for a doctype the XML::Generator class would append a trailing newline. This however meant that if the next text node was also a newline you'd now have two newlines. In previous versions of Oga this worked because the old XML generation code would call String#strip on the XML to add after the doctype. To support this in the new version we perform a lookahead in XML::Generator#on_doctype to remove any trailing newlines added by this method in case the first child node is a newline text node. == Closing Elements When an element has a sibling following it _and_ does not have any child nodes it would not be closed properly when generating XML. This is due to the "until next_node = ..." expression evaluating to true, thus never executing its body. There's probably some way to work around this by using the "loop" method, but considering it's 02:09 I think the current approach is good enough. Future me will probably hate me for it. |
||
---|---|---|
.. | ||
oga | ||
support | ||
spec_helper.rb |