X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/54f600af14bf6dc067ffc30ec6f22d517001fe99..88c66d375884570386855792ad6652e0ed971869:/IkiWiki/Plugin/color.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/color.pm b/IkiWiki/Plugin/color.pm index d550dd9f4..e80130d92 100644 --- a/IkiWiki/Plugin/color.pm +++ b/IkiWiki/Plugin/color.pm @@ -38,12 +38,11 @@ sub preserve_style ($$$) { ($background =~ /^[a-z]+$/ || $background =~ /^#[0-9a-f]{3,6}$/)); my $preserved = ''; - $preserved .= ''; + $preserved .= ''.$text.''; + $preserved .= '">'.$text.''; return $preserved; @@ -52,8 +51,7 @@ sub preserve_style ($$$) { sub replace_preserved_style ($) { my $content = shift; - $content =~ s!((color: ([a-z]+|\#[0-9a-f]{3,6})?)?((; )?(background-color: ([a-z]+|\#[0-9a-f]{3,6})?)?)?)!!g; - $content =~ s!!!g; + $content =~ s!\s*\s*!!g; return $content; } @@ -61,12 +59,11 @@ sub replace_preserved_style ($) { sub preprocess (@) { my %params = @_; - # Preprocess the text to expand any preprocessor directives - # embedded inside it. - $params{text} = IkiWiki::preprocess($params{page}, $params{destpage}, - IkiWiki::filter($params{page}, $params{destpage}, $params{text})); - - return preserve_style($params{foreground}, $params{background}, $params{text}); + return preserve_style($params{foreground}, $params{background}, + # Preprocess the text to expand any preprocessor directives + # embedded inside it. + IkiWiki::preprocess($params{page}, $params{destpage}, + $params{text})); } sub format (@) {