From 937c0742322065452a204069e0ba5abc625ec0c6 Mon Sep 17 00:00:00 2001 From: Per Carlson Date: Thu, 17 Nov 2011 22:59:31 +0100 Subject: Always use true image size --- IkiWiki/Plugin/img.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index b98e843d4..a28d6a6d5 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -132,9 +132,9 @@ sub preprocess (@) { $imglink = $file; } } - - $dwidth = $im->Get("width") unless defined $dwidth; - $dheight = $im->Get("height") unless defined $dheight; + # always get the true size of the resized image + $dwidth = $im->Get("width"); + $dheight = $im->Get("height"); } } else { -- cgit v1.2.3 From 2872e1d738cafcd884f987f0efeea3fa83c4f470 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Nov 2011 18:47:51 -0400 Subject: cleanup now unused setting --- IkiWiki/Plugin/img.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index a28d6a6d5..b92e24cc0 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -118,7 +118,6 @@ sub preprocess (@) { error sprintf(gettext("failed to read %s: %s"), $outfile, $r) if $r; } else { - ($dwidth, $dheight)=($w, $h); $r = $im->Resize(geometry => "${w}x${h}"); error sprintf(gettext("failed to resize: %s"), $r) if $r; @@ -132,6 +131,7 @@ sub preprocess (@) { $imglink = $file; } } + # always get the true size of the resized image $dwidth = $im->Get("width"); $dheight = $im->Get("height"); -- cgit v1.2.3 From 64e09f9968c5db26aef7bfdd70bde7c86c8fa144 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 23 Nov 2011 16:13:16 -0400 Subject: cannot reproduce --- IkiWiki/Plugin/highlight.pm | 2 +- doc/bugs/Running_on_an_alternative_port_fails.mdwn | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm index 33d136fbf..4e86207f1 100644 --- a/IkiWiki/Plugin/highlight.pm +++ b/IkiWiki/Plugin/highlight.pm @@ -52,7 +52,7 @@ sub getsetup () { sub checkconfig () { eval q{use highlight}; - if (highlight::DataDir->can('new')){ + if (highlight::DataDir->can('new')) { $data_dir=new highlight::DataDir(); $data_dir->searchDataDir(""); } else { diff --git a/doc/bugs/Running_on_an_alternative_port_fails.mdwn b/doc/bugs/Running_on_an_alternative_port_fails.mdwn index c6e09171d..8b5fefa91 100644 --- a/doc/bugs/Running_on_an_alternative_port_fails.mdwn +++ b/doc/bugs/Running_on_an_alternative_port_fails.mdwn @@ -5,3 +5,12 @@ For example if you run on 'http://my.gear.xxx:8080/' then after clicking login ( -- fergus NB: both the 'url' and the 'cgiurl' include the port and removing the port element provides the expected functionality. + +> I tried to reproduce this by making my laptop's web server use port +> 8080. Set up ikiwiki to use that in cgiurl and url, and had +> no problem with either openid or password auth login. +> +> Ikiwiki has had some changes in this area in the past year; you don't say +> what version you were using. It could also be a problem with your web +> server, conceviably, if didn't correctly communicate the port to the cgi +> program. --[[Joey]] -- cgit v1.2.3 From 41f6363a633cffd002f3af9f8b216f56f8924ecc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 27 Nov 2011 13:19:19 -0400 Subject: editpage: Fix FormattingHelp link on Discussion pages. In 875d550f1278215e6c87d3b78ff87db24c6d76b3 I for some reason made $page be changed when creating a discussion page, which broke the link on the edit page. Changing page seems unnecessary, so reverted that part of the change. --- IkiWiki/Plugin/editpage.pm | 2 +- debian/changelog | 1 + ...-Discussion_pages_have_a_broken___34__FormattingHelp__34___link.mdwn | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index a5c29a352..54051c58c 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -231,7 +231,7 @@ sub cgi_editpage ($$) { if ! $form->submitted && lc($page) ne $page; } elsif (lc $page eq lc $config{discussionpage}) { - @page_locs=$best_loc=$page="$from/".lc($page); + @page_locs=$best_loc="$from/".lc($page); } else { my $dir=$from."/"; diff --git a/debian/changelog b/debian/changelog index 7f6564d7f..52d9ddf3e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ ikiwiki (3.20111107) UNRELEASED; urgency=low * img: Bugfix to width/height tags for scaled down image when only one dimension was provided. Thanks, Per Carlson. + * editpage: Fix FormattingHelp link on Discussion pages. -- Joey Hess Thu, 17 Nov 2011 18:52:23 -0400 diff --git a/doc/bugs/Sub-Discussion_pages_have_a_broken___34__FormattingHelp__34___link.mdwn b/doc/bugs/Sub-Discussion_pages_have_a_broken___34__FormattingHelp__34___link.mdwn index 0eadc5809..8f87329ae 100644 --- a/doc/bugs/Sub-Discussion_pages_have_a_broken___34__FormattingHelp__34___link.mdwn +++ b/doc/bugs/Sub-Discussion_pages_have_a_broken___34__FormattingHelp__34___link.mdwn @@ -1 +1,3 @@ For an example of what I mean, go to [[TourBusStop]]. Click the Discussion link. Click the FormattingHelp link. You'll be sent to [TourBusStop/ikiwiki/formatting](/TourBusStop/ikiwiki/formatting/) which of course doesn't exist. + +> A bug introduced in the last release. [[fixed|done]] --[[Joey]] -- cgit v1.2.3 From 44863ea2346eea32b3bc8b9b700101bf7ea3b32f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Nov 2011 14:40:27 -0400 Subject: graphviz: Support urls embedded in the graph, by having graphviz generate an imagemap. Also, I let preview mode write real files, rather than using data: uri. Which is ok these days, since ikiwiki tracks files created during previewing, and cleans them up later. --- IkiWiki/Plugin/graphviz.pm | 55 ++++++++++++++++++++++------------------ debian/changelog | 2 ++ doc/ikiwiki/directive/graph.mdwn | 8 ++---- 3 files changed, 34 insertions(+), 31 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index 4ed8b89f1..f01fdca85 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -26,10 +26,13 @@ my %graphviz_programs = ( "dot" => 1, "neato" => 1, "fdp" => 1, "twopi" => 1, "circo" => 1 ); +my $graphnum=0; + sub render_graph (\%) { my %params = %{(shift)}; - my $src = "$params{type} g {\n"; + $graphnum++; + my $src = "$params{type} graph$graphnum {\n"; $src .= "charset=\"utf-8\";\n"; $src .= "ratio=compress;\nsize=\"".($params{width}+0).", ".($params{height}+0)."\";\n" if defined $params{width} and defined $params{height}; @@ -39,48 +42,50 @@ sub render_graph (\%) { # Use the sha1 of the graphviz code as part of its filename. eval q{use Digest::SHA}; error($@) if $@; - my $dest=$params{page}."/graph-". - IkiWiki::possibly_foolish_untaint(Digest::SHA::sha1_hex($src)). - ".png"; + my $base=$params{page}."/graph-". + IkiWiki::possibly_foolish_untaint(Digest::SHA::sha1_hex($src)); + my $dest=$base.".png"; will_render($params{page}, $dest); - if (! -e "$config{destdir}/$dest") { + # The imagemap data is stored as a separate file. + my $imagemap=$base.".imagemap"; + will_render($params{page}, $imagemap); + + my $map; + if (! -e "$config{destdir}/$dest" || ! -e "$config{destdir}/$imagemap") { + # Use ikiwiki's function to create the image file, this makes + # sure needed subdirs are there and does some sanity checking. + writefile($dest, $config{destdir}, ""); + my $pid; my $sigpipe=0; $SIG{PIPE}=sub { $sigpipe=1 }; - $pid=open2(*IN, *OUT, "$params{prog} -Tpng"); + $pid=open2(*IN, *OUT, "$params{prog} -Tpng -o '$config{destdir}/$dest' -Tcmapx"); # open2 doesn't respect "use open ':utf8'" + binmode (IN, ':utf8'); binmode (OUT, ':utf8'); print OUT $src; close OUT; - my $png; - { - local $/ = undef; - $png = ; - } + local $/ = undef; + $map=; close IN; + writefile($imagemap, $config{destdir}, $map); waitpid $pid, 0; $SIG{PIPE}="DEFAULT"; - error gettext("failed to run graphviz") if $sigpipe; - - if (! $params{preview}) { - writefile($dest, $config{destdir}, $png, 1); - } - else { - # in preview mode, embed the image in a data uri - # to avoid temp file clutter - eval q{use MIME::Base64}; - error($@) if $@; - return ""; - } + error gettext("failed to run graphviz") if ($sigpipe || $?); + + } + else { + $map=readfile("$config{destdir}/$imagemap"); } - return "\n"; + return "\n". + $map; } sub graph (@) { diff --git a/debian/changelog b/debian/changelog index 73318b269..c77fbbeef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ ikiwiki (3.20111107) UNRELEASED; urgency=low * The umask setting can now be set to private, group, or public, avoiding the need to enter octal correctly which is particularly difficult in yaml setup files. (smcv) + * graphviz: Support urls embedded in the graph, by having graphviz + generate an imagemap. -- Joey Hess Thu, 17 Nov 2011 18:52:23 -0400 diff --git a/doc/ikiwiki/directive/graph.mdwn b/doc/ikiwiki/directive/graph.mdwn index 433187268..2828921d7 100644 --- a/doc/ikiwiki/directive/graph.mdwn +++ b/doc/ikiwiki/directive/graph.mdwn @@ -1,14 +1,10 @@ The `graph` directive is supplied by the [[!iki plugins/graphviz desc=graphviz]] plugin. -This directive allows embedding [graphviz](http://www.graphviz.org/) graphs in a -page. Example usage: +This directive allows embedding [graphviz](http://www.graphviz.org/) +graphs in a page. Example usage: \[[!graph src="a -> b -> c; a -> c;"]] -Note that graphs will only show up in previews if your browser has -[[!wikipedia data: URI]] support, or if the same graph already exists on that -page. - The `graph` directive supports the following parameters: - `src` - The graphviz source to render. -- cgit v1.2.3 From 997116f1602e1c1340d9a9839908f3350e2eb1ca Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Nov 2011 15:03:24 -0400 Subject: store imagemap in %pagestate, rather than a file Using a file was sorta not right. Note that when previewing, %pagestate is not saved, so it has to rebuild the graph every time until that graph is saved; then previews can use the cached data until the next time the graph is changed. Also note that it's stored in the destpage's pagestate. The imagemap could vary between a page and an inlined page if wikilinks were supported. --- IkiWiki/Plugin/graphviz.pm | 50 +++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index f01fdca85..4268f42ed 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -10,6 +10,7 @@ use IPC::Open2; sub import { hook(type => "getsetup", id => "graphviz", call => \&getsetup); + hook(type => "needsbuild", id => "version", call => \&needsbuild); hook(type => "preprocess", id => "graph", call => \&graph); } @@ -26,33 +27,41 @@ my %graphviz_programs = ( "dot" => 1, "neato" => 1, "fdp" => 1, "twopi" => 1, "circo" => 1 ); -my $graphnum=0; +sub needsbuild { + my $needsbuild=shift; + foreach my $page (keys %pagestate) { + if (exists $pagestate{$page}{graph} && + exists $pagesources{$page} && + grep { $_ eq $pagesources{$page} } @$needsbuild) { + # remove state, will be re-added if + # the graph is still there during the rebuild + delete $pagestate{$page}{graph}; + } + } + return $needsbuild; +} sub render_graph (\%) { my %params = %{(shift)}; - - $graphnum++; - my $src = "$params{type} graph$graphnum {\n"; - $src .= "charset=\"utf-8\";\n"; + + my $src = "charset=\"utf-8\";\n"; $src .= "ratio=compress;\nsize=\"".($params{width}+0).", ".($params{height}+0)."\";\n" if defined $params{width} and defined $params{height}; $src .= $params{src}; $src .= "}\n"; - - # Use the sha1 of the graphviz code as part of its filename. + + # Use the sha1 of the graphviz code as part of its filename, + # and as a unique identifier for its imagemap. eval q{use Digest::SHA}; error($@) if $@; - my $base=$params{page}."/graph-". - IkiWiki::possibly_foolish_untaint(Digest::SHA::sha1_hex($src)); - my $dest=$base.".png"; + my $sha=IkiWiki::possibly_foolish_untaint(Digest::SHA::sha1_hex($params{type}.$src)); + $src = "$params{type} graph$sha {\n".$src; + + my $dest=$params{page}."/graph-".$sha.".png"; will_render($params{page}, $dest); - # The imagemap data is stored as a separate file. - my $imagemap=$base.".imagemap"; - will_render($params{page}, $imagemap); - - my $map; - if (! -e "$config{destdir}/$dest" || ! -e "$config{destdir}/$imagemap") { + my $map=$pagestate{$params{destpage}}{graph}{$sha}; + if (! -e "$config{destdir}/$dest" || ! defined $map) { # Use ikiwiki's function to create the image file, this makes # sure needed subdirs are there and does some sanity checking. writefile($dest, $config{destdir}, ""); @@ -70,21 +79,16 @@ sub render_graph (\%) { close OUT; local $/ = undef; - $map=; + $map=$pagestate{$params{destpage}}{graph}{$sha}=; close IN; - writefile($imagemap, $config{destdir}, $map); waitpid $pid, 0; $SIG{PIPE}="DEFAULT"; error gettext("failed to run graphviz") if ($sigpipe || $?); - - } - else { - $map=readfile("$config{destdir}/$imagemap"); } return "\n". + "\" usemap=\"#graph$sha\" />\n". $map; } -- cgit v1.2.3 From 4cb343f3482edc3786ea46eea7efb7762d349164 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Nov 2011 15:42:42 -0400 Subject: graphviz: Support wikilinks embedded in the graph. (Sponsored by The TOVA Company.) --- IkiWiki/Plugin/graphviz.pm | 39 +++++++++++++++++++++++++++++++++++++-- debian/changelog | 2 ++ doc/ikiwiki/directive/graph.mdwn | 13 +++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index 4268f42ed..0889bc9fc 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -11,7 +11,7 @@ use IPC::Open2; sub import { hook(type => "getsetup", id => "graphviz", call => \&getsetup); hook(type => "needsbuild", id => "version", call => \&needsbuild); - hook(type => "preprocess", id => "graph", call => \&graph); + hook(type => "preprocess", id => "graph", call => \&graph, scan => 1); } sub getsetup () { @@ -94,7 +94,42 @@ sub render_graph (\%) { sub graph (@) { my %params=@_; - $params{src} = "" unless defined $params{src}; + + # Support wikilinks in the graph source. + my $src=$params{src}; + $src="" unless defined $src; + $src=IkiWiki::linkify($params{page}, $params{destpage}, $params{src}); + return unless defined wantarray; # scan mode short-circuit + if ($src ne $params{src}) { + # linkify makes html links, but graphviz wants plain + # urls. This is, frankly a hack: Process source as html, + # throw out everything inside tags that is not a href. + my $s; + my $nested=0; + use HTML::Parser; + error $@ if $@; + my $p=HTML::Parser->new(api_version => 3); + $p->handler(start => sub { + my %attrs=%{shift()}; + if (exists $attrs{href}) { + $s.="\"$attrs{href}\""; + } + $nested++; + }, "attr"); + $p->handler(end => sub { + $nested--; + }); + $p->handler(default => sub { + $s.=join("", @_) unless $nested; + }, "text"); + $p->parse($src); + $p->eof; + $params{src}=$s; + } + else { + $params{src}=$src; + } + $params{type} = "digraph" unless defined $params{type}; $params{prog} = "dot" unless defined $params{prog}; error gettext("prog not a valid graphviz program") unless $graphviz_programs{$params{prog}}; diff --git a/debian/changelog b/debian/changelog index c77fbbeef..885ce971b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ ikiwiki (3.20111107) UNRELEASED; urgency=low difficult in yaml setup files. (smcv) * graphviz: Support urls embedded in the graph, by having graphviz generate an imagemap. + * graphviz: Support wikilinks embedded in the graph. + (Sponsored by The TOVA Company.) -- Joey Hess Thu, 17 Nov 2011 18:52:23 -0400 diff --git a/doc/ikiwiki/directive/graph.mdwn b/doc/ikiwiki/directive/graph.mdwn index 2828921d7..6584a2178 100644 --- a/doc/ikiwiki/directive/graph.mdwn +++ b/doc/ikiwiki/directive/graph.mdwn @@ -5,6 +5,19 @@ graphs in a page. Example usage: \[[!graph src="a -> b -> c; a -> c;"]] +Nodes on the graph can link to external urls using regular graphviz syntax, +and a clickable imagemap will be created. As a special extension for +ikiwiki, [[WikiLinks|ikiwiki/wikilink]] can also be used. For example: + + \[[!graph src="""" + google [ href="http://google.com/" ] + sandbox [ href=[[SandBox]] ] + help [ href=[[ikiwiki/formatting]] ] + newpage [ href=[[NewPage]] ] + + google -> sandbox -> help -> newpage -> help -> google; + """"]] + The `graph` directive supports the following parameters: - `src` - The graphviz source to render. -- cgit v1.2.3 From 6cadcacffd76cf60739372029fb73ff333bdd6e5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Nov 2011 16:25:17 -0400 Subject: apply Postel's law --- IkiWiki/Plugin/graphviz.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index 0889bc9fc..b9f997e04 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -112,7 +112,15 @@ sub graph (@) { $p->handler(start => sub { my %attrs=%{shift()}; if (exists $attrs{href}) { - $s.="\"$attrs{href}\""; + if ($s=~/href\s*=\s*"$/) { + $s.=$attrs{href}; + } + elsif ($s=~/href\s*=\s*$/) { + $s.="\"$attrs{href}\""; + } + else { + $s.="href=\"$attrs{href}\""; + } } $nested++; }, "attr"); -- cgit v1.2.3 From 5333c113d62acd0b82551e499863abaf749a6a1f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 12 Nov 2011 15:11:02 +0000 Subject: Add path and path_natural sort orders (cherry picked from commit 272e0b2f17c33c625b494b07f581da400066a216) --- IkiWiki.pm | 1 + IkiWiki/Plugin/sortnaturally.pm | 5 +++++ doc/ikiwiki/pagespec/sorting.mdwn | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki.pm b/IkiWiki.pm index 59fefc699..08e242a1f 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -2808,6 +2808,7 @@ sub cmp_title { IkiWiki::pagetitle(IkiWiki::basename($b)) } +sub cmp_path { IkiWiki::pagetitle($a) cmp IkiWiki::pagetitle($b) } sub cmp_mtime { $IkiWiki::pagemtime{$b} <=> $IkiWiki::pagemtime{$a} } sub cmp_age { $IkiWiki::pagectime{$b} <=> $IkiWiki::pagectime{$a} } diff --git a/IkiWiki/Plugin/sortnaturally.pm b/IkiWiki/Plugin/sortnaturally.pm index b038b2f9a..108b489f8 100644 --- a/IkiWiki/Plugin/sortnaturally.pm +++ b/IkiWiki/Plugin/sortnaturally.pm @@ -30,4 +30,9 @@ sub cmp_title_natural { IkiWiki::pagetitle(IkiWiki::basename($b))) } +sub cmp_path_natural { + Sort::Naturally::ncmp(IkiWiki::pagetitle($a), + IkiWiki::pagetitle($b)) +} + 1; diff --git a/doc/ikiwiki/pagespec/sorting.mdwn b/doc/ikiwiki/pagespec/sorting.mdwn index ccd7f7eaa..0c6cc74c7 100644 --- a/doc/ikiwiki/pagespec/sorting.mdwn +++ b/doc/ikiwiki/pagespec/sorting.mdwn @@ -7,10 +7,14 @@ orders can be specified. * `mtime` - List pages with the most recently modified first. -* `title` - Order by title (page name). +* `title` - Order by title (page name), e.g. "z/a a/b a/c" + +* `path` - Order by page name including parents, e.g. "a/b a/c z/a" [[!if test="enabled(sortnaturally)" then=""" * `title_natural` - Orders by title, but numbers in the title are treated as such, ("1 2 9 10 20" instead of "1 10 2 20 9") + +* `path_natural` - Like `path`, but numbers in the title are treated as such """]] [[!if test="enabled(meta)" then=""" * `meta(title)` - Order according to the `\[[!meta title="foo" sortas="bar"]]` -- cgit v1.2.3 From 7411d1a6ce1dcb5d9f343a4a7a6633d3c30eecbf Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 24 Dec 2011 00:54:59 +0100 Subject: tag plugin: encode categories using numeric values This ensures that RSS/Atom feeds produced are valid XML. --- IkiWiki/Plugin/tag.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 096c92616..605f41599 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -201,7 +201,7 @@ sub pagetemplate (@) { if (defined $tags && %$tags) { eval q{use HTML::Entities}; $template->param(categories => - [map { category => HTML::Entities::encode_entities(tagname($_)) }, + [map { category => HTML::Entities::encode_entities_numeric(tagname($_)) }, sort keys %$tags]); } } -- cgit v1.2.3 From b8bf318b91d4fc4c79a16ba2f3265b4620412d51 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 27 Dec 2011 11:37:28 -0400 Subject: remove x bit from comments.pm how did that get set? --- IkiWiki/Plugin/comments.pm | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 IkiWiki/Plugin/comments.pm (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm old mode 100755 new mode 100644 -- cgit v1.2.3 From 9dce803faf4dac9ee9249a108e9054e296e1f741 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jan 2012 16:56:32 -0400 Subject: discount support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mdwn: Can use the discount markdown library, via the Text::Markdown::Discount perl module. This is preferred if available since it's the fastest currently supported markdown library, speeding up markdown rendering by a factor of 40. That is to say, when only rendering a lot of markdown, discount is 40x faster. When building a ikiwiki site, ikiwiki's other overhead gets in the way, but I still see significant speedups. Building the ikiwiki docwiki dropped from 62 to 45 seconds, for example. However, when multimarkdown is enabled, Text::Markdown::Multimarkdown is still used. While discount contains some nonstandard markdown extensions, including tables and footnotes, AFAICS most of them are not enabled by default in the perl bindings. I consider sticking to non-extended markdown a desirable thing, since this is probably not the last markdown engine. In particular, sundown is waiting in the wings to get packaged and get a perl binding. ---- Reviewing all the showdown extensions, here are the ones that are enabled: centered paragraphs: ->centered<- image sizes: [dust mite](http://dust.mite =150x150) blocks are eaten. The perl binding does not provide access to the gathered CSS. This is not legal html anyway, so unlikely to cause breakage. --- IkiWiki/Plugin/mdwn.pm | 6 ++++++ debian/changelog | 11 +++++++++++ doc/plugins/mdwn.mdwn | 9 ++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index b892eabee..0dc0cc336 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -50,6 +50,12 @@ sub htmlize (@) { } } } + if (! defined $markdown_sub) { + eval q{use Text::Markdown::Discount}; + if (! $@) { + $markdown_sub=\&Text::Markdown::Discount::markdown; + } + } if (! defined $markdown_sub) { eval q{use Text::Markdown}; if (! $@) { diff --git a/debian/changelog b/debian/changelog index 6cd19d7c2..a33b3d1b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +ikiwiki (3.20111230) UNRELEASED; urgency=low + + * mdwn: Can use the discount markdown library, via the + Text::Markdown::Discount perl module. This is preferred if available + since it's the fastest currently supported markdown library, speeding up + ikiwiki's rendering by a factor of 40. + (However, when multimarkdown is enabled, Text::Markdown::Multimarkdown + is still used.) + + -- Joey Hess Sun, 01 Jan 2012 16:22:24 -0400 + ikiwiki (3.20111229) unstable; urgency=low * Consume all stdin when rcs_receive short-circuits, diff --git a/doc/plugins/mdwn.mdwn b/doc/plugins/mdwn.mdwn index ce1b6097a..8a7308305 100644 --- a/doc/plugins/mdwn.mdwn +++ b/doc/plugins/mdwn.mdwn @@ -8,9 +8,12 @@ This is the standard markup language used by ikiwiki, although some others are also available in other plugins. There are several implementations of markdown support that can be used by -this plugin. The [original version of -markdown](http://daringfireball.net/projects/markdown/) can be used, or the -[[!cpan Text::Markdown]] perl module. +this plugin. In order of preference: + +* [Discount](http://www.pell.portland.or.us/~orc/Code/discount/), + via the [[!cpan Text::Markdown::Discount]] perl module. +* The [[!cpan Text::Markdown]] perl module. +* The [original version of markdown](http://daringfireball.net/projects/markdown/). [[!cpan Text::MultiMarkdown]] can be used in order to use tables, footnotes, and other new features from the markdown variant called -- cgit v1.2.3 From 12f86df239e8a6c1d554d86b5c56e2b8713f6cd8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jan 2012 17:24:21 -0400 Subject: workaround a bug in the discount perl binding Empty input, or input consisting soley of whitespace caused an uninitialized value warning. --- IkiWiki/Plugin/mdwn.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index 0dc0cc336..b10d08517 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -53,7 +53,12 @@ sub htmlize (@) { if (! defined $markdown_sub) { eval q{use Text::Markdown::Discount}; if (! $@) { - $markdown_sub=\&Text::Markdown::Discount::markdown; + $markdown_sub=sub { + # Workaround for discount binding bug + # https://rt.cpan.org/Ticket/Display.html?id=73657 + return "" if $_[0]=~/^\s*$/; + Text::Markdown::Discount::markdown(@_); + } } } if (! defined $markdown_sub) { -- cgit v1.2.3 From b38261a03aab649e3b194b7d1983536eee8a3684 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 15 Jan 2012 16:19:22 -0400 Subject: Workaround discount's eliding of