From 5a128f3d6333b16200512b33b5265b1b1e8f3837 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 28 Jan 2007 01:01:33 +0000 Subject: [PATCH] * Replace underscores in shortcut texts with spaces when formatting for display. This allows using a shortcut like [[wikipedia War_of_1812]], which links to the correct remote page, but is displayed nicely. --- IkiWiki/Plugin/shortcut.pm | 1 + debian/changelog | 5 ++++- doc/bugs/shortcuts_don__39__t_escape_from_Markdown.mdwn | 4 +++- doc/plugins/shortcut.mdwn | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index 2a4a36a41..26385f3a6 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -54,6 +54,7 @@ sub shortcut_expand ($$@) { #{{{ my $encoded_text=$text; $encoded_text=~s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $text=~s/_/ /g; if (defined $desc) { $desc=~s/\%s/$text/g; } diff --git a/debian/changelog b/debian/changelog index cd134a2c7..f7ae8d5ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,8 +14,11 @@ ikiwiki (1.41) UNRELEASED; urgency=low * Always call rcs_update after a commit during a web edit, to work around the problem described in bugs/svn_fails_to_update. Thanks to Ethan for the analysis and patch. + * Replace underscores in shortcut texts with spaces when formatting for + display. This allows using a shortcut like [[wikipedia War_of_1812]], + which links to the correct remote page, but is displayed nicely. - -- Joey Hess Sat, 27 Jan 2007 19:18:27 -0500 + -- Joey Hess Sat, 27 Jan 2007 19:59:58 -0500 ikiwiki (1.40) unstable; urgency=low diff --git a/doc/bugs/shortcuts_don__39__t_escape_from_Markdown.mdwn b/doc/bugs/shortcuts_don__39__t_escape_from_Markdown.mdwn index f5c4db660..f977dc354 100644 --- a/doc/bugs/shortcuts_don__39__t_escape_from_Markdown.mdwn +++ b/doc/bugs/shortcuts_don__39__t_escape_from_Markdown.mdwn @@ -2,4 +2,6 @@ Writing [[wikipedia Low_frequency_oscillation]] causes the word "frequency" to show up in italics, since underscores are Markdown for italics. Using [[wikipedia low frequency oscillation]] works in this case, because Wikipedia will redirect, but it's hardly clean. Maybe the shortcuts plugin should -run pagetitle() on the text of its link? --Ethan \ No newline at end of file +run pagetitle() on the text of its link? --Ethan + +> [[bugs/done]] --[[Joey]] diff --git a/doc/plugins/shortcut.mdwn b/doc/plugins/shortcut.mdwn index 33180b120..83d8593a8 100644 --- a/doc/plugins/shortcut.mdwn +++ b/doc/plugins/shortcut.mdwn @@ -5,7 +5,7 @@ This plugin allows external links to commonly linked to sites to be made more easily using shortcuts. Some examples of using shortcuts include: \[[google foo]] - \[[wikipedia War of 1812]] + \[[wikipedia War_of_1812]] \[[debbug 12345]] The available shortcuts are defined on the [[shortcuts]] page in -- 2.39.5