jbowens / jBBCode

A lightweight but extensible BBCode parser
http://jbbcode.com
MIT License
164 stars 32 forks source link

Adjacent text nodes #10

Closed jbowens closed 11 years ago

jbowens commented 11 years ago

Currently, jBBCode makes no guarantees about consecutive, uninterrupted text being in the same text node. The parser will sometimes create adjacent text nodes. This isn't a problem, but it can make text manipulation through the NodeVisitor more difficult. It might be nice if after parsing, we traverse the graph and collapse adjacent text nodes into a single text node with the concatenated values.

jbowens commented 11 years ago

This should be fixed by 807716a. When the parser attempts to add another text node, it first checks if it can just append the value to an existing node's value.