From e954ee7f039ca30830dc957927f3561bc57fff7f Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 30 Mar 2009 13:15:02 +0200 Subject: [PATCH] Accept attributes in inline image syntax The syntax ![alt](url "title" attr=val attr2=val2) is now valid --- bin/MultiMarkdown.pl | 9 +++++++++ 1 file changed, 9 insertions(+) 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; -- 2.32.0.93.g670b81a890