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.
master
Joey Hess 2008-07-25 16:16:44 -04:00
parent af5299677e
commit a71b9a1cf1
4 changed files with 18 additions and 10 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -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

View File

@ -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 ""