On Feb 8, 4:15 pm, "mtuller" <email@example.com> wrote:
> I was asking how to escape the quotation marks. I have everything
> working in pyparser except for that. I don't want to drop everything
> and go to a different parser.
> Can someone else help?
pyparsing includes a helper for constructing HTML tags called
makeHTMLTags. This method does more than just wrap the given tag text
within <>'s, but also comprehends attributes, upper/lower case, and
various styles of quoted strings. To use it, replace your Literal
definitions for spanStart and spanEnd with:
spanStart, spanEnd = makeHTMLTags('span')
If you don't want to match just *any* <span> tag, but say, you only
want those with the class = "hpPageText", then add this parse action
if not(attrname in tagAttrs and tagAttrs[attrname]==attrval):