summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-03-07 21:56:04 -0400
committerJoey Hess <joey@kitenet.net>2011-03-07 21:56:04 -0400
commitd162bf767e1e57502c4a767fa5a6ec42a5857c59 (patch)
treebfaff726a76300013005292b37c62b534234ce81
parent9ef5139918dbe3f4cf0b3310c76dd31090925406 (diff)
parentf486cf6b77e4718a33eaa2b16bd17cdb67c47044 (diff)
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
-rw-r--r--doc/bugs/__96__wiki__95__file__95__chars__96___setting_not_propagated_to_CGI_wrapper.mdwn20
-rw-r--r--doc/bugs/git_stderr_output_causes_problems.mdwn3
-rw-r--r--doc/ikiwiki/directive/inline/discussion.mdwn10
-rw-r--r--doc/sandbox.mdwn3
-rw-r--r--doc/todo/Extensible_inlining.mdwn263
-rw-r--r--doc/users/jasonriedy.mdwn2
6 files changed, 300 insertions, 1 deletions
diff --git a/doc/bugs/__96__wiki__95__file__95__chars__96___setting_not_propagated_to_CGI_wrapper.mdwn b/doc/bugs/__96__wiki__95__file__95__chars__96___setting_not_propagated_to_CGI_wrapper.mdwn
new file mode 100644
index 000000000..4fdd14008
--- /dev/null
+++ b/doc/bugs/__96__wiki__95__file__95__chars__96___setting_not_propagated_to_CGI_wrapper.mdwn
@@ -0,0 +1,20 @@
+I've set `wiki_file_chars` to a non-standard value in the setup file:
+
+ wiki_file_chars => "-[:alnum:]+/.:_\x{1f310}\x{1f430}",
+
+(In case you're wondering, [this is the page](http://xn--9dbdkw.se/🌐/).)
+
+ikiwiki recognises my pages when I run it from the command line, but
+when I edit something through the CGI "script", ikiwiki would suddenly
+not recognise them.
+
+By running `strings` on the CGI wrapper I found that the option
+`wiki_file_regexp` was still at its original setting. So as a workaround,
+I added this to the setup file and everything worked:
+
+ wiki_file_regexp => qr/(^[-[:alnum:]+\/.:_\x{1f310}\x{1f430}]+$)/,
+
+Maybe the CGI wrapper should specially call `checkconfig`, which is
+the function responsible for updating `wiki_file_regexp`?
+
+--[[legoscia]]
diff --git a/doc/bugs/git_stderr_output_causes_problems.mdwn b/doc/bugs/git_stderr_output_causes_problems.mdwn
index c25ef6927..d8e14db42 100644
--- a/doc/bugs/git_stderr_output_causes_problems.mdwn
+++ b/doc/bugs/git_stderr_output_causes_problems.mdwn
@@ -40,3 +40,6 @@ Ikiwiki's git handling is sending a bunch of output to stderr. The following pa
>> I'm happy with the wrapper script solution, so this is [[done]].
>> And this report is now here to point others to that solution.
+
+This is also useful when running ikiwiki behind a nginx proxy, because nginx
+considers this stderr as invalid headers and reports a server error. -- [[nil]]
diff --git a/doc/ikiwiki/directive/inline/discussion.mdwn b/doc/ikiwiki/directive/inline/discussion.mdwn
index 6a186cd93..5489d5f16 100644
--- a/doc/ikiwiki/directive/inline/discussion.mdwn
+++ b/doc/ikiwiki/directive/inline/discussion.mdwn
@@ -132,6 +132,16 @@ Else can you please suggest a smarter way of getting certain data out from pages
--[[hendry]]
+## A different idea: smuggling hook routines in through %params.
+
+The part that fetches the inlined content is quite compact. It's just the if ($needcontent) {} chunk. Would a patch that accepts a perl sub smuggled through something like $params{inliner_} be accepted? If that param exists, call it instead of the current content of that chunk. Pass $page, %params, and $template. Receive $content, possibly seeing $template modified. The custom directives can add inliner_ to %params and call IkiWiki::preprocess_inline. I suppose IkiWiki::Plugin::inline could be modified to strip any *_ out of the directive's arguments to prevent any custom behavior from leaking into the inline directive.
+
+I'm about to try this for a CV/resume type of thing. I want only one element with a specific id out of the generated content (with a little post-processing). I don't need performance for my case.
+
+Update: Pretty much works. I need a way to skip sources, but inline shrinks the list of all pages *before* trying to form them. Next little bit...
+
+--[[JasonRiedy]]
+
---
## Interaction of `show` and `feedshow`
diff --git a/doc/sandbox.mdwn b/doc/sandbox.mdwn
index 779645cfe..bd0cc3c91 100644
--- a/doc/sandbox.mdwn
+++ b/doc/sandbox.mdwn
@@ -5,6 +5,7 @@ This is the [[SandBox]], a page anyone can edit to try out ikiwiki
[[!toc levels=1 startlevel=2 ]]
+Testing this sandbox thing.
## Blockquotes
@@ -84,3 +85,5 @@ This **SandBox** is also a [[blog]]!
[[!inline pages="sandbox/* and !*/Discussion" rootpage="sandbox" show="4" archive="yes"]]
lkj;kj;
+
+how do
diff --git a/doc/todo/Extensible_inlining.mdwn b/doc/todo/Extensible_inlining.mdwn
new file mode 100644
index 000000000..994ed0759
--- /dev/null
+++ b/doc/todo/Extensible_inlining.mdwn
@@ -0,0 +1,263 @@
+Here's an idea with [[patch]] for extending inline in two directions:
+
+1. Permit the content-fetching function to return undef to skip a page. The limiting of @list to a set size is performed after that filtering.
+2. Permit other directive plugins to pass a function to generate content via an inliner_ parameter. The current patch doesn't try to remove that key from the parameters, so hilarity might ensue if someone is too clever. I suppose I should fix that... My *intent* is that other, custom directives can add inliner_.
+
+The diff looks large because the first requires switching some loops.
+
+I'm using this along with a custom BibTeX formatter (one item per file) to generate larger pages and tiny listings. I still need to hammer the templates for that, but I think that's possible without further patches.
+
+(Setting up a git branch for a single plugin is a pain, but I can if necessary. I also could separate this into some sequence rather than all at once, but I won't have time for a week or two.)
+
+-- [[JasonRiedy]]
+
+<pre><code>
+--- /home/ejr/src/git.ikiwiki.info/IkiWiki/Plugin/inline.pm 2011-03-05 14:18:30.261293808 -0500
++++ inline.pm 2011-03-06 21:44:18.887903638 -0500
+@@ -185,6 +185,7 @@
+ }
+
+ my @list;
++ my $num = 0;
+
+ if (exists $params{pagenames}) {
+ foreach my $p (qw(sort pages)) {
+@@ -213,23 +214,121 @@
+ if ($params{feedshow} && $num < $params{feedshow} && $num > 0) {
+ $num=$params{feedshow};
+ }
+- if ($params{skip} && $num) {
+- $num+=$params{skip};
+- }
+
+ @list = pagespec_match_list($params{page}, $params{pages},
+ deptype => deptype($quick ? "presence" : "content"),
+ filter => sub { $_[0] eq $params{page} },
+ sort => exists $params{sort} ? $params{sort} : "age",
+ reverse => yesno($params{reverse}),
+- ($num ? (num => $num) : ()),
+ );
+ }
+
+ if (exists $params{skip}) {
+ @list=@list[$params{skip} .. $#list];
+ }
++
++ if ($params{show} && $params{show} > $num) {
++ $num = $params{show}
++ }
++
++ my $ret="";
++ my @displist;
++ if ($feedonly) {
++ @displist = @list;
++ } else {
++ my $template;
++ if (! $raw) {
++ # cannot use wiki pages as templates; template not sanitized due to
++ # format hook hack
++ eval {
++ $template=template_depends($params{template}.".tmpl", $params{page},
++ blind_cache => 1);
++ };
++ if ($@) {
++ error sprintf(gettext("failed to process template %s"), $params{template}.".tmpl").": $@";
++ }
++ }
++ my $needcontent=$raw || (!($archive && $quick) && $template->query(name => 'content'));
++
++ foreach my $page (@list) {
++ last if ($num && scalar @displist >= $num);
++ my $file = $pagesources{$page};
++ my $type = pagetype($file);
++ if (! $raw) {
++ # Get the content before populating the
++ # template, since getting the content uses
++ # the same template if inlines are nested.
++ if ($needcontent) {
++ my $content;
++ if (exists $params{inliner_} && defined $params{inliner_}) {
++ $content = &{$params{inliner_}}($page, $template, %params);
++ } else {
++ $content=get_inline_content($page, $params{destpage});
++ }
++ next if !defined $content;
++ $template->param(content => $content);
++ push @displist, $page;
++ }
++ $template->param(pageurl => urlto($page, $params{destpage}));
++ $template->param(inlinepage => $page);
++ $template->param(title => pagetitle(basename($page)));
++ $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat}, 1));
++ $template->param(mtime => displaytime($pagemtime{$page}, $params{timeformat}));
++ $template->param(first => 1) if $page eq $list[0];
++ $template->param(last => 1) if ($num && scalar @displist == $num);
++ $template->param(html5 => $config{html5});
+
++ if ($actions) {
++ my $file = $pagesources{$page};
++ my $type = pagetype($file);
++ if ($config{discussion}) {
++ if ($page !~ /.*\/\Q$config{discussionpage}\E$/i &&
++ (length $config{cgiurl} ||
++ exists $pagesources{$page."/".lc($config{discussionpage})})) {
++ $template->param(have_actions => 1);
++ $template->param(discussionlink =>
++ htmllink($page,
++ $params{destpage},
++ $config{discussionpage},
++ noimageinline => 1,
++ forcesubpage => 1));
++ }
++ }
++ if (length $config{cgiurl} &&
++ defined $type &&
++ IkiWiki->can("cgi_editpage")) {
++ $template->param(have_actions => 1);
++ $template->param(editurl => cgiurl(do => "edit", page => $page));
++
++ }
++ }
++
++ run_hooks(pagetemplate => sub {
++ shift->(page => $page, destpage => $params{destpage},
++ template => $template,);
++ });
++
++ $ret.=$template->output;
++ $template->clear_params;
++ }
++ else {
++ if (defined $type) {
++ $ret.="\n".
++ linkify($page, $params{destpage},
++ preprocess($page, $params{destpage},
++ filter($page, $params{destpage},
++ readfile(srcfile($file)))));
++ }
++ else {
++ $ret.="\n".
++ readfile(srcfile($file));
++ }
++ push @displist, $page;
++ }
++ }
++ }
++ @list = @displist;
++
+ my @feedlist;
+ if ($feeds) {
+ if (exists $params{feedshow} &&
+@@ -241,10 +340,6 @@
+ }
+ }
+
+- if ($params{show} && @list > $params{show}) {
+- @list=@list[0..$params{show} - 1];
+- }
+-
+ if ($feeds && exists $params{feedpages}) {
+ @feedlist = pagespec_match_list(
+ $params{page}, "($params{pages}) and ($params{feedpages})",
+@@ -302,8 +397,6 @@
+ }
+ }
+
+- my $ret="";
+-
+ if (length $config{cgiurl} && ! $params{preview} && (exists $params{rootpage} ||
+ (exists $params{postform} && yesno($params{postform}))) &&
+ IkiWiki->can("cgi_editpage")) {
+@@ -355,91 +448,7 @@
+ }
+ $ret.=$linktemplate->output;
+ }
+-
+- if (! $feedonly) {
+- my $template;
+- if (! $raw) {
+- # cannot use wiki pages as templates; template not sanitized due to
+- # format hook hack
+- eval {
+- $template=template_depends($params{template}.".tmpl", $params{page},
+- blind_cache => 1);
+- };
+- if ($@) {
+- error sprintf(gettext("failed to process template %s"), $params{template}.".tmpl").": $@";
+- }
+- }
+- my $needcontent=$raw || (!($archive && $quick) && $template->query(name => 'content'));
+-
+- foreach my $page (@list) {
+- my $file = $pagesources{$page};
+- my $type = pagetype($file);
+- if (! $raw) {
+- if ($needcontent) {
+- # Get the content before populating the
+- # template, since getting the content uses
+- # the same template if inlines are nested.
+- my $content=get_inline_content($page, $params{destpage});
+- $template->param(content => $content);
+- }
+- $template->param(pageurl => urlto($page, $params{destpage}));
+- $template->param(inlinepage => $page);
+- $template->param(title => pagetitle(basename($page)));
+- $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat}, 1));
+- $template->param(mtime => displaytime($pagemtime{$page}, $params{timeformat}));
+- $template->param(first => 1) if $page eq $list[0];
+- $template->param(last => 1) if $page eq $list[$#list];
+- $template->param(html5 => $config{html5});
+-
+- if ($actions) {
+- my $file = $pagesources{$page};
+- my $type = pagetype($file);
+- if ($config{discussion}) {
+- if ($page !~ /.*\/\Q$config{discussionpage}\E$/i &&
+- (length $config{cgiurl} ||
+- exists $pagesources{$page."/".lc($config{discussionpage})})) {
+- $template->param(have_actions => 1);
+- $template->param(discussionlink =>
+- htmllink($page,
+- $params{destpage},
+- $config{discussionpage},
+- noimageinline => 1,
+- forcesubpage => 1));
+- }
+- }
+- if (length $config{cgiurl} &&
+- defined $type &&
+- IkiWiki->can("cgi_editpage")) {
+- $template->param(have_actions => 1);
+- $template->param(editurl => cgiurl(do => "edit", page => $page));
+
+- }
+- }
+-
+- run_hooks(pagetemplate => sub {
+- shift->(page => $page, destpage => $params{destpage},
+- template => $template,);
+- });
+-
+- $ret.=$template->output;
+- $template->clear_params;
+- }
+- else {
+- if (defined $type) {
+- $ret.="\n".
+- linkify($page, $params{destpage},
+- preprocess($page, $params{destpage},
+- filter($page, $params{destpage},
+- readfile(srcfile($file)))));
+- }
+- else {
+- $ret.="\n".
+- readfile(srcfile($file));
+- }
+- }
+- }
+- }
+-
+ if ($feeds && ($emptyfeeds || @feedlist)) {
+ if ($rss) {
+ my $rssp=$feedbase."rss".$feednum;
+</code></pre>
diff --git a/doc/users/jasonriedy.mdwn b/doc/users/jasonriedy.mdwn
index c9b4ba7c2..c94e8e4be 100644
--- a/doc/users/jasonriedy.mdwn
+++ b/doc/users/jasonriedy.mdwn
@@ -1 +1 @@
-I'm over [thattaway](http://lovesgoodfood.com/jason).
+I'm over [thattaway](http://lovesgoodfood.com/jason), although sometimes more easily caught [on identi.ca](http://identi.ca/jasonriedy).