diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-10-11 16:54:23 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-10-11 16:54:23 -0400 |
commit | a7cb3090902e23e2b0f2371539ade7ec5a4ba01b (patch) | |
tree | 1f97182b72da88c2f3d49980101242b8b5d073a2 /doc | |
parent | 5dba91cdc88c01ac1d314f24b12eb2cda651e206 (diff) | |
parent | 665da89c270f98e93b1eaa89e729f3975973ab8f (diff) | |
download | ikiwiki-a7cb3090902e23e2b0f2371539ade7ec5a4ba01b.tar ikiwiki-a7cb3090902e23e2b0f2371539ade7ec5a4ba01b.tar.gz |
Merge branch 'master' into dependency-types
Conflicts:
debian/changelog
doc/plugins/calendar.mdwn
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/blog.mdwn | 4 | ||||
-rw-r--r-- | doc/ikiwiki-calendar.mdwn | 51 | ||||
-rw-r--r-- | doc/ikiwiki/directive/calendar.mdwn | 29 | ||||
-rw-r--r-- | doc/plugins/calendar.mdwn | 8 | ||||
-rw-r--r-- | doc/plugins/contrib/groupfile.mdwn | 105 | ||||
-rw-r--r-- | doc/plugins/lockedit/discussion.mdwn | 21 | ||||
-rw-r--r-- | doc/sandbox.mdwn | 9 |
7 files changed, 206 insertions, 21 deletions
diff --git a/doc/examples/blog.mdwn b/doc/examples/blog.mdwn index 2155d7fea..f542cad0c 100644 --- a/doc/examples/blog.mdwn +++ b/doc/examples/blog.mdwn @@ -23,3 +23,7 @@ Some additional configuration you might want to do: enable comments to posts to the blog: comments_pagespec => 'blog/posts/* and !*/Discussion', + +* Enable the [[calendar|plugins/calendar]] plugin and run the + [[ikiwiki-calendar]] command from cron daily to get an interlinked + set of calendar archives. diff --git a/doc/ikiwiki-calendar.mdwn b/doc/ikiwiki-calendar.mdwn new file mode 100644 index 000000000..e2cc612f3 --- /dev/null +++ b/doc/ikiwiki-calendar.mdwn @@ -0,0 +1,51 @@ +# NAME + +ikiwiki-calendar - create calendar archive pages + +# SYNOPSIS + +ikiwiki-calendar [-f] your.setup [pagespec] [year] + +# DESCRIPTION + +`ikiwiki-calendar` creates pages that use the [[ikiwiki/directive/calendar]] +directive, allowing the archives to be browsed one month +at a time, with calendar-based navigation. + +You must specify the setup file for your wiki. The pages will +be created inside its `srcdir`, beneath the `archivebase` +directory used by the calendar plugin (default "archives"). + +You will probably want to specify a [[ikiwiki/PageSpec]] +to control which pages are included on the calendars. The +default is all pages. To limit it to only posts in a blog, +use something like "posts/* and !*/Discussion". + +It defaults to creating calendar pages for the current +year, as well as the previous year, and the next year. +If you specify a year, it will create pages for that year. + +Existing pages will not be overwritten by this command by default. +Use the `-f` switch to force it to overwrite any existing pages. + +## CRONTAB + +While this command only needs to be run once a year to update +the archive pages for each new year, you are recommended to set up +a cron job to run it daily, at midnight. Then it will also update +the calendars to highlight the current day. + +An example crontab: + + 0 0 * * * ikiwiki-calendar ~/ikiwiki.setup "posts/* and !*/Discussion" + +# TEMPLATES + +This command uses two [[template|wikitemplates]] to generate +the pages, `calendarmonth.tmpl` and `calendaryear.tmpl`. + +# AUTHOR + +Joey Hess <joey@ikiwiki.info> + +Warning: this page is automatically made into ikiwiki-calendar's man page, edit with care diff --git a/doc/ikiwiki/directive/calendar.mdwn b/doc/ikiwiki/directive/calendar.mdwn index 8a257d6eb..b2ac75b11 100644 --- a/doc/ikiwiki/directive/calendar.mdwn +++ b/doc/ikiwiki/directive/calendar.mdwn @@ -1,5 +1,4 @@ The `calendar` directive is supplied by the [[!iki plugins/calendar desc=calendar]] plugin. -This plugin requires extra setup. See the plugin documentation for details. This directive displays a calendar, similar to the typical calendars shown on some blogs. @@ -12,16 +11,28 @@ some blogs. \[[!calendar type="year" year="2005" pages="blog/* and !*/Discussion"]] +## setup + The calendar is essentially a fancy front end to archives of previous pages, usually used for blogs. It can produce a calendar for a given month, -or a list of months for a given year. - -The month format calendar simply links to any page posted on each -day of the month. The year format calendar links to archive pages, with -names like `archives/2007` (for all of 2007) and `archives/2007/01` -(for January, 2007). For this to work, you'll need to create these archive -pages. They typically use [[inline]] to display or list pages created in -the given time frame. +or a list of months for a given year. The month format calendar simply +links to any page posted on each day of the month. The year format calendar +links to archive pages, with names like `archives/2007` (for all of 2007) +and `archives/2007/01` (for January, 2007). + +While you can insert calendar directives anywhere on your wiki, including +in the sidebar, you'll also need to create these archive pages. They +typically use this directive to display a calendar, and also use [[inline]] +to display or list pages created in the given time frame. + +The `ikiwiki-calendar` command can be used to automatically generate the +archive pages. It also refreshes the wiki, updating the calendars to +highlight the current day. This command is typically run at midnight from +cron. An example crontab: + +An example crontab: + + 0 0 * * * ikiwiki-calendar ~/ikiwiki.setup "posts/* and !*/Discussion" ## usage diff --git a/doc/plugins/calendar.mdwn b/doc/plugins/calendar.mdwn index 8ade70004..bc1bc6c71 100644 --- a/doc/plugins/calendar.mdwn +++ b/doc/plugins/calendar.mdwn @@ -3,13 +3,9 @@ This plugin provides a [[ikiwiki/directive/calendar]] [[ikiwiki/directive]]. The directive displays a calendar, similar to the typical calendars shown on -some blogs. +some blogs. -Since ikiwiki is a wiki compiler, to keep the calendar up-to-date, -wikis that include it need to be periodically refreshed, typically by cron -at midnight. Example crontab: - - 0 0 * * * ikiwiki -setup ~/ikiwiki.setup -refresh +The [[ikiwiki-calendar]] command is used to keep the calendar up-to-date. ## CSS diff --git a/doc/plugins/contrib/groupfile.mdwn b/doc/plugins/contrib/groupfile.mdwn new file mode 100644 index 000000000..e5c0ded42 --- /dev/null +++ b/doc/plugins/contrib/groupfile.mdwn @@ -0,0 +1,105 @@ +[[!template id=plugin name=groupfile core=0 author="[[Jogo]]"]] + +This plugin add a `group(groupname)` function to [[ikiwiki/PageSpec]], which is true +only if the actual user is member of the group named `groupname`. + +Groups membership are read from a file. The syntax of this file is very close to +usual `/etc/passwd` Unix file : the group's name, followed by a colon, followed by +a coma separated list of user's names. For exemple : + + dev:toto,foo + i18n:zorba + +----- + + #!/usr/bin/perl + # GroupFile plugin. + # by Joseph Boudou <jogo at matabio dot net> + + package IkiWiki::Plugin::groupfile; + + use warnings; + use strict; + use IkiWiki 3.00; + + sub import { + hook(type => 'getsetup', id => 'groups', call => \&get_setup); + } + + sub get_setup () { + return ( + plugin => { + safe => 0, + rebuild => 0, + }, + group_file => { + type => 'string', + example => '/etc/ikiwiki/group', + description => 'group file location', + safe => 0, + rebuild => 0, + }, + ); + } + + my $users_of = 0; + + sub get_groups () { + if (not $users_of) { + + if (not defined $config{group_file}) { + return 'group_file option not set'; + } + + open my $file, '<', $config{group_file} + or return 'Unable to open group_file'; + + $users_of = {}; + READ: + while (<$file>) { + next READ if (/^\s*$/); + + if (/^(\w+):([\w,]+)/) { + %{ $users_of->{$1} } = map { $_ => 1 } split /,/, $2; + } + else { + $users_of = "Error at group_file:$."; + last READ; + } + } + + close $file; + } + + return $users_of; + } + + package IkiWiki::PageSpec; + + sub match_group ($$;@) { + shift; + my $group = shift; + my %params = @_; + + if (not exists $params{user}) { + return IkiWiki::ErrorReason->new('no user specified'); + } + if (not defined $params{user}) { + return IkiWiki::FailReason->new('not logged in'); + } + + my $users_of = IkiWiki::Plugin::groupfile::get_groups(); + if (not ref $users_of) { + return IkiWiki::ErrorReason->new($users_of); + } + + if (exists $users_of->{$group}{ $params{user} }) { + return IkiWiki::SuccessReason->new("user is member of $group"); + } + else { + return IkiWiki::FailReason->new( + "user $params{user} isn't member of $group"); + } + } + + 1 diff --git a/doc/plugins/lockedit/discussion.mdwn b/doc/plugins/lockedit/discussion.mdwn new file mode 100644 index 000000000..b058b2b07 --- /dev/null +++ b/doc/plugins/lockedit/discussion.mdwn @@ -0,0 +1,21 @@ +This plugin not only locks pages but ensures too a user is logged in. This seems to me redundant with signedit. I propose : + + sub canedit ($$) { + my $page=shift; + my $cgi=shift; + my $session=shift; + + my $user=$session->param("name"); + return undef if defined $user && IkiWiki::is_admin($user); + + if (defined $config{locked_pages} && length $config{locked_pages} && + pagespec_match($page, $config{locked_pages}, + user => $session->param("name"), + ip => $ENV{REMOTE_ADDR}, + )) { + return sprintf(gettext("%s is locked and cannot be edited"), + htmllink("", "", $page, noimageinline => 1)); + } + + return undef; + } diff --git a/doc/sandbox.mdwn b/doc/sandbox.mdwn index 242ffb327..8aedcbb9e 100644 --- a/doc/sandbox.mdwn +++ b/doc/sandbox.mdwn @@ -1,10 +1,5 @@ This is the [[SandBox]], a page anyone can edit to try out ikiwiki (version [[!version ]]). -Here's a paragraph. - -Here's another one with *emphasised* text. - -test 2 # Header @@ -57,8 +52,10 @@ Bulleted list [[!progress percent=27]] +[[!progress percent=78]] + ----- -This SandBox is also a [[blog]]! +This **SandBox** is also a [[blog]]! [[!inline pages="sandbox/* and !*/Discussion" rootpage="sandbox" show="4" archive="yes"]] |