From b6f6f126d0e3fa23687f2d8c537de207e2c7b5d3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 21 Oct 2009 16:27:44 -0400 Subject: avoid -O default for CFLAGS, and document --- doc/usage.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/usage.mdwn') diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 0c618de5c..4ee935f73 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -345,6 +345,10 @@ also be configured using a setup file. This controls what C compiler is used to build wrappers. Default is 'cc'. +* CFLAGS + + This can be used to pass options to the C compiler when building wrappers. + # SEE ALSO * [[ikiwiki-mass-rebuild]](8) -- cgit v1.2.3 From ba1565acc1c92ce409aa341cd14102675f222183 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 1 Jan 2010 18:48:00 -0500 Subject: plugin names are always lowercase --- doc/usage.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/usage.mdwn') diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 4ee935f73..e4808d4c2 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -249,8 +249,8 @@ also be configured using a setup file. Makes ikiwiki look in the specified directory first, before the regular locations when loading library files and plugins. For example, if you set - libdir to "/home/you/.ikiwiki/", you can install a Foo.pm plugin as - "/home/you/.ikiwiki/IkiWiki/Plugin/Foo.pm". + libdir to "/home/you/.ikiwiki/", you can install a foo.pm plugin as + "/home/you/.ikiwiki/IkiWiki/Plugin/foo.pm". * --discussion, --no-discussion -- cgit v1.2.3 From 60d2dd318f66563c3ee3bde950d7f53426530acc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 28 Feb 2010 00:12:47 -0500 Subject: Add new --clean option; this makes ikiwiki remove all built files in the destdir, as well as wrappers and the .ikiwiki directory. --- IkiWiki.pm | 7 +++++++ IkiWiki/Render.pm | 11 +++++++++++ Makefile.PL | 2 +- debian/changelog | 4 +++- doc/usage.mdwn | 8 ++++++++ ikiwiki.in | 12 +++++++++++- ikiwiki.spec | 2 +- 7 files changed, 42 insertions(+), 4 deletions(-) (limited to 'doc/usage.mdwn') diff --git a/IkiWiki.pm b/IkiWiki.pm index 9df6c90d6..00eadfd98 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -409,6 +409,13 @@ sub getsetup () { safe => 0, rebuild => 0, }, + clean => { + type => "internal", + default => 0, + description => "running in clean mode", + safe => 0, + rebuild => 0, + }, refresh => { type => "internal", default => 0, diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 3ebb1a324..af24df155 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -683,6 +683,17 @@ sub refresh () { } } +sub clean_rendered { + lockwiki(); + loadindex(); + remove_unrendered(); + foreach my $page (keys %oldrenderedfiles) { + foreach my $file (@{$oldrenderedfiles{$page}}) { + prune($config{destdir}."/".$file); + } + } +} + sub commandline_render () { lockwiki(); loadindex(); diff --git a/Makefile.PL b/Makefile.PL index 462f7364d..52421a711 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -51,7 +51,7 @@ docwiki: ikiwiki.out $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.out -libdir . -setup docwiki.setup -refresh extra_clean: - rm -rf html doc/.ikiwiki + $(PERL) -I. $(extramodules) $(tflag) ikiwiki.in -libdir . -setup docwiki.setup -clean rm -f *.man ikiwiki.out ikiwiki.setup plugins/*.pyc $(MAKE) -C po clean diff --git a/debian/changelog b/debian/changelog index 832bbaa85..3b92c598d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ikiwiki (3.20100213) UNRELEASED; urgency=low +ikiwiki (3.20100228) UNRELEASED; urgency=low * comments: Display number of comments in comment action link. * Rebuild wikis on upgrade to this version to get the comment counts @@ -8,6 +8,8 @@ ikiwiki (3.20100213) UNRELEASED; urgency=low files/directories. * Fix admin openid detection in setup automator, and avoid prompting for a password. + * Add new --clean option; this makes ikiwiki remove all built + files in the destdir, as well as wrappers and the .ikiwiki directory. -- Joey Hess Sun, 14 Feb 2010 17:02:10 -0500 diff --git a/doc/usage.mdwn b/doc/usage.mdwn index e4808d4c2..a105d7e59 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -50,6 +50,14 @@ These options control the mode that ikiwiki operates in. If used with --setup --refresh, this makes it also update any configured wrappers. +* --clean + + This makes ikiwiki clean up by removing any files it denerated in the + `destination` directory, as well as any configured wrappers, and the + `.ikiwiki` state directory. This is mostly useful if you're running + ikiwiki in a Makefile to build documentation and want a corresponding + `clean` target. + * --cgi Enable [[CGI]] mode. In cgi mode ikiwiki runs as a cgi script, and diff --git a/ikiwiki.in b/ikiwiki.in index b8581d880..ae1251ff6 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -37,6 +37,7 @@ sub getconfig () { "syslog!" => \$config{syslog}, "rebuild!" => \$config{rebuild}, "refresh!" => \$config{refresh}, + "clean!" => \$config{clean}, "post-commit" => \$config{post_commit}, "render=s" => \$config{render}, "wrappers!" => \$config{genwrappers}, @@ -135,6 +136,7 @@ sub main () { if (@{$config{wrappers}} && ! $config{render} && ! $config{dumpsetup} && + ! $config{clean} && ((! $config{refresh} && ! $config{post_commit}) || $config{genwrappers})) { debug(gettext("generating wrappers..")); @@ -159,7 +161,7 @@ sub main () { # setup implies a wiki rebuild by default if (! $config{refresh} && ! $config{render} && - ! $config{post_commit}) { + ! $config{post_commit} && ! $config{clean}) { $config{rebuild}=1; } } @@ -190,6 +192,14 @@ sub main () { elsif ($config{post_commit} && ! commit_hook_enabled()) { # do nothing } + elsif ($config{clean}) { + require IkiWiki::Render; + foreach my $wrapper (@{$config{wrappers}}) { + prune($wrapper->{wrapper}); + } + clean_rendered(); + system("rm", "-rf", $config{wikistatedir}); + } else { if ($config{rebuild}) { debug(gettext("rebuilding wiki..")); diff --git a/ikiwiki.spec b/ikiwiki.spec index 865c9a325..1dba9f463 100644 --- a/ikiwiki.spec +++ b/ikiwiki.spec @@ -1,5 +1,5 @@ Name: ikiwiki -Version: 3.20100212 +Version: 3.20100228 Release: 1%{?dist} Summary: A wiki compiler -- cgit v1.2.3 From 823ec815d4fc9625d6fa3553ad03e9f2ff737659 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 14 Mar 2010 14:58:13 -0400 Subject: Add a include setting, which can be used to make ikiwiki process wiki source files, such as .htaccess, that would normally be skipped for security or other reasons. Closes: #447267 (Thanks to Aaron Wilson for the original patch.) --- IkiWiki.pm | 13 +++++++++++++ debian/changelog | 4 ++++ doc/tips/htaccess_file.mdwn | 30 ++++++++++++++++++++++++++++++ doc/todo/enable-htaccess-files.mdwn | 5 +++++ doc/usage.mdwn | 6 ++++++ ikiwiki.in | 3 +++ 6 files changed, 61 insertions(+) create mode 100644 doc/tips/htaccess_file.mdwn (limited to 'doc/usage.mdwn') diff --git a/IkiWiki.pm b/IkiWiki.pm index 251ed8cc8..ee94ce659 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -334,6 +334,15 @@ sub getsetup () { safe => 0, # paranoia rebuild => 0, }, + include => { + type => "string", + default => undef, + example => '^\.htaccess$', + description => "regexp of normally ignored source files to include", + advanced => 1, + safe => 0, # regexp + rebuild => 1, + }, exclude => { type => "string", default => undef, @@ -1820,6 +1829,10 @@ sub file_pruned ($;$) { $file =~ s#^\Q$base\E/+##; } + if (defined $config{include} && length $config{include}) { + return 0 if $file =~ m/$config{include}/; + } + my $regexp='('.join('|', @{$config{wiki_file_prune_regexps}}).')'; return $file =~ m/$regexp/; } diff --git a/debian/changelog b/debian/changelog index 92afe661f..e5347e2a1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,10 @@ ikiwiki (3.20100313) UNRELEASED; urgency=low as used by yahoo and google urls. * Add complete German basewiki and directives translation done by Sebastian Kuhnert. + * Add a include setting, which can be used to make ikiwiki process + wiki source files, such as .htaccess, that would normally be skipped + for security or other reasons. Closes: #447267 + (Thanks to Aaron Wilson for the original patch.) -- Joey Hess Sat, 13 Mar 2010 14:48:10 -0500 diff --git a/doc/tips/htaccess_file.mdwn b/doc/tips/htaccess_file.mdwn new file mode 100644 index 000000000..5266eba41 --- /dev/null +++ b/doc/tips/htaccess_file.mdwn @@ -0,0 +1,30 @@ +If you try to include a `.htaccess` file in your wiki's source, in order to +configure the web server, you'll find that ikiwiki excludes it from +processing. In fact, ikiwiki excludes any file starting with a dot, as well +as a lot of other files, for good security reasons. + +You can tell ikiwiki not to exclude the .htaccess file by adding this to +your setup file: + + include => '^\.htaccess$', + +Caution! Before you do that, please think for a minute about who can edit +your wiki. Are attachment uploads enabled? Can users commit changes +directly to the version control system? Do you trust everyone who can +make a change to not do Bad Things with the htaccess file? Do you trust +everyone who *might* be able to make a change in the future? Note that a +determined attacker who can write to the htaccess file can probably get a +shell on your web server. + +If any of these questions have given you pause, I suggest you find a +different way to configure the web server. One way is to not put the +`.htaccess` file under ikiwiki's control, and just manually install it +in the destdir. + +[Apache's documentation](http://httpd.apache.org/docs/1.3/howto/htaccess.html) +says +> In general, you should never use .htaccess files unless you don't have +> access to the main server configuration file. +This is good advice -- if you can edit apache's main configuration files, +then you should not use a htaccess file. +--[[Joey]] diff --git a/doc/todo/enable-htaccess-files.mdwn b/doc/todo/enable-htaccess-files.mdwn index 412cb5eba..c895db75d 100644 --- a/doc/todo/enable-htaccess-files.mdwn +++ b/doc/todo/enable-htaccess-files.mdwn @@ -61,3 +61,8 @@ It should be off by default of course. --Max +1 for various purposes (but sometimes the filename isn't `.htaccess`, so please make it configurable) --[[schmonz]] > I've described a workaround for one use case at the [[plugins/rsync]] [[plugins/rsync/discussion]] page. --[[schmonz]] + +--- + +[[done]], you can use the `include` setting to override the default +excludes now. Please use extreme caution when doing so. --[[Joey]] diff --git a/doc/usage.mdwn b/doc/usage.mdwn index a105d7e59..f735170f0 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -234,6 +234,12 @@ also be configured using a setup file. Specifies a rexexp of source files to exclude from processing. May be specified multiple times to add to exclude list. +* --include regexp + + Specifies a rexexp of source files, that would normally be excluded, + but that you wish to include in processing. + May be specified multiple times to add to include list. + * --adminuser name Specifies a username of a user (or, if openid is enabled, an openid) diff --git a/ikiwiki.in b/ikiwiki.in index ae1251ff6..da5555629 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -65,6 +65,9 @@ sub getconfig () { "exclude=s@" => sub { push @{$config{wiki_file_prune_regexps}}, $_[1]; }, + "include=s@" => sub { + $config{include}=defined $config{include} && length $config{include} ? "$config{include}|$_[1]" : $_[1]; + }, "adminuser=s@" => sub { push @{$config{adminuser}}, $_[1] }, -- cgit v1.2.3 From c64c4b99626286ee08f67999a18c43c769e21e6a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Mar 2010 14:39:50 -0400 Subject: Add --set-yaml switch for setting more complex config file options. --- debian/changelog | 1 + doc/usage.mdwn | 10 +++++++--- ikiwiki.in | 9 +++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'doc/usage.mdwn') diff --git a/debian/changelog b/debian/changelog index 4d0639a58..e7499b6f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,7 @@ ikiwiki (3.20100320) UNRELEASED; urgency=low (Thanks to Aaron Wilson for the original patch.) * Allow wrappers to be built using tcc. * Add support for setup files written in YAML. + * Add --set-yaml switch for setting more complex config file options. -- Joey Hess Sat, 13 Mar 2010 14:48:10 -0500 diff --git a/doc/usage.mdwn b/doc/usage.mdwn index f735170f0..db1e36a10 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -331,9 +331,13 @@ also be configured using a setup file. * --set var=value This allows setting an arbitrary configuration variable, the same as if it - were set via a setup file. Since most options can be configured - using command-line switches, you will rarely need to use this, but it can be - useful for the odd option that lacks a command-line switch. + were set via a setup file. Since most options commonly used options can be + configured using command-line switches, you will rarely need to use this. + +* --set-yaml var=value + + This is like --set, but it allows setting configuration variables that + use complex data structures, by passing in a YAML document. # EXAMPLES diff --git a/ikiwiki.in b/ikiwiki.in index da5555629..7028bdb7d 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -96,6 +96,15 @@ sub getconfig () { } $config{$var}=$val; }, + "set-yaml=s" => sub { + my ($var, $val)=split('=', $_[1], 2); + if (! defined $var || ! defined $val) { + die gettext("usage: --set-yaml var=value"), "\n"; + } + eval q{use YAML::Any}; + die $@ if $@; + $config{$var}=Load($val); + }, "version" => sub { print "ikiwiki version $IkiWiki::version\n"; exit; -- cgit v1.2.3 From b14f84c4acccbc8450a9102b3b647013989b27bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Apr 2010 17:02:29 -0400 Subject: --gettime revamp * Rename --getctime to --gettime. (The old name still works for backwards compatability.) * --gettime now also looks up last modification time. * Add rcs_getmtime to plugin API; currently only implemented for git. --- IkiWiki.pm | 8 +++++-- IkiWiki/Plugin/bzr.pm | 5 +++++ IkiWiki/Plugin/cvs.pm | 5 +++++ IkiWiki/Plugin/darcs.pm | 5 +++++ IkiWiki/Plugin/git.pm | 5 +++++ IkiWiki/Plugin/mercurial.pm | 5 +++++ IkiWiki/Plugin/monotone.pm | 5 +++++ IkiWiki/Plugin/norcs.pm | 7 +++++- IkiWiki/Plugin/svn.pm | 5 +++++ IkiWiki/Plugin/tla.pm | 5 +++++ IkiWiki/Render.pm | 18 +++++++++++++--- debian/changelog | 5 +++++ .../How_does_ikiwiki_remember_times__63__.mdwn | 25 ++++++---------------- ...old_repository_to_new_ikiwiki_system__63__.mdwn | 4 ---- doc/plugins/write.mdwn | 7 ++++++ doc/rcs.mdwn | 8 +++++-- doc/tips/Importing_posts_from_Wordpress.mdwn | 2 +- doc/tips/inside_dot_ikiwiki/discussion.mdwn | 7 +++--- doc/todo/auto_getctime_on_fresh_build.mdwn | 8 +++++-- doc/usage.mdwn | 10 ++++----- ikiwiki.in | 3 ++- mtime-to-git | 14 ------------ 22 files changed, 109 insertions(+), 57 deletions(-) delete mode 100755 mtime-to-git (limited to 'doc/usage.mdwn') diff --git a/IkiWiki.pm b/IkiWiki.pm index 1730e476a..7655dada5 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -440,10 +440,10 @@ sub getsetup () { safe => 0, rebuild => 0, }, - getctime => { + gettime => { type => "internal", default => 0, - description => "running in getctime mode", + description => "running in gettime mode", safe => 0, rebuild => 0, }, @@ -1790,6 +1790,10 @@ sub rcs_getctime ($) { $hooks{rcs}{rcs_getctime}{call}->(@_); } +sub rcs_getmtime ($) { + $hooks{rcs}{rcs_getmtime}{call}->(@_); +} + sub rcs_receive () { $hooks{rcs}{rcs_receive}{call}->(); } diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 0efc26b49..f79ca7c8f 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -20,6 +20,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub checkconfig () { @@ -306,4 +307,8 @@ sub rcs_getctime ($) { return $ctime; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for bzr\n"; # TODO +} + 1 diff --git a/IkiWiki/Plugin/cvs.pm b/IkiWiki/Plugin/cvs.pm index 26a3e9dd2..360d97249 100644 --- a/IkiWiki/Plugin/cvs.pm +++ b/IkiWiki/Plugin/cvs.pm @@ -49,6 +49,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub genwrapper () { @@ -485,4 +486,8 @@ sub rcs_getctime ($) { return $date; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for cvs\n"; # TODO +} + 1 diff --git a/IkiWiki/Plugin/darcs.pm b/IkiWiki/Plugin/darcs.pm index bc8394b90..c1d6661d3 100644 --- a/IkiWiki/Plugin/darcs.pm +++ b/IkiWiki/Plugin/darcs.pm @@ -18,6 +18,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub silentsystem (@) { @@ -427,4 +428,8 @@ sub rcs_getctime ($) { return $date; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for darcs\n"; # TODO +} + 1 diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index b02f4a5ed..86d80186f 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -25,6 +25,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); hook(type => "rcs", id => "rcs_receive", call => \&rcs_receive); } @@ -634,6 +635,10 @@ sub rcs_getctime ($) { return $ctime; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for git\n"; # TODO +} + sub rcs_receive () { # The wiki may not be the only thing in the git repo. # Determine if it is in a subdirectory by examining the srcdir, diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index ea00a3364..34e009c7a 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -20,6 +20,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub checkconfig () { @@ -254,4 +255,8 @@ sub rcs_getctime ($) { return $ctime; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for mercurial\n"; # TODO +} + 1 diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm index c33cf7e3a..67d4abbaa 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -23,6 +23,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub checkconfig () { @@ -693,4 +694,8 @@ sub rcs_getctime ($) { return $date; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for monotone\n"; # TODO +} + 1 diff --git a/IkiWiki/Plugin/norcs.pm b/IkiWiki/Plugin/norcs.pm index e6a05a3c5..053652a5f 100644 --- a/IkiWiki/Plugin/norcs.pm +++ b/IkiWiki/Plugin/norcs.pm @@ -18,6 +18,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub getsetup () { @@ -63,7 +64,11 @@ sub rcs_diff ($) { } sub rcs_getctime ($) { - error gettext("getctime not implemented"); + return 0; +} + +sub rcs_getmtime ($) { + return 0; } 1 diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm index 7d27ec842..85c205f09 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -19,6 +19,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub checkconfig () { @@ -379,4 +380,8 @@ sub rcs_getctime ($) { return $date; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for svn\n"; # TODO +} + 1 diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index 764da9b98..f5ad0cc96 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -18,6 +18,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub checkconfig () { @@ -284,4 +285,8 @@ sub rcs_getctime ($) { return $date; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for tla\n"; # TODO +} + 1 diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index e98888d76..e1cb68462 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -365,14 +365,26 @@ sub find_new_files ($) { } else { push @new, $file; - if ($config{getctime} && -e "$config{srcdir}/$file") { + if ($config{gettime} && -e "$config{srcdir}/$file") { eval { - my $time=rcs_getctime("$config{srcdir}/$file"); - $pagectime{$page}=$time; + my $ctime=rcs_getctime("$config{srcdir}/$file"); + if ($ctime > 0) { + $pagectime{$page}=$ctime; + } }; if ($@) { print STDERR $@; } + my $mtime; + eval { + my $mtime=rcs_getmtime("$config{srcdir}/$file"); + }; + if ($@) { + print STDERR $@; + } + elsif ($mtime > 0) { + utime($mtime, $mtime, "$config{srcdir}/$file"); + } } } $pagecase{lc $page}=$page; diff --git a/debian/changelog b/debian/changelog index 737d73655..615d5916f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -44,6 +44,11 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low * conditional: Fix bug that forced "all" mode off by default. * calendarmonth.tmpl: The month calendar is now put in a sidebar. * calendar: Improved display of arrows. + * Rename --getctime to --gettime. (The old name still works for + backwards compatability.) + * --gettime now also looks up last modification time. + * Add rcs_getmtime to plugin API; currently only implemented + for git. -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn b/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn index 6ce576db1..6b7739fd0 100644 --- a/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn +++ b/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn @@ -20,15 +20,17 @@ Do I have it right? > Some VCS, like git, set the file mtimes to the current time > when making a new checkout, so they will be lost if you do that. > The creation times can be retrived using the `--getctime` option. -> I suppose it might be nice if there were a `--getmtime` that pulled -> true modification times out of the VCS, but I haven't found it a big -> deal in practice for the last modification times to be updated to the -> current time when rebuilding a wiki like this. --[[Joey]] +> --[[Joey]] > > > Thanks for the clarification. I ran some tests of my own to make sure I understand it right, and I'm satisfied > > that the order of posts in my blog can be retrieved from the VCS using the `--getctime` option, at least if I > > choose to order my posts by creation time rather than modification time. But I now know that I can't rely on > > page modification times in ikiwiki as these can be lost permanently. +> +> > > Update: It's now renamed to `--gettime`, and pulls both the creation +> > > and modification times. Also, per [[todo/auto_getctime_on_fresh_build]], +> > > this is now done automatically the first time ikiwiki builds a +> > > srcdir. So, no need to worry about this any more! --[[Joey]] > > > > I would suggest that there should at least be a `--getmtime` option like you describe, and perhaps that > > `--getctime` and `--getmtime` be _on by default_. In my opinion the creation times and modification times of @@ -91,19 +93,6 @@ Do I have it right? > A quick workaround for me to get modification times right is the following > little zsh script, which unfortunately only works for git: - #!/usr/bin/env zsh - - set +x - - for FILE in **/*(.); do - TIMES="`git log --pretty=format:%ai $FILE`" - MTIME="`echo $TIMES | head -n1`" - - if [ ! -z $MTIME ]; then - echo touch -m -d "$MTIME" $FILE - touch -m -d "$MTIME" $FILE - fi - - done +>> Elided; no longer needed since --gettime does that, and much faster! --[[Joey]] > --[[David_Riebenbauer]] diff --git a/doc/forum/Migrating_old_repository_to_new_ikiwiki_system__63__.mdwn b/doc/forum/Migrating_old_repository_to_new_ikiwiki_system__63__.mdwn index fe67e6aba..d7a33b526 100644 --- a/doc/forum/Migrating_old_repository_to_new_ikiwiki_system__63__.mdwn +++ b/doc/forum/Migrating_old_repository_to_new_ikiwiki_system__63__.mdwn @@ -20,10 +20,6 @@ How do I set up an ikiwiki system using a pre-existing repository (instead of cr > recreate the ikiwiki srcdir > 3. `git clone` from the bare git repository a second time, > to create a checkout you can manually edit (optional) -> 4. run `ikiwiki --getctime --setup your.setup` -> The getctime will ensure page creation times are accurate -> by putting the info out of the git history, -> and only needs to be done once. > > If you preserved your repository, but not the setup file, > the easiest way to make one is probably to run diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 707622956..cf7044b2c 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -1085,6 +1085,13 @@ it up in the history. It's ok if this is not implemented, and throws an error. +#### `rcs_getmtime($)` + +This is used to get the page modification time for a file from the RCS, by +looking it up in the history. + +It's ok if this is not implemented, and throws an error. + #### `rcs_receive()` This is called when ikiwiki is running as a pre-receive hook (or diff --git a/doc/rcs.mdwn b/doc/rcs.mdwn index 4e7a8d2a6..b5bfc2414 100644 --- a/doc/rcs.mdwn +++ b/doc/rcs.mdwn @@ -14,8 +14,10 @@ use, some advanced or special features are not supported in all of them. Lack of support in [[ikiwiki-makerepo]] or auto.setup can make it harder to set up a wiki using that revision control system. The `rcs_commit_staged` hook is needed to use [[attachments|plugins/attachment]] or -[[plugins/comments]]. And so on. The table below summarises this for each -revision control system and links to more information about each. +[[plugins/comments]]. `rcs_getctime` may be implemented in a fast way +(ie, one log lookup for all files), or very slowly (one lookup per file). +And so on. The table below summarises this for each revision control +system and links to more information about each. [[!table data=""" feature |[[git]]|[[svn]]|[[bzr]] |[[monotone]]|[[mercurial]]|[[darcs]]|[[tla]] |[[cvs]] @@ -25,6 +27,8 @@ auto.setup |yes |yes |incomplete|yes |incomplete |yes `rcs_rename` |yes |yes |yes |yes |no |yes |no |yes `rcs_remove` |yes |yes |yes |yes |no |yes |no |yes `rcs_diff` |yes |yes |yes |yes |no |yes |yes |yes +`rcs_getctime` |fast |slow |slow |slow |slow |slow |slow |slow +`rcs_getmtime` |fast |no |no |no |no |no |no |no anonymous push |yes |no |no |no |no |no |no |no conflict handling |yes |yes |yes |buggy |yes |yes |yes |yes """]] diff --git a/doc/tips/Importing_posts_from_Wordpress.mdwn b/doc/tips/Importing_posts_from_Wordpress.mdwn index 59330caa4..8774c9723 100644 --- a/doc/tips/Importing_posts_from_Wordpress.mdwn +++ b/doc/tips/Importing_posts_from_Wordpress.mdwn @@ -1,6 +1,6 @@ Use case: You want to move away from Wordpress to Ikiwiki as your blogging/website platform, but you want to retain your old posts. -[This](http://git.chris-lamb.co.uk/?p=ikiwiki-wordpress-import.git) is a simple tool that generates [git-fast-import](http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html)-compatible data from a WordPress export XML file. It retains creation time of each post, so you can use Ikiwiki's --getctime to get the preserve creation times on checkout. +[This](http://git.chris-lamb.co.uk/?p=ikiwiki-wordpress-import.git) is a simple tool that generates [git-fast-import](http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html)-compatible data from a WordPress export XML file. It retains creation time of each post, so you can use Ikiwiki's --gettime to get the preserve creation times on checkout. WordPress categories are mapped onto Ikiwiki tags. The ability to import comments is planned. diff --git a/doc/tips/inside_dot_ikiwiki/discussion.mdwn b/doc/tips/inside_dot_ikiwiki/discussion.mdwn index 34d5b9252..69df369ec 100644 --- a/doc/tips/inside_dot_ikiwiki/discussion.mdwn +++ b/doc/tips/inside_dot_ikiwiki/discussion.mdwn @@ -6,14 +6,15 @@ My database appears corrupted: No idea how this happened. I've blown it away and recreated it but, for future reference, is there any less violent way to recover from this situation? I miss having the correct created and last edited times. --[[sabr]] > update: fixed ctimes and mtimes using [these instructions](http://u32.net/Mediawiki_Conversion/Git_Import/#Correct%20Creation%20and%20Last%20Edited%20time) --[[sabr]] -> That's overly complex. Just run `ikiwiki -setup your.setup -getctime`. +> That's overly complex. Just run `ikiwiki -setup your.setup -gettime`. > BTW, I'd be interested in examining such a corrupt storable file to try > to see what happened to it. --[[Joey]] ->> --getctime appears to only set the last edited date. It's not supposed to set the creation date, is it? The only place that info is stored is in the git repo. +>> --gettime appears to only set the last edited date. It's not supposed to set the creation date, is it? The only place that info is stored is in the git repo. >>> Pulling the page creation date out of the git history is exactly what ->>> --getctime does. --[[Joey]] +>>> --gettime does. (It used to be called --getctime, and only do that; now +>>> it also pulls out the last modified date). --[[Joey]] >> Alas, I seem to have lost the bad index file to periodic /tmp wiping; I'll send it to you if it happens again. --[[sabr]] diff --git a/doc/todo/auto_getctime_on_fresh_build.mdwn b/doc/todo/auto_getctime_on_fresh_build.mdwn index ea95fb8c9..760c56fa1 100644 --- a/doc/todo/auto_getctime_on_fresh_build.mdwn +++ b/doc/todo/auto_getctime_on_fresh_build.mdwn @@ -1,9 +1,13 @@ [[!tag wishlist]] -It might be a good idea to enable --getctime when `.ikiwiki` does not +It might be a good idea to enable --gettime when `.ikiwiki` does not exist. This way a new checkout of a `srcdir` would automatically get -ctimes right. (Running --getctime whenever a rebuild is done would be too +ctimes right. (Running --gettime whenever a rebuild is done would be too slow.) --[[Joey]] Could this be too annoying in some cases, eg, checking out a large wiki that needs to get set up right away? --[[Joey]] + +> Not for git with the new, optimised --getctime. For other VCS.. well, +> pity they're not as fast as git ;), but it is a one-time expense... +> [[done]] --[[Joey]] diff --git a/doc/usage.mdwn b/doc/usage.mdwn index db1e36a10..553fef01e 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -320,13 +320,11 @@ also be configured using a setup file. intercepted. If you enable this option then you must run at least the CGI portion of ikiwiki over SSL. -* --getctime +* --gettime - Pull creation time for each new page out of the revision control - system. This rarely used option provides a way to get the real creation - times of items in weblogs, such as when building a wiki from a new - VCS checkout. It is unoptimised and quite slow. It is best used - with --rebuild, to force ikiwiki to get the ctime for all pages. + Extract creation and modification times for each new page from the + the revision control's log. This is done automatically when building a + wiki for the first time, so you normally do not need to use this option. * --set var=value diff --git a/ikiwiki.in b/ikiwiki.in index 38e4d3201..801ff9a0b 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -44,7 +44,8 @@ sub getconfig () { "wrappergroup=s" => \$config{wrappergroup}, "usedirs!" => \$config{usedirs}, "prefix-directives!" => \$config{prefix_directives}, - "getctime" => \$config{getctime}, + "getctime" => \$config{gettime}, + "gettime" => \$config{gettime}, "numbacklinks=i" => \$config{numbacklinks}, "rcs=s" => \$config{rcs}, "no-rcs" => sub { $config{rcs}="" }, diff --git a/mtime-to-git b/mtime-to-git deleted file mode 100755 index 9875af5d7..000000000 --- a/mtime-to-git +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Sets mtimes of all files in the tree their last change date -# based on git's log. Useful to avoid too new dates after a -# fresh checkout, which lead to ikiwiki unnecessarily rebuilding -# basewiki files on upgrade. -if [ -d .git ]; then - for file in $(git ls-files); do - date="$(git log -1 --date=rfc "$file" | grep ^Date: | sed -e 's/Date://')" - if [ -n "$date" ]; then - echo "$date $file" - touch -d"$date" $file - fi - done -fi -- cgit v1.2.3 From dee2940c0bc97080088c99f399cd0ff0df3bec23 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Apr 2010 18:29:45 -0400 Subject: automatically run --gettime, and optimise it for git * Automatically run --gettime the first time ikiwiki is run on a given srcdir. * Optimise --gettime for git, so it's appropriatly screamingly fast. (This could be done for other backends too.) * However, --gettime for git no longer follows renames. * Use above to fix up timestamps on docwiki, as well as ensure that timestamps on basewiki files shipped in the deb are sane. --- IkiWiki.pm | 2 +- IkiWiki/Plugin/git.pm | 48 ++++++++++++++++++++++++++++++++++++------------ IkiWiki/Render.pm | 11 +++++++++-- debian/changelog | 7 +++++++ debian/control | 2 +- doc/plugins/write.mdwn | 4 ++++ doc/usage.mdwn | 2 +- docwiki.setup | 17 ++++++++++++++++- ikiwiki.in | 2 +- 9 files changed, 76 insertions(+), 19 deletions(-) (limited to 'doc/usage.mdwn') diff --git a/IkiWiki.pm b/IkiWiki.pm index 7655dada5..b37b1f344 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -442,7 +442,6 @@ sub getsetup () { }, gettime => { type => "internal", - default => 0, description => "running in gettime mode", safe => 0, rebuild => 0, @@ -1512,6 +1511,7 @@ sub loadindex () { open ($in, "<", "$config{wikistatedir}/indexdb") || return; } else { + $config{gettime}=1; # first build return; } } diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 86d80186f..aa402c04f 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -616,27 +616,51 @@ sub rcs_diff ($) { } } -sub rcs_getctime ($) { +{ +my %time_cache; + +sub findtimes ($$) { my $file=shift; + my $id=shift; # 0 = mtime ; 1 = ctime + # Remove srcdir prefix $file =~ s/^\Q$config{srcdir}\E\/?//; - my @raw_lines = run_or_die('git', 'log', - '--follow', '--no-merges', - '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c', - '-r', '--', $file); - my @ci; - while (my $parsed = parse_diff_tree("", \@raw_lines)) { - push @ci, $parsed; + if (! keys %time_cache) { + my $date; + foreach my $line (run_or_die('git', 'log', + '--pretty=format:%ct', + '--name-only', '--relative')) { + if (! defined $date && $line =~ /^(\d+)$/) { + $date=$line; + } + elsif (! length $line) { + $date=undef; + } + else { + if (! $time_cache{$line}) { + $time_cache{$line}[0]=$date; # mtime + } + $time_cache{$line}[1]=$date; # ctime + } + } } - my $ctime = $ci[$#ci]->{'author_epoch'}; - debug("ctime for '$file': ". localtime($ctime)); - return $ctime; + return exists $time_cache{$file} ? $time_cache{$file}[$id] : 0; +} + +} + +sub rcs_getctime ($) { + my $file=shift; + + return findtimes($file, 1); } sub rcs_getmtime ($) { - error "rcs_getmtime is not implemented for git\n"; # TODO + my $file=shift; + + return findtimes($file, 0); } sub rcs_receive () { diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index e1cb68462..a6b0f0617 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -352,6 +352,8 @@ sub find_new_files ($) { my @new; my @internal_new; + my $times_noted; + foreach my $file (@$files) { my $page=pagename($file); if (exists $pagesources{$page} && $pagesources{$page} ne $file) { @@ -363,7 +365,12 @@ sub find_new_files ($) { if (isinternal($page)) { push @internal_new, $file; } - else { + elsif ($config{rcs}) { + if (! $times_noted) { + debug(sprintf(gettext("querying %s for file creation and modification times.."), $config{rcs})); + $times_noted=1; + } + push @new, $file; if ($config{gettime} && -e "$config{srcdir}/$file") { eval { @@ -377,7 +384,7 @@ sub find_new_files ($) { } my $mtime; eval { - my $mtime=rcs_getmtime("$config{srcdir}/$file"); + $mtime=rcs_getmtime("$config{srcdir}/$file"); }; if ($@) { print STDERR $@; diff --git a/debian/changelog b/debian/changelog index 615d5916f..60a67cbe3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -47,8 +47,15 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low * Rename --getctime to --gettime. (The old name still works for backwards compatability.) * --gettime now also looks up last modification time. + * Automatically run --gettime the first time ikiwiki is run on + a given srcdir. * Add rcs_getmtime to plugin API; currently only implemented for git. + * Optimise --gettime for git, so it's appropriatly screamingly + fast. (This could be done for other backends too.) + * However, --gettime for git no longer follows renames. + * Use above to fix up timestamps on docwiki, as well as ensure that + timestamps on basewiki files shipped in the deb are sane. -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/debian/control b/debian/control index 87f7d8209..ae06f32b0 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends-Indep: dpkg-dev (>= 1.9.0), libxml-simple-perl, libtimedate-perl, libhtml-template-perl, libhtml-scrubber-perl, wdg-html-validator, libhtml-parser-perl, liburi-perl, perlmagick, po4a (>= 0.34), - libfile-chdir-perl + libfile-chdir-perl, Maintainer: Joey Hess Uploaders: Josh Triplett Standards-Version: 3.8.4 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index cf7044b2c..0bf6fcf48 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -1085,6 +1085,8 @@ it up in the history. It's ok if this is not implemented, and throws an error. +If the RCS cannot determine a ctime for the file, return 0. + #### `rcs_getmtime($)` This is used to get the page modification time for a file from the RCS, by @@ -1092,6 +1094,8 @@ looking it up in the history. It's ok if this is not implemented, and throws an error. +If the RCS cannot determine a mtime for the file, return 0. + #### `rcs_receive()` This is called when ikiwiki is running as a pre-receive hook (or diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 553fef01e..2e12517ea 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -320,7 +320,7 @@ also be configured using a setup file. intercepted. If you enable this option then you must run at least the CGI portion of ikiwiki over SSL. -* --gettime +* --gettime, --no-gettime Extract creation and modification times for each new page from the the revision control's log. This is done automatically when building a diff --git a/docwiki.setup b/docwiki.setup index 8278b73ea..6bc200066 100644 --- a/docwiki.setup +++ b/docwiki.setup @@ -1,6 +1,18 @@ #!/usr/bin/perl # Configuration file for ikiwiki to build its documentation wiki. +# Use git during the build, if it's available and if we're building +# from a git checkout. This ensures ikiwiki gets the right mtimes and +# ctimes for files in the doc wiki. +our $rcs="norcs"; +BEGIN { + my $git=`which git 2>&1`; + chomp $git; + if (-x $git && -d ".git") { + $rcs="git"; + } +} + use IkiWiki::Setup::Standard { wikiname => "ikiwiki", srcdir => "doc", @@ -9,7 +21,7 @@ use IkiWiki::Setup::Standard { underlaydirbase => "underlays", underlaydir => "underlays/basewiki", discussion => 0, - exclude => qr/\/discussion|bugs\/*|todo\/*|forum\/*/, + exclude => qr/\/discussion|bugs\/*|todo\/*|forum\/*/, # save space locale => '', verbose => 1, syslog => 0, @@ -17,4 +29,7 @@ use IkiWiki::Setup::Standard { usedirs => 0, prefix_directives => 1, add_plugins => [qw{goodstuff version haiku polygen fortune table}], + disable_plugins => [qw{recentchanges}], # not appropriate for doc dir + rcs => $rcs, + gitorigin_branch => '', # don't pull during build } diff --git a/ikiwiki.in b/ikiwiki.in index 801ff9a0b..acd37f802 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -45,7 +45,7 @@ sub getconfig () { "usedirs!" => \$config{usedirs}, "prefix-directives!" => \$config{prefix_directives}, "getctime" => \$config{gettime}, - "gettime" => \$config{gettime}, + "gettime!" => \$config{gettime}, "numbacklinks=i" => \$config{numbacklinks}, "rcs=s" => \$config{rcs}, "no-rcs" => sub { $config{rcs}="" }, -- cgit v1.2.3 From 7e79da76332b93214a7d9a5c91bc046db4219ee2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Apr 2010 16:10:46 -0400 Subject: template docu reorg Remove wikitemplates page; fold its contents into templates page. Update all backlinks. Document new ability to put templates inside srcdir. --- doc/bugs/SSI_include_stripped_from_mdwn.mdwn | 2 +- doc/bugs/login_page_non-obvious_with_openid.mdwn | 4 +- doc/features.mdwn | 2 +- doc/freesoftware.mdwn | 2 +- doc/ikiwiki-calendar.mdwn | 2 +- doc/ikiwiki/directive/edittemplate.mdwn | 2 +- doc/ikiwiki/directive/pagetemplate.mdwn | 8 +- doc/ikiwiki/directive/template.mdwn | 8 +- doc/plugins/autoindex.mdwn | 2 +- doc/plugins/map/discussion.mdwn | 2 +- doc/plugins/pagetemplate.mdwn | 6 +- doc/plugins/template.mdwn | 4 +- doc/plugins/write.mdwn | 4 +- doc/templates.mdwn | 91 +++++++++++++++++++--- doc/tips/comments_feed.mdwn | 2 +- ...o-create_tag_pages_according_to_a_template.mdwn | 2 +- doc/todo/auto_rebuild_on_template_change.mdwn | 2 +- doc/todo/html.mdwn | 2 +- doc/todo/multiple_templates.mdwn | 2 +- doc/usage.mdwn | 5 +- doc/wikitemplates.mdwn | 52 ------------- doc/wikitemplates/discussion.mdwn | 46 ----------- 22 files changed, 111 insertions(+), 141 deletions(-) delete mode 100644 doc/wikitemplates.mdwn delete mode 100644 doc/wikitemplates/discussion.mdwn (limited to 'doc/usage.mdwn') diff --git a/doc/bugs/SSI_include_stripped_from_mdwn.mdwn b/doc/bugs/SSI_include_stripped_from_mdwn.mdwn index 5519e45c6..270da86d3 100644 --- a/doc/bugs/SSI_include_stripped_from_mdwn.mdwn +++ b/doc/bugs/SSI_include_stripped_from_mdwn.mdwn @@ -10,7 +10,7 @@ If I have a <--#include virtual="foo" --> in some file, it gets stripped, > Anyway, it makes sense for the htmlscrubber to strip server-side > includes because otherwise your wiki could be attacked > by them being added to it. If you want to use both the htmlscrubber and -> SSI together, I'd suggest you modify the [[wikitemplates]] +> SSI together, I'd suggest you modify the [[templates]] > and put the SSI on there. > > Ie, `page.tmpl` has a diff --git a/doc/bugs/login_page_non-obvious_with_openid.mdwn b/doc/bugs/login_page_non-obvious_with_openid.mdwn index 1d087985a..9aa702037 100644 --- a/doc/bugs/login_page_non-obvious_with_openid.mdwn +++ b/doc/bugs/login_page_non-obvious_with_openid.mdwn @@ -36,7 +36,7 @@ If you want to keep it as one form, then perhaps using some javascript to disabl > that allows modifying that form, but does not allow creating a separate > form. The best way to make it obvious how to use it currently is to just > disable password auth, then it's nice and simple. :-) Javascript is an -> interesting idea. It's also possible to write a custom [[signin.tmpl wikitemplates]] that +> interesting idea. It's also possible to write a custom [[templates]] that > is displayed instead of the regular signin form, and it should be > possible to use that to manually lay it out better than FormBuilder > manages with its automatic layout. --[[Joey]] @@ -44,4 +44,4 @@ If you want to keep it as one form, then perhaps using some javascript to disabl > I've improved the form, I think it's more obvious now that the openid > stuff is separate. Good enough to call this [[done]]. I think. --[[Joey]] ->> Looks good, thanks! :-) -- [[AdamShand]] \ No newline at end of file +>> Looks good, thanks! :-) -- [[AdamShand]] diff --git a/doc/features.mdwn b/doc/features.mdwn index ab521213d..07ce648ea 100644 --- a/doc/features.mdwn +++ b/doc/features.mdwn @@ -72,7 +72,7 @@ you would care to syndicate. Ikiwiki aims to produce [valid XHTML 1.0](http://validator.w3.org/check?url=referer). Ikiwiki -generates html using [[templates|wikitemplates]], and uses [[css]], so you +generates html using [[templates]], and uses [[css]], so you can change the look and layout of all pages in any way you would like. ## [[Plugins]] diff --git a/doc/freesoftware.mdwn b/doc/freesoftware.mdwn index 7ac1ac6b4..2243d9b1f 100644 --- a/doc/freesoftware.mdwn +++ b/doc/freesoftware.mdwn @@ -4,7 +4,7 @@ ikiwiki, and this documentation wiki, are licensed under the terms of the GNU [[GPL]], version 2 or later. The parts of ikiwiki that become part of your own wiki (the [[basewiki]] -pages (but not the smilies) and the [[templates|wikitemplates]]) are licensed +pages (but not the smilies) and the [[templates]]) are licensed as follows: > Redistribution and use in source and compiled forms, with or without diff --git a/doc/ikiwiki-calendar.mdwn b/doc/ikiwiki-calendar.mdwn index c1f4d7267..03cbdd86c 100644 --- a/doc/ikiwiki-calendar.mdwn +++ b/doc/ikiwiki-calendar.mdwn @@ -43,7 +43,7 @@ An example crontab: # TEMPLATES -This command uses two [[template|wikitemplates]] to generate +This command uses two [[templates]] to generate the pages, `calendarmonth.tmpl` and `calendaryear.tmpl`. # AUTHOR diff --git a/doc/ikiwiki/directive/edittemplate.mdwn b/doc/ikiwiki/directive/edittemplate.mdwn index d731bdb47..c486e821b 100644 --- a/doc/ikiwiki/directive/edittemplate.mdwn +++ b/doc/ikiwiki/directive/edittemplate.mdwn @@ -21,7 +21,7 @@ something like: Details: The template page can also contain [[!cpan HTML::Template]] directives, -similar to other ikiwiki [[templates]]. Currently only one variable is +like other ikiwiki [[templates]]. Currently only one variable is set: `` is replaced with the name of the page being created. diff --git a/doc/ikiwiki/directive/pagetemplate.mdwn b/doc/ikiwiki/directive/pagetemplate.mdwn index 8ad901c1a..401b38099 100644 --- a/doc/ikiwiki/directive/pagetemplate.mdwn +++ b/doc/ikiwiki/directive/pagetemplate.mdwn @@ -1,17 +1,13 @@ The `pagetemplate` directive is supplied by the [[!iki plugins/pagetemplate desc=pagetemplate]] plugin. -This directive allows a page to be displayed using a different template than -the default `page.tmpl` template. +This directive allows a page to be displayed using a different +[[template|templates]] than the default `page.tmpl` template. The page text is inserted into the template, so the template controls the overall look and feel of the wiki page. This is in contrast to the [[ikiwiki/directive/template]] directive, which allows inserting templates _into_ the body of a page. -This directive can only reference templates that are already installed -by the system administrator, typically into the -`/usr/share/ikiwiki/templates` directory. Example: - \[[!pagetemplate template="my_fancy.tmpl"]] [[!meta robots="noindex, follow"]] diff --git a/doc/ikiwiki/directive/template.mdwn b/doc/ikiwiki/directive/template.mdwn index ae71ba5b5..052ca7873 100644 --- a/doc/ikiwiki/directive/template.mdwn +++ b/doc/ikiwiki/directive/template.mdwn @@ -1,7 +1,11 @@ The `template` directive is supplied by the [[!iki plugins/template desc=template]] plugin. -[[Templates]] are files that can be filled out and inserted into pages in the -wiki, by using the template directive. The directive has an `id` parameter +The template directive allows wiki pages to be used as templates. +These templates can be filled out and inserted into other pages in the +wiki using the directive. The [[templates]] page lists templates +that can be used with this directive. + +The directive has an `id` parameter that identifies the template to use. The remaining parameters are used to fill out the template. diff --git a/doc/plugins/autoindex.mdwn b/doc/plugins/autoindex.mdwn index d1133e4f5..7c4e40419 100644 --- a/doc/plugins/autoindex.mdwn +++ b/doc/plugins/autoindex.mdwn @@ -3,5 +3,5 @@ This plugin searches for [[SubPages|ikiwiki/subpage]] with a missing parent page, and generates the parent pages. The generated page content is -controlled by the `autoindex.tmpl` [[template|wikitemplates]], which by +controlled by the `autoindex.tmpl` [[template|templates]], which by default, uses a [[map]] to list the SubPages. diff --git a/doc/plugins/map/discussion.mdwn b/doc/plugins/map/discussion.mdwn index 2f7b140d6..54c921b0f 100644 --- a/doc/plugins/map/discussion.mdwn +++ b/doc/plugins/map/discussion.mdwn @@ -1,7 +1,7 @@ I'm wanting a [[map]] (with indentation levels) showing page _titles_ instead of page 'names'. As far as I can see, this is not an option with existing plugins - I can get a list of pages using [[inline]] and -appropriate [[wikitemplates]], but that has no indentation and therefore +appropriate [[templates]], but that has no indentation and therefore doesn't show structure well. The quick way is to modify the map plugin to have a 'titles' option. The diff --git a/doc/plugins/pagetemplate.mdwn b/doc/plugins/pagetemplate.mdwn index 53f069d0d..8254e14c5 100644 --- a/doc/plugins/pagetemplate.mdwn +++ b/doc/plugins/pagetemplate.mdwn @@ -3,8 +3,4 @@ This plugin provides the [[ikiwiki/directive/pagetemplate]] [[ikiwiki/directive]], which allows a page to be displayed -using a different [[template|wikitemplates]] than the default. - -This plugin can only use templates that are already installed in -`/usr/share/ikiwiki/templates` (or wherever ikiwiki is configured to look for -them). You can choose to use any .tmpl files in that directory. +using a different [[template|templates]] than the default. diff --git a/doc/plugins/template.mdwn b/doc/plugins/template.mdwn index da775f232..8d17e2825 100644 --- a/doc/plugins/template.mdwn +++ b/doc/plugins/template.mdwn @@ -3,5 +3,5 @@ This plugin provides the [[ikiwiki/directive/template]] [[ikiwiki/directive]]. With this plugin, you can set up templates, and cause them to be filled out -and inserted into pages in the wiki. It's documented and existing templates -are listed in the [[templates]] page. +and inserted into pages in the wiki. Existing templates are listed in the +[[templates]] page. diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 00b54bdd3..9128c7f54 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -297,7 +297,7 @@ value is ignored. hook(type => "pagetemplate", id => "foo", call => \&pagetemplate); -[[Templates|wikitemplates]] are filled out for many different things in +[[Templates]] are filled out for many different things in ikiwiki, like generating a page, or part of a blog page, or an rss feed, or a cgi. This hook allows modifying the variables available on those templates. The function is passed named parameters. The "page" and @@ -313,7 +313,7 @@ a new custom parameter to the template. hook(type => "templatefile", id => "foo", call => \&templatefile); -This hook allows plugins to change the [[template|wikitemplates]] that is +This hook allows plugins to change the [[template|templates]] that is used for a page in the wiki. The hook is passed a "page" parameter, and should return the name of the template file to use (relative to the template directory), or undef if it doesn't want to change the default diff --git a/doc/templates.mdwn b/doc/templates.mdwn index f2b581d2f..f7b3adae5 100644 --- a/doc/templates.mdwn +++ b/doc/templates.mdwn @@ -1,17 +1,88 @@ -[[!meta robots="noindex, follow"]] -[[!if test="enabled(template)" -then="This wiki has templates **enabled**." -else="This wiki has templates **disabled**." -]] +[[Ikiwiki]] uses many templates for many purposes. By editing its templates, +you can fully customise this site. -Templates are files that can be filled out and inserted into pages in the -wiki. +[[!if test="enabled(template)" then=""" +## The template directive +The template directive allows wiki pages to be used as templates. +These templates can be filled out and inserted into other pages in the +wiki using the directive. +"""]] [[!if test="enabled(template) and enabled(inline)" then=""" - -These templates are available for use with the template directive. - [[!inline pages="templates/* and !*/discussion" feeds=no archive=yes sort=title template=titlepage rootpage=templates postformtext="Add a new template named:"]] """]] + +[[!if test="enabled(edittemplate)" then=""" +## The edittemplate directive + +The edittemplate directive can be used to make new pages default to +containing text from a template, which can be filled as out the page is +edited. +"""]] + +## Wiki templates + +These templates are used to build the wiki. The aim is to keep almost all +html out of ikiwiki and in the templates. + +* `page.tmpl` - Used for displaying all regular wiki pages. +* `misc.tmpl` - Generic template used for any page that doesn't + have a custom template. +* `editpage.tmpl` - Create/edit page. +* `change.tmpl` - Used to create a page describing a change made to the wiki. +* `passwordmail.tmpl` - Not a html template, this is used to + generate a mail with an url the user can use to reset their password. +* `rsspage.tmpl` - Used for generating rss feeds for [[blogs|blog]]. +* `rssitem.tmpl` - Used for generating individual items on rss feeds. +* `atompage.tmpl` - Used for generating atom feeds for blogs. +* `atomitem.tmpl` - Used for generating individual items on atom feeds. +* `inlinepage.tmpl` - Used for adding a page inline in a blog + page. +* `archivepage.tmpl` - Used for listing a page in a blog archive page. +* `microblog.tmpl` - Used for showing a microblogging post inline. +* `blogpost.tmpl` - Used for a form to add a post to a blog (and a rss/atom links) +* `feedlink.tmpl` - Used to add rss/atom links if blogpost.tmpl is not used. +* `aggregatepost.tmpl` - Used by the [[plugins/aggregate]] plugin to create + a page for a post. +* `searchform.tmpl` - Used by the [[plugins/search]] plugin to add a search + form to wiki pages. +* `searchquery.tmpl` - This is an omega template, used by the + [[plugins/search]] plugin. +* `comment.tmpl` - This template is used to display a comment + by the [[plugins/comments]] plugin. +* `editcomment.tmpl` - This template is the comment post form for the + [[plugins/comments]] plugin. +* `commentmoderation.tmpl` - This template is used to produce the comment + moderation form. +* `recentchanges.tmpl` - This template is used for listing a change + on the RecentChanges page. + +[[!if test="enabled(pagetemplate)" then=""" +## The pagetemplate directive + +The pagetemplate directive can allow individual pages to use a +different template than `page.tmpl`. +"""]] + +## Template locations + +Templates are located in `/usr/share/ikiwiki/templates` by default; +the `templatedir` setting can be used to make another directory be +searched first. Customized templates can also be placed inside the +"templates/" directory in your wiki's source. + +## Template syntax + +Ikiwiki uses the HTML::Template module as its template engine. This +supports things like conditionals and loops in templates and is pretty easy +to learn. All you really need to know are a few things: + +* To insert the value of a template variable, use ``. +* To make a block of text conditional on a variable being set use + `text`. +* To use one block of text if a variable is set and a second if it's not, + use `textother text` + +[[!meta robots="noindex, follow"]] diff --git a/doc/tips/comments_feed.mdwn b/doc/tips/comments_feed.mdwn index 6f8137256..6d4dbb803 100644 --- a/doc/tips/comments_feed.mdwn +++ b/doc/tips/comments_feed.mdwn @@ -6,5 +6,5 @@ add a feed that contains all the comments posted to any page. Here's how: \[[!inline pages="internal(*/comment_*)" template=comment]] The special [[ikiwiki/PageSpec]] matches all comments. The -[[template|wikitemplates]] causes the comments to be displayed formatted +[[template|templates]] causes the comments to be displayed formatted nicely. diff --git a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn index f6d444890..7eb404910 100644 --- a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn +++ b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn @@ -17,7 +17,7 @@ The new tag file is then complied during the change phase. *see git history of this page if you want the patch --[[smcv]]* -This uses a [[template|wikitemplates]] called `autotagpage.tmpl`, here is my template file: +This uses a [[template|templates]] called `autotagpage.tmpl`, here is my template file: \[[!inline pages="link()" archive="yes"]] diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index a112cb9da..838d15c1a 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -6,7 +6,7 @@ This would allow setting: templatedir => "$srcdir/templates", -.. and then the [[wikitemplates]] are managed like other wiki files; and +.. and then the [[templates]] are managed like other wiki files; and like other wiki files, a change to them automatically updates dependent pages. diff --git a/doc/todo/html.mdwn b/doc/todo/html.mdwn index 44f20c876..4f4542be2 100644 --- a/doc/todo/html.mdwn +++ b/doc/todo/html.mdwn @@ -1,6 +1,6 @@ Create some nice(r) stylesheets. Should be doable w/o touching a single line of code, just -editing the [[wikitemplates]] and/or editing [[style.css]]. +editing the [[templates]] and/or editing [[style.css]]. [[done]] ([[css_market]] ..) diff --git a/doc/todo/multiple_templates.mdwn b/doc/todo/multiple_templates.mdwn index 72783c556..30fb8d6ee 100644 --- a/doc/todo/multiple_templates.mdwn +++ b/doc/todo/multiple_templates.mdwn @@ -1,4 +1,4 @@ -> Another useful feature might be to be able to choose a different [[template|wikitemplates]] +> Another useful feature might be to be able to choose a different [[template|templates]] > file for some pages; [[blog]] pages would use a template different from the > home page, even if both are managed in the same repository, etc. diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 2e12517ea..9cf61cc6c 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -120,10 +120,11 @@ also be configured using a setup file. * --templatedir dir - Specify the directory that the page [[templates|wikitemplates]] are stored in. + Specify the directory that [[templates|templates]] are stored in. Default is `/usr/share/ikiwiki/templates`, or another location as configured at build time. If the templatedir is changed, missing templates will still - be searched for in the default location as a fallback. + be searched for in the default location as a fallback. Templates can also be + placed in the "templates/" subdirectory of the srcdir. Note that if you choose to copy and modify ikiwiki's templates, you will need to be careful to keep them up to date when upgrading to new versions of diff --git a/doc/wikitemplates.mdwn b/doc/wikitemplates.mdwn deleted file mode 100644 index 6e5a7261d..000000000 --- a/doc/wikitemplates.mdwn +++ /dev/null @@ -1,52 +0,0 @@ -ikiwiki uses the HTML::Template module as its template engine. This -supports things like conditionals and loops in templates and is pretty easy -to learn. - -The aim is to keep almost all html out of ikiwiki and in the templates. - -It ships with some basic templates which can be customised. These are -located in `/usr/share/ikiwiki/templates` by default; the `templatedir` -setting can be used to make another directory be searched first. - -* `page.tmpl` - Used for displaying all regular wiki pages. -* `misc.tmpl` - Generic template used for any page that doesn't - have a custom template. -* `editpage.tmpl` - Create/edit page. -* `change.tmpl` - Used to create a page describing a change made to the wiki. -* `passwordmail.tmpl` - Not a html template, this is used to - generate a mail with an url the user can use to reset their password. -* `rsspage.tmpl` - Used for generating rss feeds for [[blogs|blog]]. -* `rssitem.tmpl` - Used for generating individual items on rss feeds. -* `atompage.tmpl` - Used for generating atom feeds for blogs. -* `atomitem.tmpl` - Used for generating individual items on atom feeds. -* `inlinepage.tmpl` - Used for adding a page inline in a blog - page. -* `archivepage.tmpl` - Used for listing a page in a blog archive page. -* `microblog.tmpl` - Used for showing a microblogging post inline. -* `blogpost.tmpl` - Used for a form to add a post to a blog (and a rss/atom links) -* `feedlink.tmpl` - Used to add rss/atom links if blogpost.tmpl is not used. -* `aggregatepost.tmpl` - Used by the [[plugins/aggregate]] plugin to create - a page for a post. -* `searchform.tmpl` - Used by the [[plugins/search]] plugin to add a search - form to wiki pages. -* `searchquery.tmpl` - This is an omega template, used by the - [[plugins/search]] plugin. -* `comment.tmpl` - This template is used to display a comment - by the [[plugins/comments]] plugin. -* `editcomment.tmpl` - This template is the comment post form for the - [[plugins/comments]] plugin. -* `commentmoderation.tmpl` - This template is used to produce the comment - moderation form. -* `recentchanges.tmpl` - This template is used for listing a change - on the RecentChanges page. - -The [[plugins/pagetemplate]] plugin can allow individual pages to use a -different template than `page.tmpl`. - -The [[plugins/template]] plugin also uses templates, though those -[[templates]] are typically stored as pages in the wiki, and are inserted -into pages. - -The [[plugins/edittemplate]] plugin is used to make new pages default to -containing text from a template, which can be filled as out the page is -edited. diff --git a/doc/wikitemplates/discussion.mdwn b/doc/wikitemplates/discussion.mdwn deleted file mode 100644 index f97444e5f..000000000 --- a/doc/wikitemplates/discussion.mdwn +++ /dev/null @@ -1,46 +0,0 @@ -## Place for local templates -Where does one put any locally modified templates for an individual ikiwiki? --Ivan Z. - -> You can put them whereever you like; the `templatedir` controls -> where ikiwiki looks for them. --[[Joey]] - -Thank you for your response! My question arose out of my intention to make -custom templates for a wiki--specifically suited for the kind of content -it will have--so, that would mean I would want to distribute them through -git together with other content of the wiki. So, for this case the -separation of conceptually ONE thing (the content, the templates, and the -config option which orders to use these templates) into THREE separate -files/repos (the main content repo, the repo with templates, and the config -file) is not convenient: instead of distributing a single repo, I have to -tell people to take three things if they want to replicate this wiki. How -would you solve this inconvenience? Perhaps, a default location of the -templates *inside* the source repo would do?--Ivan Z. - -> I would avoid putting the templates in a subdirectory of the ikiwiki srcdir. -> (I'd also avoid putting the ikiwiki setup file there.) -> While it's safe to do either in some cases, there are configurations where -> it's unsafe. For example, a malicious user could use attachment handling to -> replace those files with their own, bad versions. -> -> So, two ideas for where to put the templatedir and ikiwiki setup. - -> * The easiest option is to put your wiki content in a subdirectory -> ("wiki", say) and point `srcdir` at that. -> then you can have another subdirectory for the wikitemplates, -> and put the setup file at the top. -> * Another option if using git would be to have a separate branch, -> in the same git repository, that holds wikitemplates and the setup file. -> Then you check out the repository once to make the `srcdir` available, -> and have a second checkout, of the other branch, to make the other stuff -> available. -> -> Note that with either of these methods, you have to watch out if -> giving other direct commit access to the repository. They could -> still edit the setup file and templates, so only trusted users should -> be given access. (It is, however, perfectly safe to let people edit -> the wiki via the web, and is even safe to configure -> [[tips/untrusted_git_push]] to such a repository.) --[[Joey]] - -Thanks, that's a nice and simple idea: to have a subdirectory! I'll try it. --Ivan Z. - -A [[!taglink wish|wishlist]]: the ikiwiki program could be improved so that it follows the same logic as git in looking for its config: it could ascend directories until it finds an `.ikiwiki/` directory with `.ikiwiki/setup` and then uses that configuration. Now I'm tired to always type `ikiwiki --setup path/to/the/setup --refresh` when working in my working clone of the sources; I'd like to simply type `ikiwiki` instead, and let it find the setup file. The default location to look for templates could also be made to be a sibling of the setup file: `.ikiwiki/templates/`. --Ivan Z. -- cgit v1.2.3 From 506075695f32a63bfc8b57cef1a601bd937b7a72 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 25 Apr 2010 14:16:53 -0400 Subject: typo --- doc/usage.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/usage.mdwn') diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 9cf61cc6c..2f87d60d5 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -330,7 +330,7 @@ also be configured using a setup file. * --set var=value This allows setting an arbitrary configuration variable, the same as if it - were set via a setup file. Since most options commonly used options can be + were set via a setup file. Since most commonly used options can be configured using command-line switches, you will rarely need to use this. * --set-yaml var=value -- cgit v1.2.3 From 7dbad39bbe93ebcc05f278965906fd1c77d2bc34 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 8 Jul 2010 14:01:52 -0400 Subject: Add --changesetup mode that allows easily changing options in a setup file. --- debian/changelog | 2 ++ doc/setup.mdwn | 6 ++++++ doc/usage.mdwn | 14 +++++++++++--- ikiwiki.in | 38 ++++++++++++++++++++++++++------------ 4 files changed, 45 insertions(+), 15 deletions(-) (limited to 'doc/usage.mdwn') diff --git a/debian/changelog b/debian/changelog index 9d88b5c9c..c340f8901 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ ikiwiki (3.20100705) UNRELEASED; urgency=low comment moderation queue. * aggregate: Write timestamp next aggregation can happen to .ikiwiki/aggregatetime, to allow for more sophisticated cron jobs. + * Add --changesetup mode that allows easily changing options in a + setup file. -- Joey Hess Mon, 05 Jul 2010 13:59:42 -0400 diff --git a/doc/setup.mdwn b/doc/setup.mdwn index 03fed3aa9..266222cc3 100644 --- a/doc/setup.mdwn +++ b/doc/setup.mdwn @@ -102,6 +102,12 @@ After making changes to this file, you need to tell ikiwiki to use it: % ikiwiki -setup foo.setup +Alternatively, you can ask ikiwiki to change settings in the file for you: + + % ikiwiki -changesetup foo.setup -plugin goodstuff + +See [[usage]] for more options. + ## Customizing file locations As a wiki compiler, ikiwiki builds a wiki from files in a source directory, diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 2f87d60d5..840d105d2 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -32,14 +32,22 @@ These options control the mode that ikiwiki operates in. * --setup setupfile - In setup mode, ikiwiki reads the config file, which is really a perl - program that can call ikiwiki internal functions. - The default action when --setup is specified is to automatically generate wrappers for a wiki based on data in a setup file, and rebuild the wiki. If you only want to build any changed pages, you can use --refresh with --setup. +* --changesetup setupfile + + Reads the setup file, adds any configuration changes specified by other + options, and writes the new configuration back to the setup file. Also + updates any configured wrappers. In this mode, the wiki is not fully + rebuilt, unless you also add --rebuild. + + Example, to enable some plugins: + + ikiwiki --changesetup ~/ikiwiki.setup --plugin goodstuff --plugin calendar + * --dumpsetup setupfile Causes ikiwiki to write to the specified setup file, dumping out diff --git a/ikiwiki.in b/ikiwiki.in index ac43044df..aa3337938 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -14,24 +14,32 @@ sub usage () { gettext(" ikiwiki --setup configfile"), "\n"; } +sub setup (@) { + require IkiWiki::Setup; + my $verbose=$config{verbose}; + my $syslog=$config{syslog}; + IkiWiki::Setup::load($_[1]); + $config{setupverbose}=$config{verbose}; + $config{setupsyslog}=$config{syslog}; + $config{verbose}=$verbose || $config{setupverbose}; + $config{syslog}=$syslog; + $config{setup}=1; +} + sub getconfig () { if (! exists $ENV{WRAPPED_OPTIONS}) { %config=defaultconfig(); eval q{use Getopt::Long}; Getopt::Long::Configure('pass_through'); GetOptions( - "setup|s=s" => sub { - require IkiWiki::Setup; - my $verbose=$config{verbose}; - my $syslog=$config{syslog}; - IkiWiki::Setup::load($_[1]); - $config{setupverbose}=$config{verbose}; - $config{setupsyslog}=$config{syslog}; - $config{verbose}=$verbose || $config{setupverbose}; - $config{syslog}=$syslog; - $config{setup}=1; - }, + "setup|s=s" => \&setup, "dumpsetup|s=s" => \$config{dumpsetup}, + "changesetup|s=s" => sub { + $config{changesetup}=$_[1]; + $config{genwrappers}=1; + $config{refresh}=1; + setup(@_); + }, "wikiname=s" => \$config{wikiname}, "verbose|v!" => \$config{verbose}, "syslog!" => \$config{syslog}, @@ -85,7 +93,8 @@ sub getconfig () { $config{wrappermode}=possibly_foolish_untaint($_[1]) }, "plugin=s@" => sub { - push @{$config{add_plugins}}, $_[1]; + push @{$config{add_plugins}}, $_[1] + unless grep { $_ eq $_[1] } @{$config{add_plugins}}; }, "disable-plugin=s@" => sub { push @{$config{disable_plugins}}, $_[1]; @@ -181,6 +190,11 @@ sub main () { } } + if ($config{changesetup}) { + require IkiWiki::Setup; + IkiWiki::Setup::dump($config{changesetup}); + } + if ($config{dumpsetup}) { $config{srcdir}="" if ! defined $config{srcdir}; $config{destdir}="" if ! defined $config{destdir}; -- cgit v1.2.3