I am finding it very hard to automate the coding of my code samples. I tried looking into Ray Camden's BlogCFC code, but unfortunately his does not work for my situation. My code is not stored a single string. Instead, my code is stored in an unordered list (<ol>) where each list item (<li>) is a single line of code (or partial line of code). I find this gives me much greater control over how the code is indented and how the lines wrap. I have to thank the XStandard people for the suggestion, which i LOVE.
However, because of this, I may or may not have a single ColdFusion tag that includes multiple list items. I am not sure how to add the color coded spans. I can't just add them at the beginning of one li and the end of another li as this is not XHTML compliant (nor do the color actually traverse the li's). I have to break each segment into it's own code block, therefore, remembering which the last code block was - am I in a new span tag? Am I continuing the span tag?
Then to make matters worse, what if one of the tags has a double quote in an attribute value, or a < or > in an attribute value. How do I know if I am at the end of a tag or in the middle of an attribute value? Both would be stored as < and > respectively. This is proving very frustrating.
But, I know I have to get this done as it makes the code soooo much more readable.