From: Joey Hess Date: Wed, 29 Jun 2011 18:43:51 +0000 (-0400) Subject: Merge branch 'master' of ssh://git.ikiwiki.info X-Git-Tag: 3.20110707~29 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/631c0d9e7c3892abb79bcb31b5769390846a07c3?hp=0802f92561a8e05da0299e3a1c94bebdd7c8d1e5 Merge branch 'master' of ssh://git.ikiwiki.info --- diff --git a/IkiWiki.pm b/IkiWiki.pm index 766226338..7035cb034 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1026,7 +1026,7 @@ sub bestlink ($$) { sub isinlinableimage ($) { my $file=shift; - return $file =~ /\.(png|gif|jpg|jpeg)$/i; + return $file =~ /\.(png|gif|jpg|jpeg|svg)$/i; } sub pagetitle ($;$) { diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 103f6b2b3..b98e843d4 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -64,10 +64,11 @@ sub preprocess (@) { my $dir = $params{page}; my $base = IkiWiki::basename($file); + my $issvg = $base=~s/\.svg$/.png/i; eval q{use Image::Magick}; error gettext("Image::Magick is not installed") if $@; - my $im = Image::Magick->new; + my $im = Image::Magick->new($issvg ? (magick => "png") : ()); my $imglink; my $r = $im->Read($srcfile); error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r; diff --git a/debian/changelog b/debian/changelog index 8191a212a..7b8d84e45 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,10 @@ ikiwiki (3.20110609) UNRELEASED; urgency=low * Add libtext-multimarkdown-perl to Suggests. Closes: #630705 * headinganchors: Plugin by Paul Wise that adds ids to headings. * html5 is not experimental anymore. But not the default either, quite yet. + * Support svg as a inlinable image type; svg images can be included on a + page by simply linking to them, or by using the img directive. + Note that sanitizing svg files is still not addressed. + * img: Generate png format thumbnails for svg images. -- Joey Hess Thu, 09 Jun 2011 10:06:44 -0400 diff --git a/doc/bugs/SVG_files_not_recognized_as_images.mdwn b/doc/bugs/SVG_files_not_recognized_as_images.mdwn index 207edd426..b14cd9b94 100644 --- a/doc/bugs/SVG_files_not_recognized_as_images.mdwn +++ b/doc/bugs/SVG_files_not_recognized_as_images.mdwn @@ -17,6 +17,16 @@ The 'img' plugin also seems to not support SVGs. > image (png). The img plugin could probably do that fairly simply. > --[[Joey]] +>> This seems to have improved since; at least chromium can display svg +>> images from `` tags. Firefox 3.5.19 did not in my testing. +>> +>> So, svgs can now be included on pages by linking to them, or by using +>> the img directive. The most portable thing is to use the img directive +>> plus some size, which forces them to be resized and a png to actually +>> be displayed. +>> +>> I have not yet tried to do anything with sanitizing them. --[[Joey]] + >> I'm working on inline SVG and MathML support in ikiwiki and I've >> modified my htmlscrubber to sanitize SVG and MathML using the >> whitelists from html5lib. Here's a [patch][]. I've also made some