avoid linkifying escaped wikilinks

master
joey 2006-03-13 18:45:38 +00:00
parent 4796acdae7
commit ac69a97905
4 changed files with 13 additions and 15 deletions

View File

@ -20,10 +20,3 @@
replaced with a link to the [[CGI]]? replaced with a link to the [[CGI]]?
* [[ikiwiki]] should go to the same place as [[index]] (on this wiki). * [[ikiwiki]] should go to the same place as [[index]] (on this wiki).
* There's no way to escape a [[WikiLink]] when discussing one on a wiki. * There's no way to escape a [[WikiLink]] when discussing one on a wiki.
* Wikilinks are even expanded in the middle of [[MarkDown]] code blocks,
and probably shouldn't be (nor in blockquotes?)
Hmm, the best way to fix this would be to add WikiLink support into
markdown, but that will probably be a bear. I guess the question is how
common "[[ ]]" is, and maybe we should just provide a way to escape a
wikilink..

View File

@ -56,16 +56,16 @@ Make the html valid. Add css.
## sigs ## sigs
Need a way to sign name in page that's easier to type than "-- [[ Joey ]]" Need a way to sign name in page that's easier to type than "--\[[Joey]]"
and that includes the date. and that includes the date.
What syntax do other wikis use for this? I'm considering "[[ -- ]]" (with What syntax do other wikis use for this? I'm considering "\[[--]]" (with
spaces removed) as it has a nice nmemonic. spaces removed) as it has a nice nmemonic.
OTOH, adding additional syntax for this would be counter to one of the OTOH, adding additional syntax for this would be counter to one of the
design goals for ikiwiki: keeping as much markup as possible out of the design goals for ikiwiki: keeping as much markup as possible out of the
wiki and not adding nonstandard markup. And it's not significantly hard to wiki and not adding nonstandard markup. And it's not significantly hard to
type "--[[Joey]]", and as to the date, we do have page history. type "--\[[Joey]]", and as to the date, we do have page history.
## recentchanges links to commit diffs ## recentchanges links to commit diffs

View File

@ -1,6 +1,9 @@
WikiLinks provide easy linking between pages of the wiki. To create a WikiLinks provide easy linking between pages of the wiki. To create a
WikiLink, just put the name of the page to link to in double brackets. For [[WikiLink]], just put the name of the page to link to in double brackets.
examples "[[ WikiLink ]]" (without the added whitespace). For example "\[[WikiLink]]".
If you ever need to write something like "\[[WikiLink]] without creating a
wikilink, just prefix it with a "\", like "\\\\[[WikiLink]]".
Note that there are some special [[SubPage/LinkingRules]] that come into Note that there are some special [[SubPage/LinkingRules]] that come into
play when linking between [[SubPage]]s. play when linking between [[SubPage]]s.
@ -8,4 +11,4 @@ play when linking between [[SubPage]]s.
WikiLinks can be entered in any case you like, the page they link to is WikiLinks can be entered in any case you like, the page they link to is
always lowercased. always lowercased.
Note that if the file linked to by a WikiLink looks like an image, it will be displayed inline on the page. Note that if the file linked to by a WikiLink looks like an image, it will be displayed inline on the page.

View File

@ -172,7 +172,7 @@ sub findlinks ($) { #{{{
my $content=shift; my $content=shift;
my @links; my @links;
while ($content =~ /$config{wiki_link_regexp}/g) { while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
push @links, lc($1); push @links, lc($1);
} }
return @links; return @links;
@ -247,7 +247,9 @@ sub linkify ($$) { #{{{
my $content=shift; my $content=shift;
my $file=shift; my $file=shift;
$content =~ s/$config{wiki_link_regexp}/htmllink(pagename($file), $1)/eg; $content =~ s{(\\?)$config{wiki_link_regexp}}{
$1 ? "[[$2]]" : htmllink(pagename($file), $2)
}eg;
return $content; return $content;
} #}}} } #}}}