my $session=shift;
if ($q->param('do') eq 'blog') {
- my $page=titlepage(decode_utf8($q->param('title')));
+ my $page=titlepage(decode_utf8(scalar $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');
# Running in scan mode: only do the essentials
if (yesno($params{trail}) && IkiWiki::Plugin::trail->can("preprocess_trailitems")) {
- # default to sorting age, the same as inline itself,
- # but let the params override that
- IkiWiki::Plugin::trail::preprocess_trailitems(sort => 'age', %params);
+ # default to sorting by age with fallback to title,
+ # the same as inline itself, but let the params
+ # override that
+ IkiWiki::Plugin::trail::preprocess_trailitems(sort => 'age title', %params);
}
return;
}
if (yesno($params{trail}) && IkiWiki::Plugin::trail->can("preprocess_trailitems")) {
- scalar IkiWiki::Plugin::trail::preprocess_trailitems(sort => 'age', %params);
+ scalar IkiWiki::Plugin::trail::preprocess_trailitems(sort => 'age title', %params);
}
my $raw=yesno($params{raw});
my $feeds=exists $params{feeds} ? yesno($params{feeds}) : !$quick && ! $raw;
my $emptyfeeds=exists $params{emptyfeeds} ? yesno($params{emptyfeeds}) : 1;
my $feedonly=yesno($params{feedonly});
- if (! exists $params{show} && ! $archive) {
- $params{show}=10;
+
+ # Backwards compatibility
+ if (defined $params{show} && $params{show} =~ m/^\d+$/) {
+ $params{limit} = $params{show};
+ delete $params{show};
+ }
+ if (defined $params{feedshow} && $params{feedshow} =~ m/^\d+$/) {
+ $params{feedlimit} = $params{feedshow};
+ delete $params{feedshow};
+ }
+
+ if (! exists $params{limit} && ! $archive) {
+ $params{limit}=10;
}
- if (! exists $params{feedshow} && exists $params{show}) {
- $params{feedshow}=$params{show};
+ if (! exists $params{feedlimit} && exists $params{limit}) {
+ $params{feedlimit}=$params{limit};
}
my $title;
if (exists $params{title}) {
}
else {
my $num=0;
- if ($params{show}) {
- $num=$params{show};
+ if ($params{limit}) {
+ $num=$params{limit};
}
- if ($params{feedshow} && $num < $params{feedshow} && $num > 0) {
- $num=$params{feedshow};
+ if ($params{feedlimit} && $num < $params{feedlimit} && $num > 0) {
+ $num=$params{feedlimit};
}
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",
+ sort => exists $params{sort} ? $params{sort} : "age title",
reverse => yesno($params{reverse}),
($num ? (num => $num) : ()),
);
my @feedlist;
if ($feeds) {
- if (exists $params{feedshow} &&
- $params{feedshow} && @list > $params{feedshow}) {
- @feedlist=@list[0..$params{feedshow} - 1];
+ if (exists $params{feedlimit} &&
+ $params{feedlimit} && @list > $params{feedlimit}) {
+ @feedlist=@list[0..$params{feedlimit} - 1];
}
else {
@feedlist=@list;
}
}
- if ($params{show} && @list > $params{show}) {
- @list=@list[0..$params{show} - 1];
+ if ($params{limit} && @list > $params{limit}) {
+ @list=@list[0..$params{limit} - 1];
}
if ($feeds && exists $params{feedpages}) {
-ikiwiki (3.20140912) UNRELEASED; urgency=medium
+ikiwiki (3.20150615) UNRELEASED; urgency=medium
+
+ [ Amitai Schlair ]
+ * meta test: Add tests for many behaviors of the directive.
+ * img test: Bail gracefully when ImageMagick is not present.
+ * meta: Fix [[!meta name=foo]] by closing the open quote.
+ * Avoid unescaped "{" in regular expressions
+
+ [ Joey Hess ]
+ * emailauth: Added emailauth_sender config.
+ * Modified page.tmpl to to set html lang= and dir= when
+ values have been specified for them, which the po plugin does.
+
+ [ Simon McVittie ]
+ * Run autopkgtest tests using autodep8 and the pkg-perl team's
+ infrastructure
+ * t/img.t: do not spuriously skip
+ * tests: consistently use done_testing instead of no_plan
+ * Wrap and sort control files (wrap-and-sort -abst)
+ * Add enough build-dependencies to run all tests, except for
+ non-git VCSs
+ * debian/copyright: update for the rename of openid-selector to
+ login-selector
+ * git: if no committer identity is known, set it to
+ "IkiWiki <ikiwiki.info>" in .git/config. This resolves commit errors
+ in versions of git that require a non-trivial committer identity.
++ * inline, trail: rename show, feedshow parameters to limit, feedlimit
++ (with backwards compatibility)
+
+ -- Simon McVittie <smcv@debian.org> Mon, 15 Jun 2015 18:13:23 +0100
+
+ikiwiki (3.20150614) unstable; urgency=medium
+
+ * inline: change default sort order from age to "age title" for
+ determinism, partially fixing deterministic build for git-annex,
+ ikiwiki-hosting etc. (Closes: #785757)
+ * img: avoid ImageMagick misinterpreting filenames containing a colon
+ * img test: set old timestamp on source file that will change, so that
+ the test will pass even if it takes less than 1 second
+
+ -- Simon McVittie <smcv@debian.org> Sun, 14 Jun 2015 18:13:23 +0100
+
+ikiwiki (3.20150610) unstable; urgency=low
+
+ [ Joey Hess ]
+ * New emailauth plugin lets users log in, without any registration,
+ by simply clicking on a link in an email.
+ * Re-remove google from openid selector; their openid provider is
+ gone for good.
+ * Make the openid selector display "Password" instead of "Other"
+ when appropriate, so users are more likely to click on it when
+ they don't have an openid.
+ * Converted openid-selector into a more generic loginselector helper
+ plugin.
+ * passwordauth: Don't allow registering accounts that look like openids.
+ * Make cgiurl output deterministic, not hash order. Closes: #785738
+ Thanks, Daniel Kahn Gillmor
+
+ [ Simon McVittie ]
+ * Do not enable emailauth by default, to avoid surprises on httpauth-only
+ sites. Enable it by default in openid instead, since it is essentially
+ a replacement for OpenIDs.
+ * Make the attachment plugin work with CGI.pm 4.x (Closes: #786586;
+ workaround for #786587 in libcgi-pm-perl)
+ * Add a public-domain email icon from tango-icon-theme
+ * Populate pagectime from either mtime or inode change time,
+ whichever is older, again for more reproducible builds
+ * debian: build the docwiki with LC_ALL=C.UTF-8 and TZ=UTC
+ * debian/copyright: consolidate permissive licenses
+ * debian/copyright: turn comments on provenance into Comment
+ * brokenlinks: sort the pages that link to the missing page, for
+ better reproducibility
+ * Add [[!meta date]] to news items and tips, since the git checkout
+ and build process can leave the checkout date in the tarball
+ release, leading to unstable sorting
+ * Sort backlinks deterministically, by falling back to sorting by href
+ if the link text is identical
+ * Add a $config{deterministic} option and use it for the docwiki
+ * haiku: if deterministic build is requested, return a hard-coded haiku
+ * polygen: if deterministic build is requested, use a well-known random seed
+
+ -- Simon McVittie <smcv@debian.org> Wed, 10 Jun 2015 21:56:36 +0100
+
+ikiwiki (3.20150329) experimental; urgency=high
+
+ [ Joey Hess ]
+ * Fix NULL ptr deref on ENOMEM in wrapper. (Thanks, igli)
+
+ [ Simon McVittie ]
+ * Really don't double-decode CGI submissions, even on Perl versions that
+ bundle an old enough Encode.pm for that not to be a problem: the
+ system might have a newer Encode.pm installed separately, like Fedora 20.
+ (Closes: #776181; thanks, Anders Kaseorg)
+ * If neither timezone nor TZ is set, set both to :/etc/localtime if
+ we're on a GNU system and that file exists, or GMT otherwise
+ * t/inline.t: accept translations of "Add a new post titled:"
+ (Closes: #779365)
+ * Consistently document command-line options as e.g. --refresh, not -refresh
+
+ [ Amitai Schlair ]
+ * In VCS-committed anonymous comments, link to url.
+
+ [ Joey Hess ]
+ * Fix XSS in openid selector. Thanks, Raghav Bisht. (Closes: #781483)
+
+ -- Simon McVittie <smcv@debian.org> Sun, 29 Mar 2015 21:48:24 +0100
+
+ikiwiki (3.20150107) experimental; urgency=medium
+
+ [ Joey Hess ]
+ * Added ikiwiki-comment program.
+ * Add missing build-depends on libcgi-formbuilder-perl, needed for
+ t/relativity.t
+ * openid: Stop suppressing the email field on the Preferences page.
+ * Set Debian package maintainer to Simon McVittie as I'm retiring from
+ Debian.
+
+ [ Simon McVittie ]
+ * calendar: add calendar_autocreate option, with which "ikiwiki --refresh"
+ can mostly supersede the ikiwiki-calendar command.
+ Thanks, Louis Paternault
+ * search: add more classes as a hook for CSS. Thanks, sajolida
+ * core: generate HTML5 by default, but keep avoiding new elements
+ like <section> that require specific browser support unless html5 is
+ set to 1.
+ * Tell mobile browsers to draw our pages in a device-sized viewport,
+ not an 800-1000px viewport designed to emulate a desktop/laptop browser.
+ * Add new responsive_layout option which can be set to 0 if your custom
+ CSS only works in a large viewport.
+ * style.css, actiontabs, blueview, goldtype, monochrome: adjust layout
+ below 600px ("responsive layout") so that horizontal scrolling is not
+ needed on smartphone browsers or other small viewports.
+ * core: new libdirs option alongside libdir. Thanks, Louis Paternault
+
+ [ Amitai Schlair ]
+ * core: log a debug message before waiting for the lock.
+ Thanks, Mark Jason Dominus
+ * build: in po/Makefile, use the same $(MAKE) as the rest of the build.
+ Thanks, ttw
+ * blogspam: use the 2.0 JSON API (the 1.0 XML-RPC API has been EOL'd).
+ Closes: #774441
+
+ [ Joey Hess ]
+ * po: If msgmerge falls over on a problem po file, print a warning
+ message, but don't let this problem crash ikiwiki entirely.
+
+ -- Simon McVittie <smcv@debian.org> Wed, 07 Jan 2015 09:13:58 +0000
+
+ikiwiki (3.20141016) unstable; urgency=medium
+
+ [ Joey Hess ]
+ * Fix crash that can occur when only_committed_changes is set and a
+ file is deleted from the underlay.
+
+ [ Simon McVittie ]
+ * core: avoid dangerous use of CGI->param in list context, which led
+ to a security flaw in Bugzilla; as far as we can tell, ikiwiki
+ is not vulnerable to a similar attack, but it's best to be safe
+ * core: new reverse_proxy option prevents ikiwiki from trying to detect
+ how to make self-referential URLs by using the CGI environment variables,
+ for instance when it's deployed behind a HTTP reverse proxy
+ (Closes: #745759)
+ * core: the default User-Agent is now "ikiwiki/$version" to work around
+ ModSecurity rules assuming that only malware uses libwww-perl
+ * core: use protocol-relative URLs (e.g. //www.example.com/wiki) so that
+ https stays on https and http stays on http, particularly if the
+ html5 option is enabled
+ * core: avoid mixed content when a https cgiurl links to http static pages
+ on the same server (the static pages are assumed to be accessible via
+ https too)
+ * core: force the correct top URL in w3mmode
+ * google plugin: Use search form
+ * docwiki: replace Paypal and Flattr buttons with text links
+ * comments: don't record the IP address in the wiki if the user is
+ logged in via passwordauth or httpauth
+ * templates: add ARIA roles to some page elements, if html5 is enabled.
+ Thanks, Patrick
+ * debian: build-depend on libmagickcore-6.q16-2-extra | libmagickcore-extra
+ so we can thumbnail SVGs in the docwiki
+ * debian: explicitly depend and build-depend on libcgi-pm-perl
+ * debian: drop unused python-support dependency
+ * debian: rename debian/link to debian/links so the intended symlinks appear
+ * debian: fix some wrong paths in the copyright file
+
+ -- Simon McVittie <smcv@debian.org> Thu, 16 Oct 2014 23:28:26 +0100
+
+ikiwiki (3.20140916) unstable; urgency=low
* Don't double-decode CGI submissions with Encode.pm >= 2.53,
fixing "Error: Cannot decode string with wide characters".
* Fix aspect ratio when scaling small images, and add support for
converting SVG and PDF graphics to PNG.
Thanks, chrysn
+ - suggest ghostscript (required for PDF-to-PNG thumbnailing)
+ and libmagickcore-extra (required for SVG-to-PNG thumbnailing)
+ - build-depend on ghostscript so the test for scalable images can be run
+ * In the CGI wrapper, incorporate $config{ENV} into the environment
+ before executing Perl code, so that PERL5LIB can point to a
+ non-system-wide installation of IkiWiki.
+ Thanks, Lafayette Chamber Singers Webmaster
+ * filecheck: accept MIME types not containing ';'
+ * autoindex: index files in underlays if the resulting pages aren't
+ going to be committed. Closes: #611068
+ * Add [[!templatebody]] directive so template pages don't have to be
+ simultaneously a valid template and valid HTML
+ * Add myself to Uploaders and release to Debian
-- Simon McVittie <smcv@debian.org> Fri, 12 Sep 2014 21:23:58 +0100
Example:
- \[[!inline pages="blog/* and !*/Discussion" show="10" rootpage="blog"]]
+ \[[!inline pages="blog/* and !*/Discussion" limit="10" rootpage="blog"]]
Any pages that match the specified [[PageSpec]] (in the example, any
[[SubPage]] of "blog") will be part of the blog, and the newest 10
directive. These are the commonly used ones:
* `pages` - A [[PageSpec]] of the pages to inline.
- * `show` - Specify the maximum number of matching pages to inline.
+ * `limit` - Specify the maximum number of matching pages to inline.
Default is 10, unless archiving, when the default is to show all.
Set to 0 to show all matching pages.
+ In older versions of IkiWiki this parameter was called `show`, which
+ also still works.
* `archive` - If set to "yes", only list page titles and some metadata, not
full contents.
* `title` - Sets the title of the rss feed if one is generated.
markup around it, as if it were a literal part of the source of the
inlining page.
* `sort` - Controls how inlined pages are [[sorted|pagespec/sorting]].
- The default is to sort the newest created pages first.
+ The default is to sort the newest created pages first, and if pages
+ were created in the same commit, sort them by the name of the page
+ (equivalent to `sort="age title"`).
* `reverse` - If set to "yes", causes the sort order to be reversed.
- * `feedshow` - Specify the maximum number of matching pages to include in
- the rss/atom feeds. The default is the same as the `show` value above.
+ * `feedlimit` - Specify the maximum number of matching pages to include in
+ the rss/atom feeds. The default is the same as the `limit` value above.
+ In older versions of IkiWiki this parameter was called `feedshow`, which
+ also still works.
* `feedonly` - Only generate the feed, do not display the pages inline on
the page.
* `quick` - Build archives in quick mode, without reading page contents for
* `trail` - If set to "yes" and the [[!iki plugins/trail desc=trail]] plugin
is enabled, turn the inlined pages into a trail with next/previous links,
by passing the same options to [[ikiwiki/directive/trailitems]]. The `skip`
- and `show` options are ignored by the trail, so the next/previous links
+ and `limit` options are ignored by the trail, so the next/previous links
traverse through all matching pages.
[[!meta robots="noindex, follow"]]
use Test::More;
use IkiWiki;
+my $installed = $ENV{INSTALLED_TESTS};
+
+my @command;
+if ($installed) {
+ @command = qw(ikiwiki);
+}
+else {
+ ok(! system("make -s ikiwiki.out"));
+ @command = qw(perl -I. ./ikiwiki.out
+ --underlaydir=underlays/basewiki
+ --set underlaydirbase=underlays
+ --templatedir=templates);
+}
+
+push @command, qw(--set usedirs=0 --plugin inline
+ --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi
+ --rss --atom t/tmp/in t/tmp/out --verbose);
+
my $blob;
+my $add_new_post = gettext("Add a new post titled:");
+
ok(! system("rm -rf t/tmp"));
ok(! system("mkdir t/tmp"));
write_old_file("protagonists.mdwn",
'[[!inline pages="protagonists/*" rootpage="protagonists/new"]]');
write_old_file("friends.mdwn",
- '[[!inline pages="friends/*" postform=yes sort=title show=2]]');
+ '[[!inline pages="friends/*" postform=yes sort=title limit=2]]');
write_old_file("antagonists.mdwn",
'[[!inline pages="antagonists/*"]]');
+ # using old spelling of "limit" ("show") to verify backwards compat
write_old_file("enemies.mdwn",
'[[!inline pages="enemies/*" postform=no rootpage=enemies sort=title reverse=yes show=2]]');
foreach my $page (qw(protagonists/shepard protagonists/link
write_old_file("$page.mdwn", "this page is {$page}");
}
-ok(! system("make -s ikiwiki.out"));
-
-my $command = "perl -I. ./ikiwiki.out -set usedirs=0 -plugin inline -url=http://example.com -cgiurl=http://example.com/ikiwiki.cgi -rss -atom -underlaydir=underlays/basewiki -set underlaydirbase=underlays -templatedir=templates t/tmp/in t/tmp/out -verbose";
-
-ok(! system($command));
-
-ok(! system("$command -refresh"));
+ok(! system(@command));
+ok(! system(@command, "--refresh"));
$blob = readfile("t/tmp/out/protagonists.html");
-like($blob, qr{Add a new post}, 'rootpage=yes gives postform');
+like($blob, qr{\Q$add_new_post\E}, 'rootpage=yes gives postform');
like($blob, qr{<input type="hidden" name="from" value="protagonists/new"},
'explicit rootpage is /protagonists/new');
$blob = readfile("t/tmp/out/friends.html");
-like($blob, qr{Add a new post}, 'postform=yes forces postform');
+like($blob, qr{\Q$add_new_post\E}, 'postform=yes forces postform');
like($blob, qr{<input type="hidden" name="from" value="friends"},
'implicit rootpage is /friends');
-like($blob, qr[this page is {friends/garrus}.*this page is {friends/liara}]s,
+like($blob, qr[this page is \{friends/garrus}.*this page is \{friends/liara}]s,
'first two pages in desired sort order are present');
unlike($blob, qr{friends/(?:midna|telma)},
- 'pages excluded by show should not be present');
+ 'pages excluded by limit should not be present');
$blob = readfile("t/tmp/out/antagonists.html");
-unlike($blob, qr{Add a new post}, 'default is no postform');
+unlike($blob, qr{\Q$add_new_post\E}, 'default is no postform');
$blob = readfile("t/tmp/out/enemies.html");
-unlike($blob, qr{Add a new post}, 'postform=no forces no postform');
-like($blob, qr[this page is {enemies/zant}.*this page is {enemies/rachni}]s,
+unlike($blob, qr{\Q$add_new_post\E}, 'postform=no forces no postform');
+like($blob, qr[this page is \{enemies/zant}.*this page is \{enemies/rachni}]s,
'first two pages in reversed sort order are present');
unlike($blob, qr{enemies/(?:benezia|geth)},
'pages excluded by show should not be present');