]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/plugins/shortcut/discussion.mdwn
%W is not as weird as it looks at first glance
[ikiwiki.git] / doc / plugins / shortcut / discussion.mdwn
index 770c958368b768ab35d2458bb8fe94c2cd0a8a96..7f0d58dbe1d52a3eb0a6c62a759a1c12668014f6 100644 (file)
@@ -3,25 +3,47 @@ disabled [[mdwn]], to get [[shortcut]] work, you need
 commit in a shortcuts.ext (ext is `rcs|creole|html|txt|etc`),
 and edit/patch [[shortcut]].
 
-Maybe use the $default_pageext is better than hardcode .mdwn?
-
-<pre>
---- shortcut.pm.orig    2009-02-12 02:05:22.000000000 -0600
-+++ shortcut.pm 2009-02-12 04:41:30.000000000 -0600
-@@ -23,9 +23,9 @@
-        if (defined $config{srcdir}) {
-                # Preprocess the shortcuts page to get all the available shortcuts
-                # defined before other pages are rendered.
--               my $srcfile=srcfile("shortcuts.mdwn", 1);
-+               my $srcfile=srcfile("shortcuts.$config{default_pageext}", 1);
-                if (! defined $srcfile) {
--                       error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
-+                       error(gettext("shortcut plugin will not work without a shortcuts.$config{default_pageext}"));
-                }
-                IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
-        }
-</pre>
+Maybe use the `default_pageext` is better than hardcode .mdwn?
 
 --[[weakish]]
 
+> done, it will use `default_pageext` now --[[Joey]] 
 
+---
+
+Instead of modifying the [[basewiki]]'s [[shortcuts]] file for local needs --
+thus copying it at some point and losing continuity with upstream enhancements --
+what about handling a `shortcuts-local.mdwn` or `shortcuts/local.mdwn` (if such
+a file exists in the wiki), and additionally process that one.  Possibily a
+conditional `\[[!inline]]` could be used.  --[[tschwinge]]
+
+----
+
+The page says
+
+> Additionally, %W is replaced with the text encoded just right for Wikipedia
+
+with the implication that this is odd. However, it appears the escapes
+actually mean:
+
+=%s=
+    If every character in the string is in the Latin-1 range, encode each
+    character as a http %xx escape: ö -> %F6. If not,
+    mangle the string: ☃ (U+2603 SNOWMAN) -> %2603 which
+    actually means "&03".
+=%S=
+    Leave the string as-is.
+=%W=
+    Encode the string as UTF-8, then encode each byte of the UTF-8
+    individually as a http %xx escape: ö -> %C3%B6, ☃ (U+2603 SNOWMAN) ->
+    %E2%98%83.
+
+http %xx encoding is defined in terms of input bytes, not input characters,
+so you can't encode arbitrary Unicode into URLs without knowing which
+encoding the destination server is going to use. UTF-8 is what's
+recommended by the [[!wikipedia Internationalized resource identifier]]
+specification, so I suspect %W is right more often than it's wrong...
+
+I wonder whether %s should mean what %W does now, with a new format
+character - maybe %L for Latin-1? - for the version that only works
+for strings that can be encoded losslessly in Latin-1? --[[smcv]]