From 02b9f69ba5da59cca9ff198b731d63d643fff4db Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 1 Apr 2007 19:59:42 +0000 Subject: * Finally apply the index.html patch, with thanks to everyone who worked on and supported creating it (especially Tumov). This adds a "usedirs" option that makes ikiwiki use foo/index.html instead of foo.html as output page names. It is not yet enabled by default. --- IkiWiki/Plugin/aggregate.pm | 8 ++++++-- IkiWiki/Plugin/inline.pm | 30 +++++++++++------------------- IkiWiki/Plugin/linkmap.pm | 4 +--- 3 files changed, 18 insertions(+), 24 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 6e4834ce0..bb5edfa65 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -321,7 +321,7 @@ sub add_page (@) { #{{{ # NB: This doesn't check for path length limits. eval q{use POSIX}; my $max=POSIX::pathconf($config{srcdir}, &POSIX::_PC_NAME_MAX); - if (defined $max && length(htmlpage($page)) >= $max) { + if (defined $max && length(htmlfn($page)) >= $max) { $c=""; $page=$feed->{dir}."/item"; while (exists $IkiWiki::pagecase{lc $page.$c} || @@ -357,7 +357,7 @@ sub add_page (@) { #{{{ if (ref $feed->{tags}) { $template->param(tags => [map { tag => $_ }, @{$feed->{tags}}]); } - writefile(htmlpage($guid->{page}), $config{srcdir}, + writefile(htmlfn($guid->{page}), $config{srcdir}, $template->output); # Set the mtime, this lets the build process get the right creation @@ -435,4 +435,8 @@ sub pagefile ($) { #{{{ return "$config{srcdir}/".htmlpage($page); } #}}} +sub htmlfn ($) { #{{{ + return shift().".html"; +} #}}} + 1 diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index dcaaa21eb..fc1dfdac3 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -124,8 +124,8 @@ sub preprocess_inline (@) { #{{{ # sure to be updated. add_depends($params{page}, join(" or ", @list)); - my $rssurl=rsspage(basename($params{page})); - my $atomurl=atompage(basename($params{page})); + my $rssurl=basename(rsspage($params{page})); + my $atomurl=basename(atompage($params{page})); my $ret=""; if ($config{cgiurl} && (exists $params{rootpage} || @@ -164,13 +164,7 @@ sub preprocess_inline (@) { #{{{ my $content=get_inline_content($page, $params{destpage}); $template->param(content => $content); } - # Don't use htmllink because this way the - # title is separate and can be overridden by - # other plugins. - my $link=bestlink($params{page}, $page); - $link=htmlpage($link) if defined $type; - $link=abs2rel($link, dirname($params{destpage})); - $template->param(pageurl => $link); + $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); $template->param(title => pagetitle(basename($page))); $template->param(ctime => displaytime($pagectime{$page})); @@ -222,15 +216,17 @@ sub preprocess_inline (@) { #{{{ } if ($rss) { - will_render($params{page}, rsspage($params{page})); - writefile(rsspage($params{page}), $config{destdir}, + my $rssp=rsspage($params{page}); + will_render($params{page}, $rssp); + writefile($rssp, $config{destdir}, genfeed("rss", $rssurl, $desc, $params{page}, @list)); $toping{$params{page}}=1 unless $config{rebuild}; $feedlinks{$params{destpage}}=qq{}; } if ($atom) { - will_render($params{page}, atompage($params{page})); - writefile(atompage($params{page}), $config{destdir}, + my $atomp=atompage($params{page}); + will_render($params{page}, $atomp); + writefile($atomp, $config{destdir}, genfeed("atom", $atomurl, $desc, $params{page}, @list)); $toping{$params{page}}=1 unless $config{rebuild}; $feedlinks{$params{destpage}}=qq{}; @@ -306,15 +302,11 @@ sub absolute_urls ($$) { #{{{ } #}}} sub rsspage ($) { #{{{ - my $page=shift; - - return $page.".rss"; + return targetpage(shift, "rss"); } #}}} sub atompage ($) { #{{{ - my $page=shift; - - return $page.".atom"; + return targetpage(shift, "atom"); } #}}} sub genfeed ($$$$@) { #{{{ diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 80257097a..c50559829 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -49,9 +49,7 @@ sub genmap ($) { #{{{ my %mapitems = (); foreach my $item (keys %links) { if (pagespec_match($item, $params{pages}, $params{page})) { - my $link=htmlpage($item); - $link=IkiWiki::abs2rel($link, IkiWiki::dirname($params{page})); - $mapitems{$item}=$link; + $mapitems{$item}=urlto($item, $params{destpage}); } } -- cgit v1.2.3