]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Make directives generated by shortcuts accept a `desc` parameter.
authorAdeodato Simó <dato@net.com.org.es>
Sun, 2 Mar 2008 16:29:02 +0000 (17:29 +0100)
committerJoey Hess <joey@kodama.kitenet.net>
Sun, 2 Mar 2008 23:04:09 +0000 (18:04 -0500)
(cherry picked from commit 252da396bfa728b99af7c9bb304a7b5f3f6d94e6)

IkiWiki/Plugin/shortcut.pm
debian/changelog
doc/shortcuts.mdwn
doc/todo/shortcut_with_different_link_text.mdwn

index fb096ecbd8677d183634bfae095ec40895bfbf2c..c3e1f5446f6c98ca9f3c9c65a7a014b7c7e15c59 100644 (file)
@@ -62,6 +62,9 @@ sub shortcut_expand ($$@) { #{{{
        }eg;
 
        $text=~s/_/ /g;
+       if (defined $params{desc}) {
+               $desc=$params{desc};
+       }
        if (defined $desc) {
                $desc=~s/\%s/$text/g;
        }
index e5d6b44f6882ac50741b4207d8eebab252ff1929..bfd3266cb2921ce65226d2bc0b5216607f326ce9 100644 (file)
@@ -1,3 +1,11 @@
+ikiwiki (2.41) UNRELEASED; urgency=low
+
+  * Preprocessor directives generated by the shortcut plugin accept a `desc`
+    parameter that overrides the anchor text provided at shortcut definition
+    time. (Closes: #458126)
+
+ -- Adeodato Simó <dato@net.com.org.es>  Sun, 02 Mar 2008 17:19:16 +0100
+
 ikiwiki (2.40) unstable; urgency=low
 
   [ Josh Triplett ]
index e4e7408970f4b96933666c12c81212da3cc2a84d..8c0700165b63c3ab429c3d72e3b26da50de45640 100644 (file)
@@ -7,6 +7,7 @@ Some examples of using shortcuts include:
        \[[!google foo]]
        \[[!wikipedia War_of_1812]]
        \[[!debbug 12345]]
+       Check the \[[!cia ikiwiki desc="CIA page for %s"]].
 
 This page controls what shortcut links the wiki supports.
 
@@ -62,7 +63,8 @@ controls the description of the link.
 
 Remember that the `name` you give the shortcut will become a new
 [[ikiwiki/PreprocessorDirective]].  Avoid using a `name` that conflicts
-with an existing directive.
+with an existing directive.  These directives also accept a `desc`
+parameter that will override the one provided at definition time.
 
 If you come up with a shortcut that you think others might find useful,
 consider contributing it to the [shortcuts page on the ikiwiki
index 07e999642bc2068742c58c5122e0793998d676f0..93f9651a4b75866c5e40317e2a7aca2684cc7520 100644 (file)
@@ -57,5 +57,11 @@ So that the 'l' plugin inserts the location the page there, and markdown does th
 
 For external links, that is no concern, however. So you could define for each shortcut an alternative directive, that inserts the URL. Perhaps `\[[url shortcutname params]]` or `\[[@shortcutname params]]` (if the preprocessor supported the @), and this could be extended to local links in an obvious manner: `\[[url page]]` or `\[[@page]]`. Now, if you could just get rid off the parantheses for markdown, for the short inline links --[[tuomov]] (who'd really rather not have two separate linking mechanisms: ikiwiki's heavy syntax and markdown's lighter one).
 
+---
+
+I've added code to make the \[[foo 123]] syntax accept a _desc_
+parameter. I've named it like this to signal that it overrides the
+_desc_ provided at description time. `%s` is expanded here as well.
 
+[[todo/done]] -- Adeodato Simó