diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-04-01 19:59:42 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-04-01 19:59:42 +0000 |
commit | 02b9f69ba5da59cca9ff198b731d63d643fff4db (patch) | |
tree | 12d42bdb28dae5c2e8ed5dc5a3a3e3ceb74df0a4 /IkiWiki | |
parent | 1087e234f067fd888bff063563ee5c53ef038d82 (diff) |
* 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.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/aggregate.pm | 8 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 30 | ||||
-rw-r--r-- | IkiWiki/Plugin/linkmap.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 20 |
4 files changed, 26 insertions, 36 deletions
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{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />}; } 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{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />}; @@ -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}); } } diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 7fd7daf11..b65d200a0 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -31,8 +31,8 @@ sub backlinks ($) { #{{{ my @links; foreach my $p (keys %{$backlinks{$page}}) { - my $href=abs2rel(htmlpage($p), dirname($page)); - + my $href=urlto($p, $page); + # Trim common dir prefixes from both pages. my $p_trimmed=$p; my $page_trimmed=$page; @@ -57,18 +57,14 @@ sub parentlinks ($) { #{{{ my @ret; my $pagelink=""; my $path=""; - my $skip=1; + my $title=$config{wikiname}; + return if $page eq 'index'; # toplevel - foreach my $dir (reverse split("/", $page)) { - if (! $skip) { - $path.="../"; - unshift @ret, { url => $path.htmlpage($dir), page => pagetitle($dir) }; - } - else { - $skip=0; - } + foreach my $dir (split("/", $page)) { + push @ret, { url => urlto($path, $page), page => $title }; + $path.="/".$dir; + $title=pagetitle($dir); } - unshift @ret, { url => length $path ? $path : ".", page => $config{wikiname} }; return @ret; } #}}} |