X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/d2911a20a6913e46035a8731acafba6faf5997f9..9c6444bf681ec48e3832282906d1d2cfad586cb5:/IkiWiki/Plugin/inline.pm diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index c734bd9a6..9a63ea1c9 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -11,6 +11,7 @@ use URI; my %knownfeeds; my %page_numfeeds; my @inline; +my $nested=0; sub import { #{{{ hook(type => "getopt", id => "inline", call => \&getopt); @@ -69,12 +70,12 @@ sub sessioncgi () { #{{{ my $session=shift; if ($q->param('do') eq 'blog') { - my $page=decode_utf8($q->param('title')); - $page=~s/\///g; # no slashes in blog posts + my $page=IkiWiki::titlepage(decode_utf8($q->param('title'))); + $page=~s/(\/)/"__".ord($1)."__"/eg; # don't create subdirs # if the page already exists, munge it to be unique my $from=$q->param('from'); my $add=""; - while (exists $IkiWiki::pagecase{lc($from."/".IkiWiki::titlepage($page).$add)}) { + while (exists $IkiWiki::pagecase{lc($from."/".$page.$add)}) { $add=1 unless length $add; $add++; } @@ -102,7 +103,7 @@ sub preprocess_inline (@) { #{{{ my %params=@_; if (! exists $params{pages}) { - return ""; + return "[[inline ".gettext("missing pages parameter")."]]"; } my $raw=yesno($params{raw}); my $archive=yesno($params{archive}); @@ -277,7 +278,7 @@ sub preprocess_inline (@) { #{{{ } if (length $config{cgiurl} && defined $type) { $template->param(have_actions => 1); - $template->param(editurl => cgiurl(do => "edit", page => pagetitle($page, 1))); + $template->param(editurl => cgiurl(do => "edit", page => $page)); } } @@ -329,7 +330,7 @@ sub preprocess_inline (@) { #{{{ } } - return $ret if $raw; + return $ret if $raw || $nested; push @inline, $ret; return "
\n\n"; } #}}} @@ -350,11 +351,14 @@ sub get_inline_content ($$) { #{{{ my $file=$pagesources{$page}; my $type=pagetype($file); if (defined $type) { - return htmlize($page, $type, + $nested++; + my $ret=htmlize($page, $destpage, $type, linkify($page, $destpage, preprocess($page, $destpage, filter($page, $destpage, readfile(srcfile($file)))))); + $nested--; + return $ret; } else { return ""; @@ -388,10 +392,19 @@ sub absolute_urls ($$) { #{{{ my $url=$baseurl; $url=~s/[^\/]+$//; - + + # what is the non path part of the url? + my $top_uri = URI->new($url); + $top_uri->path_query(""); # reset the path + my $urltop = $top_uri->as_string; + $content=~s/( date_3339($pagemtime{$p}), ); + if (exists $pagestate{$p} && + exists $pagestate{$p}{meta}{uuid}) { + my $atom_id = $pagestate{$p}{meta}{uuid}; + + $itemtemplate->param(uuid => $atom_id); + } + if ($itemtemplate->query(name => "enclosure")) { my $file=$pagesources{$p}; my $type=pagetype($file); @@ -436,7 +456,7 @@ sub genfeed ($$$$@) { #{{{ $itemtemplate->param(content => $pcontent); } else { - my ($a, $b, $c, $d, $e, $f, $g, $size) = stat(srcfile($file)); + my $size=(srcfile_stat($file))[8]; my $mime="unknown"; eval q{use File::MimeInfo}; if (! $@) { @@ -496,7 +516,7 @@ sub pingurl (@) { #{{{ defined(my $pid = fork) or error("Can't fork: $!"); return if $pid; chdir '/'; - setsid() or error("Can't start a new session: $!"); + POSIX::setsid() or error("Can't start a new session: $!"); open STDIN, '/dev/null'; open STDOUT, '>/dev/null'; open STDERR, '>&STDOUT' or error("Can't dup stdout: $!");