diff options
author | Changaco <Changaco@web> | 2010-09-04 14:04:51 +0000 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-09-04 14:04:51 +0000 |
commit | edb256d2d8c59754e074f71f24644d57442a24e9 (patch) | |
tree | d12b53202f3de630f74f2c3a48fbc2aa66079b4d /doc | |
parent | 3f9244ccf4b7e85acf7816217db67c0b34650854 (diff) | |
download | ikiwiki-edb256d2d8c59754e074f71f24644d57442a24e9.tar ikiwiki-edb256d2d8c59754e074f71f24644d57442a24e9.tar.gz |
added a patch to make it more like MediaWiki
Diffstat (limited to 'doc')
-rw-r--r-- | doc/plugins/contrib/headinganchors/discussion.mdwn | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/plugins/contrib/headinganchors/discussion.mdwn b/doc/plugins/contrib/headinganchors/discussion.mdwn index 91fe04a6d..151af8d92 100644 --- a/doc/plugins/contrib/headinganchors/discussion.mdwn +++ b/doc/plugins/contrib/headinganchors/discussion.mdwn @@ -1 +1,33 @@ Isn't this functionality a part of what [[plugins/toc]] needs and does? Then probably the [[plugins/toc]] plugin's code could be split into the part that implements the [[plugins/contrib/headinganchors]]'s functionality and the TOC generation itself. That will bring more order into the code and the set of available plugins. --Ivan Z. + +--- + +A patch to make it more like MediaWiki: + +<pre>--- headinganchors.pm ++++ headinganchors.pm +@@ -5,6 +5,7 @@ + use warnings; + use strict; + use IkiWiki 2.00; ++use URI::Escape; + + sub import { + hook(type => "sanitize", id => "headinganchors", call => \&headinganchors); +@@ -14,9 +15,11 @@ + my $str = shift; + $str =~ s/^\s+//; + $str =~ s/\s+$//; +- $str = lc($str); +- $str =~ s/[&\?"\'\.,\(\)!]//mig; +- $str =~ s/[^a-z]/_/mig; ++ $str =~ s/\s/_/g; ++ $str =~ s/"//g; ++ $str =~ s/^[^a-zA-Z]/z-/; # must start with an alphabetical character ++ $str = uri_escape_utf8($str); ++ $str =~ s/%/./g; + return $str; + } + </pre> + +--Changaco |