Matt Kraai wrote:
> The regular expression that Markdown passes to Text::Balanced to match
> opening tags contains a backreference to the attribute value quote
> character.  Text::Balanced wraps this expression in another set of
> parentheses when matching for a nested tag, which breaks this
> backreference.

Aha. That explains it[1].

> I don't know whether this is a bug in Markdown or Text::Balanced, nor
> do I see a good way to fix it.  Help!

Well, one way is to go to a more complex regexp, with two halves, each
half being hardcoded for one type of quoting.

         (?:                             # Match one attr name/value pair
                 \s+                             # There needs to be at least 
some whitespace
                                                 # before each attribute name.
                 [\w.:_-]+               # Attribute name
                 \s*=\s*
                 (?:
                   ".+?"                         # "Attribute value"
                 |
                   '.+?'                         # 'Attribute value'
                 )
         )*                              # Zero or more

-- 
see shy jo

[1] Why you're maintaining markdown, and not me, that is. ;-)

Attachment: signature.asc
Description: Digital signature

Reply via email to