From e0b05fe8cfad11b347127cd47fa87f13285bceb0 Mon Sep 17 00:00:00 2001 From: "https://www.google.com/accounts/o8/id?id=AItOawmBXdtpvfwqNVO1Cmo1AKb01ZQtoRifb08" Date: Thu, 3 Mar 2011 00:05:20 +0000 Subject: --- doc/sandbox.mdwn | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/sandbox.mdwn b/doc/sandbox.mdwn index 779645cfe..41260ca6c 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 -- cgit v1.2.3 From 827d503e28dce5740b543ad1a4a62d0c9f758a08 Mon Sep 17 00:00:00 2001 From: "https://www.google.com/accounts/o8/id?id=AItOawk-hs618TaVepM6Wo6fevJkVvqArSisqyc" Date: Fri, 4 Mar 2011 06:42:27 +0000 Subject: how now brown cow --- doc/sandbox.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/sandbox.mdwn b/doc/sandbox.mdwn index 41260ca6c..bd0cc3c91 100644 --- a/doc/sandbox.mdwn +++ b/doc/sandbox.mdwn @@ -85,3 +85,5 @@ This **SandBox** is also a [[blog]]! [[!inline pages="sandbox/* and !*/Discussion" rootpage="sandbox" show="4" archive="yes"]] lkj;kj; + +how do -- cgit v1.2.3 From b79affa873df5fab1ca531433ba67ddb1c7bd5c5 Mon Sep 17 00:00:00 2001 From: nil Date: Sat, 5 Mar 2011 13:01:26 +0000 Subject: ikiwiki behind a nginx proxy --- doc/bugs/git_stderr_output_causes_problems.mdwn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/bugs/git_stderr_output_causes_problems.mdwn b/doc/bugs/git_stderr_output_causes_problems.mdwn index c25ef6927..d6f14a7f3 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. -- cgit v1.2.3 From a48ecf6f3b1ec39c24c1358313aa3a9590194da7 Mon Sep 17 00:00:00 2001 From: nil Date: Sat, 5 Mar 2011 13:02:28 +0000 Subject: --- doc/bugs/git_stderr_output_causes_problems.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/bugs/git_stderr_output_causes_problems.mdwn b/doc/bugs/git_stderr_output_causes_problems.mdwn index d6f14a7f3..d8e14db42 100644 --- a/doc/bugs/git_stderr_output_causes_problems.mdwn +++ b/doc/bugs/git_stderr_output_causes_problems.mdwn @@ -42,4 +42,4 @@ Ikiwiki's git handling is sending a bunch of output to stderr. The following pa >> 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. +considers this stderr as invalid headers and reports a server error. -- [[nil]] -- cgit v1.2.3 From e20d55377272ff07c6ea8065466923f39fb207e6 Mon Sep 17 00:00:00 2001 From: "https://www.google.com/accounts/o8/id?id=AItOawmJXXNEI07X9crH8W7SN2wN2FIErshpZM4" Date: Sun, 6 Mar 2011 23:43:45 +0000 Subject: wiki_file_regexp vs CGI bug --- ...rs__96___setting_not_propagated_to_CGI_wrapper.mdwn | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 doc/bugs/__96__wiki__95__file__95__chars__96___setting_not_propagated_to_CGI_wrapper.mdwn 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..bf30145f9 --- /dev/null +++ b/doc/bugs/__96__wiki__95__file__95__chars__96___setting_not_propagated_to_CGI_wrapper.mdwn @@ -0,0 +1,18 @@ +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`? -- cgit v1.2.3 From 5e08848189b96ac772a6e581eb51bde9c7a9bae6 Mon Sep 17 00:00:00 2001 From: "https://www.google.com/accounts/o8/id?id=AItOawmJXXNEI07X9crH8W7SN2wN2FIErshpZM4" Date: Sun, 6 Mar 2011 23:46:21 +0000 Subject: Forgot to sign... --- ...95__file__95__chars__96___setting_not_propagated_to_CGI_wrapper.mdwn | 2 ++ 1 file changed, 2 insertions(+) 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 index bf30145f9..4fdd14008 100644 --- 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 @@ -16,3 +16,5 @@ I added this to the setup file and everything worked: Maybe the CGI wrapper should specially call `checkconfig`, which is the function responsible for updating `wiki_file_regexp`? + +--[[legoscia]] -- cgit v1.2.3 From a47d8b343b1b8f8c488c3850ac065999e700648c Mon Sep 17 00:00:00 2001 From: "http://lovesgoodfood.com/jason/" Date: Mon, 7 Mar 2011 01:47:33 +0000 Subject: Idea for extending inline. --- doc/ikiwiki/directive/inline/discussion.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/ikiwiki/directive/inline/discussion.mdwn b/doc/ikiwiki/directive/inline/discussion.mdwn index 6a186cd93..8f74b100d 100644 --- a/doc/ikiwiki/directive/inline/discussion.mdwn +++ b/doc/ikiwiki/directive/inline/discussion.mdwn @@ -132,6 +132,14 @@ 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. + +--[[JasonRiedy]] + --- ## Interaction of `show` and `feedshow` -- cgit v1.2.3 From cd92d1332e8c0cfec8db8c5d453e9487e9837bd2 Mon Sep 17 00:00:00 2001 From: "http://lovesgoodfood.com/jason/" Date: Mon, 7 Mar 2011 01:56:11 +0000 Subject: --- doc/users/jasonriedy.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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). -- cgit v1.2.3 From 0e7b18d909bb70b407c9da14140e69dd80116385 Mon Sep 17 00:00:00 2001 From: "http://lovesgoodfood.com/jason/" Date: Mon, 7 Mar 2011 02:31:33 +0000 Subject: --- doc/ikiwiki/directive/inline/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/ikiwiki/directive/inline/discussion.mdwn b/doc/ikiwiki/directive/inline/discussion.mdwn index 8f74b100d..5489d5f16 100644 --- a/doc/ikiwiki/directive/inline/discussion.mdwn +++ b/doc/ikiwiki/directive/inline/discussion.mdwn @@ -138,6 +138,8 @@ The part that fetches the inlined content is quite compact. It's just the if ($n 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]] --- -- cgit v1.2.3 From 756dd54a6213eac12865500036f8b9af662bcfaa Mon Sep 17 00:00:00 2001 From: "http://lovesgoodfood.com/jason/" Date: Mon, 7 Mar 2011 02:57:34 +0000 Subject: Permit a level of user interposition in the inline directive. --- doc/todo/Extensible_inlining.mdwn | 263 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 doc/todo/Extensible_inlining.mdwn diff --git a/doc/todo/Extensible_inlining.mdwn b/doc/todo/Extensible_inlining.mdwn new file mode 100644 index 000000000..76d809b9f --- /dev/null +++ b/doc/todo/Extensible_inlining.mdwn @@ -0,0 +1,263 @@ +Here's an idea 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]] + +

+--- /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;
+
-- cgit v1.2.3 From f486cf6b77e4718a33eaa2b16bd17cdb67c47044 Mon Sep 17 00:00:00 2001 From: "http://lovesgoodfood.com/jason/" Date: Mon, 7 Mar 2011 03:00:09 +0000 Subject: add patch tag --- doc/todo/Extensible_inlining.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/todo/Extensible_inlining.mdwn b/doc/todo/Extensible_inlining.mdwn index 76d809b9f..994ed0759 100644 --- a/doc/todo/Extensible_inlining.mdwn +++ b/doc/todo/Extensible_inlining.mdwn @@ -1,4 +1,4 @@ -Here's an idea for extending inline in two directions: +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_. -- cgit v1.2.3