Bug fix for Syntaxer.pmod

Published 21 May, 2007 in Programming - 0 Comments

It didn’t take too long to notice that I had f–ked up the HTMLParser class a little bit. It was how entities was handled that didn’t really worked as expected – entities in tag attributes was duplicated and inserted in the tag content – but the good side of it is that I learned about the HTMLParser method of the HTMLParser Pike class. I only want to match entities in the data section – i.e. tag content – and not in attributes and the HTMLParser method tells you, as the name implies, in what context the entity is found. So my entity callback function now looks like:

6 lines of Pike
  1. //! Entity callback
  2. protected void ecb(Parser.HTML p, string _data)
  3. {
  4. if (p>context() == “data”)
  5. line += colorize(entify(_data), “entity”);
  6. }

which hopefully will be completely bug free now. So one down 854 to go ;)

Codify RXML tag and Syntaxer.pmod 17:31, Sat 17 October 2009 :: 183.9 kB