From: Simon McVittie Date: Mon, 30 Nov 2015 20:55:34 +0000 (+0000) Subject: Merge remote-tracking branch 'smcv/ready/limit' X-Git-Tag: 3.20160121~48 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/b199349ffddce2b8afd89567882e182f7ef9bff1?hp=-c Merge remote-tracking branch 'smcv/ready/limit' --- b199349ffddce2b8afd89567882e182f7ef9bff1 diff --combined IkiWiki/Plugin/inline.pm index 416df1e28,b122bd0f2..d68723dff --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@@ -119,7 -119,7 +119,7 @@@ sub sessioncgi ($$) 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'); @@@ -160,17 -160,16 +160,17 @@@ sub preprocess_inline (@) # 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}); @@@ -181,11 -180,22 +181,22 @@@ 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}) { @@@ -233,11 -243,11 +244,11 @@@ } 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}; @@@ -246,7 -256,7 +257,7 @@@ @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) : ()), ); @@@ -258,17 -268,17 +269,17 @@@ 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}) { diff --combined debian/changelog index 30878bb0a,611e51843..4be8489dc --- a/debian/changelog +++ b/debian/changelog @@@ -1,188 -1,4 +1,190 @@@ -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 " 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 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 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 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 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
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 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 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". @@@ -202,19 -18,6 +204,19 @@@ * 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 Fri, 12 Sep 2014 21:23:58 +0100 diff --combined doc/ikiwiki/directive/inline.mdwn index 32fecd1bf,dfe3e171f..da759fc19 --- a/doc/ikiwiki/directive/inline.mdwn +++ b/doc/ikiwiki/directive/inline.mdwn @@@ -5,7 -5,7 +5,7 @@@ The most common use of inlining is gene 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 @@@ -46,9 -46,11 +46,11 @@@ There are many parameters you can use w 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. @@@ -94,12 -96,12 +96,14 @@@ Here are some less often needed paramet 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 @@@ -126,7 -128,7 +130,7 @@@ * `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"]] diff --combined t/inline.t index 41957f89e,d1ec9a6d6..859e1701a --- a/t/inline.t +++ b/t/inline.t @@@ -4,28 -4,8 +4,28 @@@ use strict 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")); @@@ -40,9 -20,10 +40,10 @@@ sub write_old_file 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 @@@ -53,29 -34,34 +54,29 @@@ 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{