From c2e2da6ee2834d6ab68d06048588cdf3a27d3691 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 22 May 2009 13:09:11 -0400 Subject: ikiwiki-transition: deduplinks was broken and threw away all metadata stored by plugins in the index. Fix this bug. --- debian/NEWS | 11 ++++++++++- debian/changelog | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/NEWS b/debian/NEWS index 7daa350d9..c3574bdb6 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,6 +1,15 @@ +ikiwiki (3.13) UNRELEASED; urgency=low + + The `ikiwiki-transition deduplinks` command introduced in the + last release was buggy. If you followed the NEWS file instructions + and ran it, you should run `ikiwiki -setup` to rebuild your wiki + to fix the problem. + + -- Joey Hess Fri, 22 May 2009 13:04:02 -0400 + ikiwiki (3.12) unstable; urgency=low - You may want to run `ikiwiki-transition deduplinks /path/to/srcdir` + You may want to run `ikiwiki-transition deduplinks your.setup` after upgrading to this version of ikiwiki. This command will optimise your wiki's saved state, removing duplicate information that can slow ikiwiki down. diff --git a/debian/changelog b/debian/changelog index c0a4afbc8..f25cab5bb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ ikiwiki (3.13) UNRELEASED; urgency=low interpolation on user-supplied data when translating pagespecs. * ikiwiki-transition: Allow setup files to be passed to all subcommands that need a srcdir. + * ikiwiki-transition: deduplinks was broken and threw away all + metadata stored by plugins in the index. Fix this bug. -- Joey Hess Wed, 06 May 2009 20:45:44 -0400 -- cgit v1.2.3 From 8f6cdf3ae07536fdf1a197297b91677a1345eebc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 22 May 2009 14:17:26 -0400 Subject: listdirectives: Avoid listing _comment directives and generally assume any directive starting with _ is likewise internal. --- IkiWiki/Plugin/listdirectives.pm | 2 +- debian/NEWS | 2 +- debian/changelog | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'debian') diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm index d2cebca34..bd73f1a04 100644 --- a/IkiWiki/Plugin/listdirectives.pm +++ b/IkiWiki/Plugin/listdirectives.pm @@ -45,7 +45,7 @@ sub checkconfig () { sub needsbuild (@) { my $needsbuild=shift; - @fulllist = sort keys %{$IkiWiki::hooks{preprocess}}; + @fulllist = grep { ! /^_/ } sort keys %{$IkiWiki::hooks{preprocess}}; @shortlist = grep { ! $IkiWiki::hooks{preprocess}{$_}{shortcut} } @fulllist; $pluginstring = join(' ', @shortlist) . " : " . join(' ', @fulllist); diff --git a/debian/NEWS b/debian/NEWS index c3574bdb6..75b6d0471 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,4 +1,4 @@ -ikiwiki (3.13) UNRELEASED; urgency=low +ikiwiki (3.13) unstable; urgency=low The `ikiwiki-transition deduplinks` command introduced in the last release was buggy. If you followed the NEWS file instructions diff --git a/debian/changelog b/debian/changelog index f25cab5bb..71445ea71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ikiwiki (3.13) UNRELEASED; urgency=low +ikiwiki (3.13) unstable; urgency=low * ikiwiki-transition: If passed a nonexistant srcdir, or one not containing .ikiwiki, abort with an error rather than creating it. @@ -13,8 +13,10 @@ ikiwiki (3.13) UNRELEASED; urgency=low that need a srcdir. * ikiwiki-transition: deduplinks was broken and threw away all metadata stored by plugins in the index. Fix this bug. + * listdirectives: Avoid listing _comment directives and generally + assume any directive starting with _ is likewise internal. - -- Joey Hess Wed, 06 May 2009 20:45:44 -0400 + -- Joey Hess Fri, 22 May 2009 14:10:56 -0400 ikiwiki (3.12) unstable; urgency=low -- cgit v1.2.3 From 8ae260015fa6ecd5aa39a84898f42837935c9953 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 22 May 2009 22:57:03 -0400 Subject: highlight: New plugin supporting syntax highlighting of pretty much anything. * debian/control: Add suggests for libhighlight-perl, although that package is not yet created by Debian's highlight source package. (See #529869) --- IkiWiki/Plugin/highlight.pm | 118 +++++++++++++++++++++ debian/changelog | 10 ++ debian/control | 2 +- doc/plugins/highlight.mdwn | 72 +++++++++++++ doc/style.css | 18 ++++ ..._use_of_syntax_plugin_on_source_code_files.mdwn | 3 + doc/todo/syntax_highlighting.mdwn | 28 ++--- doc/todo/syntax_highlighting/discussion.mdwn | 2 + ...wiki-formatted_comments_with_syntax_plugin.mdwn | 5 + 9 files changed, 240 insertions(+), 18 deletions(-) create mode 100644 IkiWiki/Plugin/highlight.pm create mode 100644 doc/plugins/highlight.mdwn (limited to 'debian') diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm new file mode 100644 index 000000000..f43f18628 --- /dev/null +++ b/IkiWiki/Plugin/highlight.pm @@ -0,0 +1,118 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::highlight; + +use warnings; +use strict; +use IkiWiki 3.00; +use highlight; + +# locations of highlight's files +my $filetypes="/etc/highlight/filetypes.conf"; +my $langdefdir="/usr/share/highlight/langDefs"; + +sub import { + hook(type => "getsetup", id => "highlight", call => \&getsetup); + hook(type => "checkconfig", id => "highlight", call => \&checkconfig); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => 1, # format plugin + }, + tohighlight => { + type => "string", + example => ".c, .h, .cpp, .pl, .py, Makefile:make", + description => "source files to syntax highlight", + safe => 1, + rebuild => 1, + }, +} + +sub checkconfig () { + if (exists $config{tohighlight}) { + foreach my $file (split /, /, $config{tohighlight}) { + my @opts = $file=~s/^\.// ? + (keepextension => 1) : + (noextension => 1); + my $ext = $file=~s/:(.*)// ? $1 : $file; + + my $langfile=ext2langfile($ext); + if (! defined $langfile) { + error(sprintf(gettext( + "tohighlight contains unknown file type '%s'"), + $ext)); + } + + hook( + type => "htmlize", + id => $file, + call => sub { + my %params=@_; + highlight($langfile, $params{content}); + }, + longname => sprintf(gettext("Source code: %s"), $file), + @opts, + ); + } + } +} + +my %ext2lang; +my $filetypes_read=0; + +# Parse highlight's config file to get extension => language mappings. +sub read_filetypes () { + open (IN, $filetypes); + while () { + chomp; + if (/^\$ext\((.*)\)=(.*)$/) { + $ext2lang{$_}=$1 foreach $1, split ' ', $2; + } + } + close IN; + $filetypes_read=1; +} + +sub langfile ($) { + return "$langdefdir/$_[0].lang"; +} + +# Given a filename extension, determines the language definition to +# use to highlight it. +sub ext2langfile ($) { + my $ext=shift; + + read_filetypes() unless $filetypes_read; + if (exists $ext2lang{$ext}) { + return langfile($ext2lang{$ext}); + } + # If a language only has one common extension, it will not + # be listed in filetypes, so check the langfile. + elsif (-e langfile($ext)) { + return langfile($ext); + } + else { + return undef; + } +} + +# Interface to the highlight C library. +sub highlight ($$) { + my $langfile=shift; + my $input=shift; + + my $gen = highlightc::CodeGenerator_getInstance($highlightc::XHTML); + $gen->setFragmentCode(1); # generate html fragment + $gen->setHTMLEnclosePreTag(1); # include stylish
+	$gen->initLanguage($langfile);
+	$gen->initTheme("/dev/null"); # theme is not needed because CSS is not emitted
+	$gen->setEncoding("utf-8");
+
+	my $output=$gen->generateString($input);
+	highlightc::CodeGenerator_deleteInstance($gen);
+	return $output;
+}
+
+1
diff --git a/debian/changelog b/debian/changelog
index 71445ea71..db3e32cda 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+ikiwiki (3.14) UNRELEASED; urgency=low
+
+  * highlight: New plugin supporting syntax highlighting of pretty much
+    anything.
+  * debian/control: Add suggests for libhighlight-perl, although
+    that package is not yet created by Debian's highlight source package.
+    (See #529869)
+
+ -- Joey Hess   Fri, 22 May 2009 22:03:12 -0400
+
 ikiwiki (3.13) unstable; urgency=low
 
   * ikiwiki-transition: If passed a nonexistant srcdir, or one not
diff --git a/debian/control b/debian/control
index 57c5f917a..233de8f7c 100644
--- a/debian/control
+++ b/debian/control
@@ -35,7 +35,7 @@ Suggests: viewvc | gitweb | viewcvs, libsearch-xapian-perl,
   liblocale-gettext-perl (>= 1.05-1), libtext-typography-perl,
   libtext-csv-perl, libdigest-sha1-perl, graphviz, libnet-amazon-s3-perl,
   sparkline-php, texlive, dvipng, libtext-wikicreole-perl,
-  libsort-naturally-perl, libtext-textile-perl
+  libsort-naturally-perl, libtext-textile-perl, libhighlight-perl
 Conflicts: ikiwiki-plugin-table
 Replaces: ikiwiki-plugin-table
 Provides: ikiwiki-plugin-table
diff --git a/doc/plugins/highlight.mdwn b/doc/plugins/highlight.mdwn
new file mode 100644
index 000000000..07e888f36
--- /dev/null
+++ b/doc/plugins/highlight.mdwn
@@ -0,0 +1,72 @@
+[[!template id=plugin name=highlight author="[[Joey]]"]]
+[[!tag type/format]]
+
+This plugin allows ikiwiki to syntax highlight source files, using
+a fast syntax highlighter that supports over a hundred programming
+languages and file formats.
+
+## prerequisites
+
+You will need to install the perl bindings to the
+[highlight library](http://www.andre-simon.de/), which in Debian
+are in the [[!debpkg libhighlight-perl]] package.
+
+## configuration
+
+Nothing will be highlighted by default.
+To enable syntax highlighting, use the `tohighlight` setting in your
+setup file to control which files should be syntax highlighted.
+Here is a typical setting for it, enabling highlighting for files
+with the extensions .c, etc, and also for any files named "Makefile".
+
+	tohighlight => .c, .h, .cpp, .pl, .py, Makefile:make",
+
+It knows what language to use for most filename extensions (see
+`/etc/highlight/filetypes.conf` for a partial list), but if you want to
+bind an unusual filename extension, or any file without an extension
+(such as a Makefile), to a language, you can do so by appending a colon
+and the name of the language, as illustrated for Makefiles above.
+
+## embedding highlighted code
+
+To embed highlighted code on a page, you can use the
+[[ikiwiki/directive/format]] directive.
+
+For example:
+
+	\[[!format c """
+	void main () {
+		printf("hello, world!");
+	}
+	"""]]
+
+You can do this for any of the extensions/filenames enabled in
+`tohighlight`.
+
+## colors
+
+The colors etc used for the syntax highlighting are entirely configurable
+by CSS. See ikiwiki's [[style.css]] for the defaults.
+
+## limitations
+
+With this plugin enabled, source files become full-fledged ikiwiki pages,
+which means they can include [[WikiLinks|ikiwiki/wikilink]] and
+[[directives|ikiwiki/directive]] like any other page can, and are also
+affected by the [[smiley]] plugin, if it is enabled. This can be
+annoying if your code accidentially contains things that look like those.
+
+On the other hand, this also allows your syntax highlighed
+source code to contain markdown formatted comments and hyperlinks
+to other code files, like this:
+
+	/* \[[!format mdwn """
+		This comment will be formatted as *markdown*!
+
+		See [[bar.h]].
+	""]] */
+
+## security
+
+This lets anyone who can edit a page in your wiki also edit
+source code files that are in your wiki. Use appropriate caution.
diff --git a/doc/style.css b/doc/style.css
index 74d968ddf..e6512aed8 100644
--- a/doc/style.css
+++ b/doc/style.css
@@ -389,3 +389,21 @@ span.color {
 	border: 1px solid #aaa;
 	padding: 3px;
 }
+
+/* Used by the highlight plugin. */
+
+pre.hl { color:#000000; background-color:#ffffff; }
+.hl.num { color:#2928ff; }
+.hl.esc { color:#ff00ff; }
+.hl.str { color:#ff0000; }
+.hl.dstr { color:#818100; }
+.hl.slc { color:#838183; font-style:italic; }
+.hl.com { color:#838183; font-style:italic; }
+.hl.dir { color:#008200; }
+.hl.sym { color:#000000; }
+.hl.line { color:#555555; }
+.hl.mark { background-color:#ffffbb; }
+.hl.kwa { color:#000000; font-weight:bold; }
+.hl.kwb { color:#830000; }
+.hl.kwc { color:#000000; font-weight:bold; }
+.hl.kwd { color:#010181; }
diff --git a/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files.mdwn b/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files.mdwn
index cd5ff34de..71b4b88f0 100644
--- a/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files.mdwn
+++ b/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files.mdwn
@@ -12,3 +12,6 @@ this would allow the use of ikiwiki for [[!wikipedia literate programming]].
 * I have started something along these lines see [[plugins/contrib/sourcehighlight]].  For some reason I started with source-highlight [[DavidBremner]]
 
 * I wonder if this is similar to what you want: 
+
+> The new [[plugins/highlight]] plugin is in ikiwiki core and supports
+> source code files natively. [[done]] --[[Joey]] 
diff --git a/doc/todo/syntax_highlighting.mdwn b/doc/todo/syntax_highlighting.mdwn
index 81ba19bc8..01aa7b576 100644
--- a/doc/todo/syntax_highlighting.mdwn
+++ b/doc/todo/syntax_highlighting.mdwn
@@ -28,13 +28,17 @@ things easier for the user.
   also uses source-highlight, and operates on whole source files.
   Updated to work with the fix for [[bugs/multiple_pages_with_same_name]].  Untested with files with no extension, e.g. `Makefile`.
 * [[users/jasonblevins]]'s code plugin uses source-highlight, and supports both
-  while file and directive use.
+  whole file and directive use.
 
 * [hlsimple](http://pivot.cs.unb.ca/git/?p=ikiplugins.git;a=blob_plain;f=IkiWiki/Plugin/hlsimple.pm;hb=HEAD) is a wrapper for the the perl module [[!cpan Syntax::Highlight::Engine::Simple]].  This is pure perl, pretty simple, uses css. It ought to be pretty fast (according to the author, and just because it is not external).
 On the other hand, there are not many predefined languages yet.  Defining language syntaxes is about as much 
 work as source-highlight, but in perl.  I plan to package the base module for debian. Perhaps after the author 
 releases the 5 or 6 language definitions he has running on his web site, it might be suitable for inclusion in ikiwiki. [[DavidBremner]]
 
+* [[plugins/highlight]] uses [highlight](http://www.andre-simon.de) via
+  its swig bindings. It supports whole files only. It uses either
+  keepextension or noextension, as appropriate for the type of file.
+
 ## General problems / requirements
 
 * Using non-perl syntax highlighting backends is slower. All things equal,
@@ -56,7 +60,6 @@ releases the 5 or 6 language definitions he has running on his web site, it migh
   > it has a pass-through feature that I find very useful.  My memory is unfortunately a bit fuzzy as to how
   > well the swig bindings work. [[DavidBremner]]
 
-
 * Engines that already support a wide variety of file types are of
   course preferred. If the engine doesn't support a particular type
   of file, it could fall back to doing something simple like
@@ -105,20 +108,11 @@ releases the 5 or 6 language definitions he has running on his web site, it migh
 
   Perhaps the thing to do here is to use the new `longname` parameter to
   the format hook, to give them all names that will group together at or
-  near the end of the list. Ie: "Syntax: perl", "Syntax: C", etc.
-
-## format directive and comments
-
-Hmm, the [[ikiwiki/directive/format]] directive would also allow comments
-inside source files to have mdwn embedded in them, without making the use
-of mdwn a special case, or needing to postprocess the syntax highlighter
-output to find comments.
-
-	/* \[[!format mdwn """
-
-	This is a comment in my C file. You can use mdwn in here.
+  near the end of the list. Ie: "Syntax: perl", "Source code: c", etc.
 
-	"""]] */
+---
 
-Note that this assumes that directives are expanded in source files,
-which has its own set of problems.
+I'm calling this [[done]] since I added the [[plugins/highlight]]
+plugin. There are some unresolved issues touched on here,
+but they either have the own other bug reports, or are documented
+as semi-features in the docs to the plugin. --[[Joey]] 
diff --git a/doc/todo/syntax_highlighting/discussion.mdwn b/doc/todo/syntax_highlighting/discussion.mdwn
index 7a4095c65..27cb7084b 100644
--- a/doc/todo/syntax_highlighting/discussion.mdwn
+++ b/doc/todo/syntax_highlighting/discussion.mdwn
@@ -24,3 +24,5 @@ repository?  --[[JasonBlevins]]
 >> [[sourcecode|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]
 >> plugin only adds the file extensions listed in the config.  This shouldn't cause
 >> massive drop-down menu pollution.  -- [[Will]]
+
+>>> That seems to be the way to go! --[[Joey]] 
diff --git a/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn b/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn
index a5244c9ef..7a4a295d4 100644
--- a/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn
+++ b/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn
@@ -2,3 +2,8 @@
 wiki syntax within the comments of code pretty-printed with the
 [[plugins/contrib/syntax]] plugin.  This would allow the use of links and
 formatting in comments.
+
+> You can do this using the [[plugins/highlight]] plugin, but you have
+> to explicitly put a format directive in the comment to do it. Thus,
+> I'm leaving this open for now.. ideally, comments would be detected,
+> and formatted as markdown. --[[Joey]] 
-- 
cgit v1.2.3


From 47298b01c1921deff7e056406245a90f8371bd59 Mon Sep 17 00:00:00 2001
From: Joey Hess 
Date: Sat, 23 May 2009 05:17:26 -0400
Subject: allow format to use any language supported by highlight

format: Provide a htmlizefallback hook that other plugins can use to
handle formats that are not suitable for general-purpose htmlize hooks.

highlight: Use the hook to allow formatting of any language/extension,
without it needing to be enabled for standalone source files.

highlight: If the highlight perl binding is not available, fallback
safely to a passthrough mode.
---
 IkiWiki/Plugin/format.pm          | 28 +++++++++++-----
 IkiWiki/Plugin/highlight.pm       | 21 +++++++++++-
 debian/changelog                  |  3 ++
 doc/plugins/highlight.mdwn        | 67 ++++++++++++++++++++-------------------
 doc/todo/syntax_highlighting.mdwn |  6 ++--
 5 files changed, 82 insertions(+), 43 deletions(-)

(limited to 'debian')

diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm
index bbe3aa9fe..1513cbed7 100644
--- a/IkiWiki/Plugin/format.pm
+++ b/IkiWiki/Plugin/format.pm
@@ -10,21 +10,33 @@ sub import {
 }
 
 sub preprocess (@) {
-	my $format=$_[0];
-	shift; shift;
-	my $text=$_[0];
-	shift; shift;
 	my %params=@_;
+	my $format=shift;
+	shift;
+	my $text=IkiWiki::preprocess($params{page}, $params{destpage}, shift);
+	shift;
 
 	if (! defined $format || ! defined $text) {
 		error(gettext("must specify format and text"));
 	}
-	elsif (! exists $IkiWiki::hooks{htmlize}{$format}) {
-		error(sprintf(gettext("unsupported page format %s"), $format));
+	elsif (exists $IkiWiki::hooks{htmlize}{$format}) {
+		return IkiWiki::htmlize($params{page}, $params{destpage},
+		                        $format, $text);
 	}
+	else {
+		# Other plugins can register htmlizefallback
+		# hooks to add support for page types
+		# not suitable for htmlize. Try them until
+		# one succeeds.
+		my $ret;
+		IkiWiki::run_hooks(htmlizefallback => sub {
+			$ret=shift->($format, $text)
+				unless defined $ret;
+		});
+		return $ret if defined $ret;
 
-	return IkiWiki::htmlize($params{page}, $params{destpage}, $format,
-		IkiWiki::preprocess($params{page}, $params{destpage}, $text));
+		error(sprintf(gettext("unsupported page format %s"), $format));
+	}
 }
 
 1
diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm
index 117ab5898..f116c41dd 100644
--- a/IkiWiki/Plugin/highlight.pm
+++ b/IkiWiki/Plugin/highlight.pm
@@ -4,7 +4,6 @@ package IkiWiki::Plugin::highlight;
 use warnings;
 use strict;
 use IkiWiki 3.00;
-use highlight;
 
 # locations of highlight's files
 my $filetypes="/etc/highlight/filetypes.conf";
@@ -13,6 +12,9 @@ my $langdefdir="/usr/share/highlight/langDefs";
 sub import {
 	hook(type => "getsetup", id => "highlight",  call => \&getsetup);
 	hook(type => "checkconfig", id => "highlight", call => \&checkconfig);
+	# this hook is used by the format plugin
+	hook(type => "htmlizefallback", id => "highlight", call =>
+		\&htmlizefallback);
 }
 
 sub getsetup () {
@@ -59,6 +61,17 @@ sub checkconfig () {
 	}
 }
 
+sub htmlizefallback {
+	my $format=lc shift;
+	my $langfile=ext2langfile($format);
+
+	if (! defined $langfile) {
+		return;
+	}
+
+	return highlight($langfile, shift);
+}
+
 my %ext2lang;
 my $filetypes_read=0;
 
@@ -103,6 +116,12 @@ sub highlight ($$) {
 	my $langfile=shift;
 	my $input=shift;
 
+	eval q{use highlight};
+	if ($@) {
+		print STDERR gettext("warning: highlight perl module not available; falling back to pass through");
+		return $input;
+	}
+
 	my $gen = highlightc::CodeGenerator_getInstance($highlightc::XHTML);
 	$gen->setFragmentCode(1); # generate html fragment
 	$gen->setHTMLEnclosePreTag(1); # include stylish 
diff --git a/debian/changelog b/debian/changelog
index db3e32cda..8088fa705 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ ikiwiki (3.14) UNRELEASED; urgency=low
   * debian/control: Add suggests for libhighlight-perl, although
     that package is not yet created by Debian's highlight source package.
     (See #529869)
+  * format: Provide a htmlizefallback hook that other plugins
+    can use to handle formats that are not suitable for general-purpose
+    htmlize hooks. Used by highlight.
 
  -- Joey Hess   Fri, 22 May 2009 22:03:12 -0400
 
diff --git a/doc/plugins/highlight.mdwn b/doc/plugins/highlight.mdwn
index 5172af759..44ced80f7 100644
--- a/doc/plugins/highlight.mdwn
+++ b/doc/plugins/highlight.mdwn
@@ -1,7 +1,7 @@
 [[!template id=plugin name=highlight author="[[Joey]]"]]
 [[!tag type/format]]
 
-This plugin allows ikiwiki to syntax highlight source files, using
+This plugin allows ikiwiki to syntax highlight source code, using
 a fast syntax highlighter that supports over a hundred programming
 languages and file formats.
 
@@ -11,26 +11,10 @@ You will need to install the perl bindings to the
 [highlight library](http://www.andre-simon.de/), which in Debian
 are in the [[!debpkg libhighlight-perl]] package.
 
-## configuration
-
-Nothing will be highlighted by default.
-To enable syntax highlighting, use the `tohighlight` setting in your
-setup file to control which files should be syntax highlighted.
-Here is a typical setting for it, enabling highlighting for files
-with the extensions .c, etc, and also for any files named "Makefile".
-
-	tohighlight => ".c .h .cpp .pl .py Makefile:make",
-
-It knows what language to use for most filename extensions (see
-`/etc/highlight/filetypes.conf` for a partial list), but if you want to
-bind an unusual filename extension, or any file without an extension
-(such as a Makefile), to a language, you can do so by appending a colon
-and the name of the language, as illustrated for Makefiles above.
-
 ## embedding highlighted code
 
 To embed highlighted code on a page, you can use the
-[[ikiwiki/directive/format]] directive.
+[[format]] plugin.
 
 For example:
 
@@ -40,21 +24,36 @@ For example:
 	}
 	"""]]
 
-You can do this for any of the extensions/filenames enabled in
-`tohighlight`.
+	\[[!format diff """
+	-bar
+	+foo
+	"""]]
 
-## colors
+You can do this for any extension or language name supported by
+the [highlight library](http://www.andre-simon.de/) -- basically anything
+you can think of should work.
 
-The colors etc used for the syntax highlighting are entirely configurable
-by CSS. See ikiwiki's [[style.css]] for the defaults.
+## highlighting entire source files
 
-## limitations
+To enable syntax highlighting of entire standalone source files, use the
+`tohighlight` setting in your setup file to control which files should be
+syntax highlighted. Here is a typical setting for it, enabling highlighting
+for files with the extensions .c, etc, and also for any files named
+"Makefile".
 
-With this plugin enabled, source files become full-fledged ikiwiki pages,
-which means they can include [[WikiLinks|ikiwiki/wikilink]] and
-[[directives|ikiwiki/directive]] like any other page can, and are also
-affected by the [[smiley]] plugin, if it is enabled. This can be
-annoying if your code accidentially contains things that look like those.
+	tohighlight => ".c .h .cpp .pl .py Makefile:make",
+
+It knows what language to use for most filename extensions (see
+`/etc/highlight/filetypes.conf` for a partial list), but if you want to
+bind an unusual filename extension, or any file without an extension
+(such as a Makefile), to a language, you can do so by appending a colon
+and the name of the language, as illustrated for Makefiles above.
+
+With the plugin configured this way, source files become full-fledged
+wiki pages, which means they can include [[WikiLinks|ikiwiki/wikilink]]
+and [[directives|ikiwiki/directive]] like any other page can, and are also
+affected by the [[smiley]] plugin, if it is enabled. This can be annoying
+if your code accidentially contains things that look like those.
 
 On the other hand, this also allows your syntax highlighed
 source code to contain markdown formatted comments and hyperlinks
@@ -66,7 +65,11 @@ to other code files, like this:
 		See \[[bar.h]].
 	""]] */
 
-## security
+Finally, bear in mind that this lets anyone who can edit a page in your
+wiki also edit source code files that are in your wiki. Use appropriate
+caution.
+
+## colors
 
-This lets anyone who can edit a page in your wiki also edit
-source code files that are in your wiki. Use appropriate caution.
+The colors etc used for the syntax highlighting are entirely configurable
+by CSS. See ikiwiki's [[style.css]] for the defaults.
diff --git a/doc/todo/syntax_highlighting.mdwn b/doc/todo/syntax_highlighting.mdwn
index 01aa7b576..3d122829b 100644
--- a/doc/todo/syntax_highlighting.mdwn
+++ b/doc/todo/syntax_highlighting.mdwn
@@ -36,8 +36,10 @@ work as source-highlight, but in perl.  I plan to package the base module for de
 releases the 5 or 6 language definitions he has running on his web site, it might be suitable for inclusion in ikiwiki. [[DavidBremner]]
 
 * [[plugins/highlight]] uses [highlight](http://www.andre-simon.de) via
-  its swig bindings. It supports whole files only. It uses either
-  keepextension or noextension, as appropriate for the type of file.
+  its swig bindings. It optionally supports whole files, but also
+  integrates with the format directive to allow formatting of *any* of
+  highlight's supported formats. (For whole files, it uses either
+  keepextension or noextension, as appropriate for the type of file.)
 
 ## General problems / requirements
 
-- 
cgit v1.2.3


From fd7db49f941eab604fcabdf78b3c36c743005d34 Mon Sep 17 00:00:00 2001
From: Joey Hess 
Date: Mon, 25 May 2009 12:40:40 -0400
Subject: Fix test suite to not rely on an installed copy of ikiwiki after
 underlaydir change. Closes: #530502

---
 debian/changelog         | 2 ++
 t/basewiki_brokenlinks.t | 1 +
 2 files changed, 3 insertions(+)

(limited to 'debian')

diff --git a/debian/changelog b/debian/changelog
index 8088fa705..2be245191 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ ikiwiki (3.14) UNRELEASED; urgency=low
   * format: Provide a htmlizefallback hook that other plugins
     can use to handle formats that are not suitable for general-purpose
     htmlize hooks. Used by highlight.
+  * Fix test suite to not rely on an installed copy of ikiwiki after
+    underlaydir change. Closes: #530502
 
  -- Joey Hess   Fri, 22 May 2009 22:03:12 -0400
 
diff --git a/t/basewiki_brokenlinks.t b/t/basewiki_brokenlinks.t
index 479c71a93..2871b1dd2 100755
--- a/t/basewiki_brokenlinks.t
+++ b/t/basewiki_brokenlinks.t
@@ -14,6 +14,7 @@ foreach my $plugin ("", "listdirectives") {
 			"-plugin smiley ".
 			($plugin ? "-plugin $plugin " : "").
 			"-underlaydir=t/tmp/install/usr/share/ikiwiki/basewiki ".
+			"-set underlaydirbase=t/tmp/install/usr/share/ikiwiki ".
 			"-templatedir=templates t/basewiki_brokenlinks t/tmp/out"));
 	my $result=`grep 'no broken links' t/tmp/out/index.html`;
 	ok(length($result));
-- 
cgit v1.2.3


From 52dc080ed149c3c23511fedc513f5a49d1415510 Mon Sep 17 00:00:00 2001
From: Joey Hess 
Date: Thu, 28 May 2009 11:06:03 -0400
Subject: Danish translation update. Closes: #530877

---
 debian/changelog | 1 +
 po/da.po         | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

(limited to 'debian')

diff --git a/debian/changelog b/debian/changelog
index 2be245191..c29c272dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ ikiwiki (3.14) UNRELEASED; urgency=low
     htmlize hooks. Used by highlight.
   * Fix test suite to not rely on an installed copy of ikiwiki after
     underlaydir change. Closes: #530502
+  * Danish translation update. Closes: #530877
 
  -- Joey Hess   Fri, 22 May 2009 22:03:12 -0400
 
diff --git a/po/da.po b/po/da.po
index 34d298bbf..341300cd9 100644
--- a/po/da.po
+++ b/po/da.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: ikiwiki\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2009-05-25 09:19+0200\n"
-"PO-Revision-Date: 2009-04-26 23:34+0100\n"
+"PO-Revision-Date: 2009-05-28 14:58+0200\n"
 "Last-Translator: Jonas Smedegaard \n"
 "Language-Team: None\n"
 "MIME-Version: 1.0\n"
@@ -378,17 +378,17 @@ msgstr "prog er ikke et gyldigt graphviz-program"
 #: ../IkiWiki/Plugin/highlight.pm:46
 #, perl-format
 msgid "tohighlight contains unknown file type '%s'"
-msgstr ""
+msgstr "tohighlight indeholder ukendt filtype '%s'"
 
 #: ../IkiWiki/Plugin/highlight.pm:57
 #, perl-format
 msgid "Source code: %s"
-msgstr ""
+msgstr "Kildekode: %s"
 
 #: ../IkiWiki/Plugin/highlight.pm:122
 msgid ""
 "warning: highlight perl module not available; falling back to pass through"
-msgstr ""
+msgstr "advarsel: highlight perl modul ikke tilgængelig: falder tilbage til simpel gennemkørsel"
 
 #: ../IkiWiki/Plugin/img.pm:62
 msgid "Image::Magick is not installed"
-- 
cgit v1.2.3


From 42cc56f796dee9b6fcff830aa63f769ccbd6e5ad Mon Sep 17 00:00:00 2001
From: Joey Hess 
Date: Mon, 1 Jun 2009 13:11:18 -0400
Subject: releasing version 3.14

---
 debian/changelog | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'debian')

diff --git a/debian/changelog b/debian/changelog
index c29c272dc..4a1844e06 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-ikiwiki (3.14) UNRELEASED; urgency=low
+ikiwiki (3.14) unstable; urgency=low
 
   * highlight: New plugin supporting syntax highlighting of pretty much
     anything.
@@ -12,7 +12,7 @@ ikiwiki (3.14) UNRELEASED; urgency=low
     underlaydir change. Closes: #530502
   * Danish translation update. Closes: #530877
 
- -- Joey Hess   Fri, 22 May 2009 22:03:12 -0400
+ -- Joey Hess   Mon, 01 Jun 2009 13:05:34 -0400
 
 ikiwiki (3.13) unstable; urgency=low
 
-- 
cgit v1.2.3


From 5cdee82ef6c8f9fa888b35ef81f2bcc35dd8ce4a Mon Sep 17 00:00:00 2001
From: Joey Hess 
Date: Tue, 2 Jun 2009 17:06:46 -0400
Subject: comment: Make comment directives no longer use the internal
 "_comment" form, and document the comment directive syntax.

Rationalle: Comments need to be user-editable so that they can be posted
via git commit etc.

The _comment directive is still supported, for back-compat.
---
 IkiWiki/Plugin/comments.pm         |  4 +++-
 debian/changelog                   |  7 +++++++
 doc/ikiwiki/directive/comment.mdwn | 38 ++++++++++++++++++++++++++++++++++++++
 doc/plugins/comments.mdwn          |  2 +-
 templates/editcomment.tmpl         |  1 -
 5 files changed, 49 insertions(+), 3 deletions(-)
 create mode 100644 doc/ikiwiki/directive/comment.mdwn

(limited to 'debian')

diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 0aa4759d8..517e16f9f 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -21,6 +21,8 @@ my %commentstate;
 sub import {
 	hook(type => "checkconfig", id => 'comments',  call => \&checkconfig);
 	hook(type => "getsetup", id => 'comments',  call => \&getsetup);
+	hook(type => "preprocess", id => 'comment', call => \&preprocess);
+	# here for backwards compatability with old comments
 	hook(type => "preprocess", id => '_comment', call => \&preprocess);
 	hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi);
 	hook(type => "htmlize", id => "_comment", call => \&htmlize);
@@ -377,7 +379,7 @@ sub editcomment ($$) {
 
 	my $location=unique_comment_location($page, $config{srcdir});
 
-	my $content = "[[!_comment format=$type\n";
+	my $content = "[[!comment format=$type\n";
 
 	# FIXME: handling of double quotes probably wrong?
 	if (defined $session->param('name')) {
diff --git a/debian/changelog b/debian/changelog
index 4a1844e06..cee073b3a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ikiwiki (3.15) UNRELEASED; urgency=low
+
+  * comment: Make comment directives no longer use the internal "_comment"
+    form, and document the comment directive syntax.
+
+ -- Joey Hess   Tue, 02 Jun 2009 17:03:41 -0400
+
 ikiwiki (3.14) unstable; urgency=low
 
   * highlight: New plugin supporting syntax highlighting of pretty much
diff --git a/doc/ikiwiki/directive/comment.mdwn b/doc/ikiwiki/directive/comment.mdwn
new file mode 100644
index 000000000..f03664d13
--- /dev/null
+++ b/doc/ikiwiki/directive/comment.mdwn
@@ -0,0 +1,38 @@
+The `comment` directive is supplied by the
+[[!iki plugins/comment desc=comment]] plugin, and is used to add a comment
+to a page. Typically, the directive is the only thing on a comment page,
+and is filled out by the comment plugin when a user posts a comment.
+
+Example:
+
+	\[[!comment format=mdwn
+	username="foo"
+	subject="Bar"
+	date="2009-06-02T19:05:01Z"
+	content="""
+	Blah blah.
+	"""
+	]]
+
+## usage
+
+The only required parameter is `content`, the others just add or override
+metadata of the comment.
+
+* `content` - Text to display for the comment.
+  Note that [[directives|ikiwiki/directive]]
+  may not be allowed, depending on the configuration
+  of the comment plugin.
+* `format` - Specifies the markup used for the content.
+* `subject` - Subject for the comment.
+* `date` - Date the comment was posted. Can be entered in
+  nearly any format, since it's parsed by [[!cpan TimeDate]]
+* `username` - Used to record the username (or OpenID)
+  of a logged in commenter.
+* `ip` - Can be used to record the IP address of a commenter,
+  if they posted anonymously.
+* `claimedauthor` - Records the name that the user entered,
+  if anonmous commenters are allowed to enter their (unverified)
+  name.
+
+[[!meta robots="noindex, follow"]]
diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn
index c13a6daa6..7e2232411 100644
--- a/doc/plugins/comments.mdwn
+++ b/doc/plugins/comments.mdwn
@@ -19,7 +19,7 @@ users can only post comments.
 
 Individual comments are stored as internal-use pages named something like
 `page/comment_1`, `page/comment_2`, etc. These pages internally use a
-`\[[!_comment]]` [[ikiwiki/directive]].
+[[comment_directive|ikiwiki/directive/comment]].
 
 There are some global options for the setup file:
 
diff --git a/templates/editcomment.tmpl b/templates/editcomment.tmpl
index 27d9457d4..545edb596 100644
--- a/templates/editcomment.tmpl
+++ b/templates/editcomment.tmpl
@@ -16,7 +16,6 @@ Website:  (optional)
Subject:


-IkiWiki directives ([[!directive]]) are not allowed in comments on this wiki.
-- cgit v1.2.3 From 6842328405494dd4971d3bfa443901084efe87ed Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 4 Jun 2009 13:15:05 -0400 Subject: Avoid relying on translators preserving the case when translating "discussion", which caused Discussion pages to get unwanted Discussion links. --- IkiWiki/Render.pm | 2 +- debian/changelog | 3 +++ doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index adae9f0d5..ba1d1eae5 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -76,7 +76,7 @@ sub genpage ($$) { $actions++; } if ($config{discussion}) { - my $discussionlink=gettext("discussion"); + my $discussionlink=lc(gettext("Discussion")); if ($page !~ /.*\/\Q$discussionlink\E$/ && (length $config{cgiurl} || exists $links{$page."/".$discussionlink})) { diff --git a/debian/changelog b/debian/changelog index cee073b3a..be1db6f3c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ ikiwiki (3.15) UNRELEASED; urgency=low * comment: Make comment directives no longer use the internal "_comment" form, and document the comment directive syntax. + * Avoid relying on translators preserving the case when translating + "discussion", which caused Discussion pages to get unwanted Discussion + links. -- Joey Hess Tue, 02 Jun 2009 17:03:41 -0400 diff --git a/doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn b/doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn index c7506c6de..c74a094ce 100644 --- a/doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn +++ b/doc/bugs/unwanted_discussion_links_on_discussion_pages.mdwn @@ -31,4 +31,6 @@ A simple fix that seems to work is to make this regexp case-insensitive: But the best way would be to avoid assuming implicitely that translators will translate "discussion" and "Discussion" the same way. +> [[done]] --[[Joey]] + [[!tag patch]] -- cgit v1.2.3 From bd78168f71c078c481f6afca899796390133e09e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 5 Jun 2009 16:14:51 -0400 Subject: Tighten up matching of bare words inside directives Do not allow an unterminated """ string to be treated as a series of bare words. Fixes runaway regexp recursion/backtracking in strange situations. (See 1d57a21c987a5e970df01efe10acdf69982c2d61 for test case.) --- IkiWiki.pm | 4 ++-- debian/changelog | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/IkiWiki.pm b/IkiWiki.pm index 061a1c6db..d7c827c89 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1253,7 +1253,7 @@ sub preprocess ($$$;$$) { | "[^"]+" # single-quoted value | - [^\s\]]+ # unquoted value + [^"\s\]]+ # unquoted value ) \s* # whitespace or end # of directive @@ -1276,7 +1276,7 @@ sub preprocess ($$$;$$) { | "[^"]+" # single-quoted value | - [^\s\]]+ # unquoted value + [^"\s\]]+ # unquoted value ) \s* # whitespace or end # of directive diff --git a/debian/changelog b/debian/changelog index be1db6f3c..bbc9b2c15 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,10 @@ ikiwiki (3.15) UNRELEASED; urgency=low * Avoid relying on translators preserving the case when translating "discussion", which caused Discussion pages to get unwanted Discussion links. + * Tighten up matching of bare words inside directives; do not + allow an unterminated """ string to be treated as a series + of bare words. Fixes runaway regexp recursion/backtracking + in strange situations. -- Joey Hess Tue, 02 Jun 2009 17:03:41 -0400 -- cgit v1.2.3 From 0293ae8e3d8e7dfd0a92bf20aa4c3d28e2d78ddb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 5 Jun 2009 16:58:06 -0400 Subject: Setup automator: Check that each plugin added to the generated setup file can be loaded and that its config is ok. If a plugin fails for any reason, disable it in the generated file. Closes: 532001 --- IkiWiki/Setup/Automator.pm | 23 +++++++++++++++++++++++ debian/changelog | 4 ++++ 2 files changed, 27 insertions(+) (limited to 'debian') diff --git a/IkiWiki/Setup/Automator.pm b/IkiWiki/Setup/Automator.pm index 5111541e4..742d67666 100644 --- a/IkiWiki/Setup/Automator.pm +++ b/IkiWiki/Setup/Automator.pm @@ -98,6 +98,29 @@ sub import (@) { } } + # Make sure that all the listed plugins can load + # and checkconfig is ok. If a plugin fails to work, + # remove it from the configuration and keep on truckin'. + my %bakconfig=%config; # checkconfig can modify %config so back up + if (! eval { IkiWiki::loadplugins(); IkiWiki::checkconfig() }) { + foreach my $plugin (@{$config{default_plugins}}, @{$bakconfig{add_plugins}}) { + eval { + # delete all hooks so that only this plugins's + # checkconfig will be run + %IkiWiki::hooks=(); + IkiWiki::loadplugin($plugin); + IkiWiki::run_hooks(checkconfig => sub { shift->() }); + }; + if ($@) { + print STDERR sprintf(gettext("** Disabling plugin %s, since it is failing with this message:"), + $plugin)."\n"; + print STDERR "$@\n"; + push @{$bakconfig{disable_plugins}}, $plugin; + } + } + } + %config=%bakconfig; + # Generate setup file. require IkiWiki::Setup; IkiWiki::Setup::dump($config{dumpsetup}); diff --git a/debian/changelog b/debian/changelog index bbc9b2c15..7d0fb5c80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,10 @@ ikiwiki (3.15) UNRELEASED; urgency=low allow an unterminated """ string to be treated as a series of bare words. Fixes runaway regexp recursion/backtracking in strange situations. + * Setup automator: Check that each plugin added to the generated + setup file can be loaded and that its config is ok. If a plugin + fails for any reason, disable it in the generated file. + Closes: 532001 -- Joey Hess Tue, 02 Jun 2009 17:03:41 -0400 -- cgit v1.2.3 From e8d8386e5258c055f253b20ad717461972b11c7d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 5 Jun 2009 18:04:39 -0400 Subject: pagecount: Fix broken optimisation for * pagespec. --- IkiWiki/Plugin/pagecount.pm | 9 +++++++-- debian/changelog | 1 + doc/bugs/pagecount_is_broken.mdwn | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index 1955603b0..5a2301af4 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -26,8 +26,13 @@ sub preprocess (@) { # register a dependency. add_depends($params{page}, $params{pages}); - my @pages=pagespec_match_list([keys %pagesources], $params{pages}, location => $params{page}) - if $params{pages} ne "*"; # optimisation; + my @pages; + if ($params{pages} eq "*") { + @pages=keys %pagesources; + } + else { + @pages=pagespec_match_list([keys %pagesources], $params{pages}, location => $params{page}); + } return $#pages+1; } diff --git a/debian/changelog b/debian/changelog index 7d0fb5c80..df4429326 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ ikiwiki (3.15) UNRELEASED; urgency=low setup file can be loaded and that its config is ok. If a plugin fails for any reason, disable it in the generated file. Closes: 532001 + * pagecount: Fix broken optimisation for * pagespec. -- Joey Hess Tue, 02 Jun 2009 17:03:41 -0400 diff --git a/doc/bugs/pagecount_is_broken.mdwn b/doc/bugs/pagecount_is_broken.mdwn index 179981855..101230d94 100644 --- a/doc/bugs/pagecount_is_broken.mdwn +++ b/doc/bugs/pagecount_is_broken.mdwn @@ -1 +1,3 @@ The [[plugins/pagecount]] plugin seems to be broken, as it claims there are [[!pagecount ]] pages in this wiki. (if it's not 0, the bug is fixed) + +[[fixed|done]] --[[Joey]] -- cgit v1.2.3 From e40d2a6b2b1bdf677f11cc4a71595acf609d1e75 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 6 Jun 2009 02:36:40 -0400 Subject: goto: Support being passed a page title that is not a valid page name, to support several cases including mercurial's long user names on the RecentChanges page, and urls with spaces being handled by the 404 plugin. --- IkiWiki/Plugin/goto.pm | 6 ++++++ debian/changelog | 4 ++++ doc/bugs/goto_with_bad_page_name.mdwn | 2 ++ 3 files changed, 12 insertions(+) (limited to 'debian') diff --git a/IkiWiki/Plugin/goto.pm b/IkiWiki/Plugin/goto.pm index 3f40c5859..2e2dc04a1 100644 --- a/IkiWiki/Plugin/goto.pm +++ b/IkiWiki/Plugin/goto.pm @@ -32,6 +32,12 @@ sub cgi_goto ($;$) { } } + # It's possible that $page is not a valid page name; + # if so attempt to turn it into one. + if ($page !~ /$config{wiki_file_regexp}/) { + $page=titlepage($page); + } + IkiWiki::loadindex(); # If the page is internal (like a comment), see if it has a diff --git a/debian/changelog b/debian/changelog index df4429326..7f8257813 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,10 @@ ikiwiki (3.15) UNRELEASED; urgency=low fails for any reason, disable it in the generated file. Closes: 532001 * pagecount: Fix broken optimisation for * pagespec. + * goto: Support being passed a page title that is not a valid page + name, to support several cases including mercurial's long user + names on the RecentChanges page, and urls with spaces being handled + by the 404 plugin. -- Joey Hess Tue, 02 Jun 2009 17:03:41 -0400 diff --git a/doc/bugs/goto_with_bad_page_name.mdwn b/doc/bugs/goto_with_bad_page_name.mdwn index 722c4e266..bc462c840 100644 --- a/doc/bugs/goto_with_bad_page_name.mdwn +++ b/doc/bugs/goto_with_bad_page_name.mdwn @@ -20,4 +20,6 @@ pass it through titlepage if not. with spaces" to "http://wiki/some_page_with_spaces", if the latter exists. That seems like a fairly good thing.) +[[done]] + --[[Joey]] -- cgit v1.2.3