From: Giuseppe Bilotta Date: Mon, 30 Mar 2009 11:15:02 +0000 (+0200) Subject: Accept attributes in inline image syntax X-Git-Url: http://git.oblomov.eu/multimarkdown/commitdiff_plain?ds=inline Accept attributes in inline image syntax The syntax ![alt](url "title" attr=val attr2=val2) is now valid --- diff --git a/bin/MultiMarkdown.pl b/bin/MultiMarkdown.pl index 88fd69c..4177af8 100755 --- a/bin/MultiMarkdown.pl +++ b/bin/MultiMarkdown.pl @@ -941,6 +941,11 @@ sub _DoImages { \5 # matching quote [ \t]* )? # title is optional + # MultiMarkdown addition for attribute support + ( # Attributes = $7 + (?<=\s) # lookbehind for whitespace + (([ \t]*\n)?[ \t]*((\S+=\S+)|(\S+=".*?")))* + )? \) ) }{ @@ -949,6 +954,7 @@ sub _DoImages { my $alt_text = $2; my $url = $3; my $title = (defined $6) ? $6 : ''; + my $attrs = $7; $alt_text =~ s/"/"/g; $title =~ s/"/"/g; @@ -966,6 +972,9 @@ sub _DoImages { $title =~ s! _ !$g_escape_table{'_'}!gx; $result .= " title=\"$title\""; } + if (defined $attrs) { + $result .= " $attrs"; + } $result .= $g_empty_element_suffix; $result;