diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-21 15:12:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-21 15:22:35 -0400 |
commit | 886890b82d727385f5bb167ef7684288e98a5218 (patch) | |
tree | 8b1ce9718b28c8596cb7de7068a4d17b165a5af6 /doc/plugins/headinganchors | |
parent | aef8bef8acd06aa3b13c95cfdc78dfc129482a97 (diff) | |
download | ikiwiki-886890b82d727385f5bb167ef7684288e98a5218.tar ikiwiki-886890b82d727385f5bb167ef7684288e98a5218.tar.gz |
move headinganchors out of contrib
Diffstat (limited to 'doc/plugins/headinganchors')
-rw-r--r-- | doc/plugins/headinganchors/discussion.mdwn | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/plugins/headinganchors/discussion.mdwn b/doc/plugins/headinganchors/discussion.mdwn new file mode 100644 index 000000000..151af8d92 --- /dev/null +++ b/doc/plugins/headinganchors/discussion.mdwn @@ -0,0 +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 |