diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-07-25 16:16:44 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-07-25 16:16:44 -0400 |
commit | a71b9a1cf1322cd1423971483969d37efa5ebcf8 (patch) | |
tree | f726ca780ff8f6f2d7b709ef8bdbfd171aaa1420 | |
parent | af5299677e3a3bdaef75e72f82ccc4600cbd2f66 (diff) | |
download | ikiwiki-a71b9a1cf1322cd1423971483969d37efa5ebcf8.tar ikiwiki-a71b9a1cf1322cd1423971483969d37efa5ebcf8.tar.gz |
fix feed urls
The fix for colons involved adding "./" to some urls. Due to the weird way
inline called urlto, these snuck into feed urls and permalinks. Fix it by
adding an optional third parameter to urlto.
-rw-r--r-- | IkiWiki.pm | 9 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 6 | ||||
-rw-r--r-- | doc/plugins/write.mdwn | 5 | ||||
-rw-r--r-- | po/ikiwiki.pot | 8 |
4 files changed, 18 insertions, 10 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index c14124f79..01e7cc1e4 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -545,10 +545,11 @@ sub beautify_urlpath ($) { #{{{ return $url; } #}}} -sub urlto ($$) { #{{{ +sub urlto ($$;$) { #{{{ my $to=shift; my $from=shift; - + my $absolute=shift; + if (! length $to) { return beautify_urlpath(baseurl($from)."index.$config{htmlext}"); } @@ -557,6 +558,10 @@ sub urlto ($$) { #{{{ $to=htmlpage($to); } + if ($absolute) { + return $config{url}.beautify_urlpath("/".$to); + } + my $link = abs2rel($to, dirname(htmlpage($from))); return beautify_urlpath($link); diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 5517e3c94..2f0901943 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -419,13 +419,13 @@ sub genfeed ($$$$$@) { #{{{ my $page=shift; my @pages=@_; - my $url=URI->new(encode_utf8($config{url}."/".urlto($page,""))); + my $url=URI->new(encode_utf8(urlto($page,"",1))); my $itemtemplate=template($feedtype."item.tmpl", blind_cache => 1); my $content=""; my $lasttime = 0; foreach my $p (@pages) { - my $u=URI->new(encode_utf8($config{url}."/".urlto($p, ""))); + my $u=URI->new(encode_utf8(urlto($p, "", 1))); my $pcontent = absolute_urls(get_inline_content($p, $page), $url); $itemtemplate->param( @@ -521,7 +521,7 @@ sub pingurl (@) { #{{{ foreach my $page (keys %toping) { my $title=pagetitle(basename($page), 0); - my $url="$config{url}/".urlto($page, ""); + my $url=urlto($page, "", 1); foreach my $pingurl (@{$config{pingurl}}) { debug("Pinging $pingurl for $page"); eval { diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 3dd8bdaa1..7c28088de 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -582,12 +582,15 @@ time. This is the standard gettext function, although slightly optimised. -#### `urlto($$)` +#### `urlto($$;$)` Construct a relative url to the first parameter from the page named by the second. The first parameter can be either a page name, or some other destination file, as registered by `will_render`. +If the third parameter is passed and is true, an absolute url will be +constructed instead of the default relative url. + #### `targetpage($$)` Passed a page and an extension, returns the filename that page will be diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index f5f35bff9..b6e2dc68c 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-07-25 15:21-0400\n" +"POT-Creation-Date: 2008-07-25 16:16-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -71,7 +71,7 @@ msgstr "" msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759 ../IkiWiki.pm:783 +#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759 ../IkiWiki.pm:788 msgid "Error" msgstr "" @@ -804,11 +804,11 @@ msgstr "" #. translators: preprocessor directive name, #. translators: the second a page name, the #. translators: third a number. -#: ../IkiWiki.pm:766 +#: ../IkiWiki.pm:771 #, perl-format msgid "%s preprocessing loop detected on %s at depth %i" msgstr "" -#: ../IkiWiki.pm:1214 +#: ../IkiWiki.pm:1219 msgid "yes" msgstr "" |