Friday night, I checked in some code for the next version of the forum app that caused much anxiety... the text parsing stuff. It's no secret that every previous version has had bugs, and while this probably will too, it's much better than it was. It's about a third less code, and there are nearly a hundred unit tests around it. At the very least, I feel a lot better about it. That I only spend about seven hours on it is certainly a plus as well.
It's still not an ideal way to handle things, because I don't really address the issues around block elements and non-block elements, or the differences between them. But after hundreds of thousands of posts, the approach seems to be "good enough." The important thing for me was just getting valid HTML, without overlapping tags and what not. I also convert everything to cleaned up "forum code" first, and then convert to HTML. That seems like an extra step, but the benefit of this approach is that it limits what gets through, and accounts for both plain text and rich text boxes.
It was a good one to check off the backlog (which is itself incomplete). I feel like I might actually get it done this year. It's the first true re-write in seven years, and I'm really appreciating the difference between evolving something and starting from scratch. It's very time consuming!
No comments yet.