From 294aa199694a602325751420650da2b533c80fbf Mon Sep 17 00:00:00 2001 From: PaulePanter Date: Sun, 16 Aug 2009 07:01:39 -0400 Subject: Fix (hopefully) grammar. --- doc/ikiwiki/directive/inline.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/inline.mdwn b/doc/ikiwiki/directive/inline.mdwn index 9c55e07c2..99f795972 100644 --- a/doc/ikiwiki/directive/inline.mdwn +++ b/doc/ikiwiki/directive/inline.mdwn @@ -56,7 +56,7 @@ directive. These are the commonly used ones: * `postform` - Set to "yes" to enable a form to post new pages to a blog. * `postformtext` - Set to specify text that is displayed in a postform. -* `rootpage` - Enable the postform, and allows controling where +* `rootpage` - Enables the postform, and allows controling where newly posted pages should go, by specifiying the page that they should be a [[SubPage]] of. -- cgit v1.2.3 From eedd1687f821a649ff2d30da8beb67012cdab50d Mon Sep 17 00:00:00 2001 From: "http://emptty.myopenid.com/" Date: Wed, 19 Aug 2009 05:08:49 -0400 Subject: --- doc/ikiwiki/directive/brokenlinks/discussion.mdwn | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/ikiwiki/directive/brokenlinks/discussion.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/brokenlinks/discussion.mdwn b/doc/ikiwiki/directive/brokenlinks/discussion.mdwn new file mode 100644 index 000000000..65e97cff6 --- /dev/null +++ b/doc/ikiwiki/directive/brokenlinks/discussion.mdwn @@ -0,0 +1 @@ +Would it be possible to have such a thing also checking for external links? -- [[user/emptty]] -- cgit v1.2.3 From 2b07f393511fd1bfb5fc3f1edbc2d87b061d617d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 13 Sep 2009 18:45:23 -0400 Subject: typo fixes noticed by french translators --- doc/ikiwiki/directive/postsparkline.mdwn | 8 ++++---- doc/ikiwiki/directive/sparkline.mdwn | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/postsparkline.mdwn b/doc/ikiwiki/directive/postsparkline.mdwn index c17d32952..318512eef 100644 --- a/doc/ikiwiki/directive/postsparkline.mdwn +++ b/doc/ikiwiki/directive/postsparkline.mdwn @@ -15,7 +15,7 @@ This directive uses the [[!iki plugins/sparkline desc=sparkline]] plugin to crea # usage -All options aside fron the `pages`, `max`, `formula`, `time`, and `color` +All options aside from the `pages`, `max`, `formula`, `time`, and `color` options are the same as in [[sparkline]] directive. You don't need to specify any data points (though you can if you want to). @@ -24,7 +24,7 @@ times of pages matched by the specified `pages` [[ikiwiki/PageSpec]]. A maximum of `max` data points will be generated. The `formula` parameter controls the formula used to generate data points. -Available forumlae: +Available formulae: * `interval` - The height of each point represents how long it has been since the previous post. @@ -32,10 +32,10 @@ Available forumlae: many posts were made that day. * `permonth` - Each point represents a month; the height represents how many posts were made that month. -* `peryear` - Each point represents a day; the height represents how +* `peryear` - Each point represents a year; the height represents how many posts were made that year. -The `time` parameter has a default value of "ctime", since forumae use +The `time` parameter has a default value of "ctime", since formulae use the creation times of pages by default. If you instead want them to use the modification times of pages, set it to "mtime". diff --git a/doc/ikiwiki/directive/sparkline.mdwn b/doc/ikiwiki/directive/sparkline.mdwn index 1f691e14f..e5a03f84e 100644 --- a/doc/ikiwiki/directive/sparkline.mdwn +++ b/doc/ikiwiki/directive/sparkline.mdwn @@ -2,7 +2,7 @@ The `sparkline` directive is supplied by the [[!iki plugins/sparkline desc=spark This directive allows for embedding sparklines into wiki pages. A sparkline is a small word-size graphic chart, that is designed to be -displayes alongside text. +displayed alongside text. # examples -- cgit v1.2.3 From 655e2ddc1f44236d3396be722d55a0afd755d39d Mon Sep 17 00:00:00 2001 From: NicolasLimare Date: Thu, 24 Sep 2009 06:22:13 -0400 Subject: images are not always scaled *down* --- doc/ikiwiki/directive/img.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/img.mdwn b/doc/ikiwiki/directive/img.mdwn index 66efd008e..94cc754bd 100644 --- a/doc/ikiwiki/directive/img.mdwn +++ b/doc/ikiwiki/directive/img.mdwn @@ -22,7 +22,7 @@ You can also pass `alt`, `title`, `class`, `align` and `id` parameters. These are passed through unchanged to the html img tag. If you include a `caption` parameter, the caption will be displayed centered beneath the image. -The `link` parameter is used to control whether the scaled down image links +The `link` parameter is used to control whether the scaled image links to the full size version. By default it does; set "link=somepage" to link to another page instead, or "link=no" to disable the link, or "link=http://url" to link to a given url. -- cgit v1.2.3 From bef2011cbdbe49cc2ec988ddfdf1b9a13f880b3b Mon Sep 17 00:00:00 2001 From: "http://weakish.pigro.net/" Date: Thu, 1 Oct 2009 05:57:53 -0400 Subject: checking external links seems not practical --- doc/ikiwiki/directive/brokenlinks/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/brokenlinks/discussion.mdwn b/doc/ikiwiki/directive/brokenlinks/discussion.mdwn index 65e97cff6..34760584d 100644 --- a/doc/ikiwiki/directive/brokenlinks/discussion.mdwn +++ b/doc/ikiwiki/directive/brokenlinks/discussion.mdwn @@ -1 +1,3 @@ Would it be possible to have such a thing also checking for external links? -- [[user/emptty]] + +> I guess this is not very practical. For internal wiki links, we only need to check if the linked source file exist or not. But for external links, we have to ping every links, which will slow down the build process a lot. --[[weakish]] -- cgit v1.2.3 From 7ef22f25969741fb7aed9be650dd026dd6dddcc9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 2 Oct 2009 18:45:56 -0400 Subject: improve wording --- doc/ikiwiki/directive/pagetemplate.mdwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/pagetemplate.mdwn b/doc/ikiwiki/directive/pagetemplate.mdwn index 0e4066f34..8ad901c1a 100644 --- a/doc/ikiwiki/directive/pagetemplate.mdwn +++ b/doc/ikiwiki/directive/pagetemplate.mdwn @@ -1,6 +1,8 @@ The `pagetemplate` directive is supplied by the [[!iki plugins/pagetemplate desc=pagetemplate]] plugin. -This directive allows a page to be created using a different wikitemplates. +This directive allows a page to be displayed using a different template 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 -- cgit v1.2.3 From c7bdd17087475ef0e659cb5f3b204e2619929dff Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 3 Oct 2009 17:17:48 -0400 Subject: clarify --- doc/ikiwiki/directive/pagestats.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/pagestats.mdwn b/doc/ikiwiki/directive/pagestats.mdwn index 426f3e4af..66f851dbd 100644 --- a/doc/ikiwiki/directive/pagestats.mdwn +++ b/doc/ikiwiki/directive/pagestats.mdwn @@ -12,7 +12,7 @@ And here's how to create a table of all the pages on the wiki: \[[!pagestats style="table"]] -The optional `among` parameter limits counting to pages that match a +The optional `among` parameter limits display to pages that match a [[ikiwiki/PageSpec]]. For instance, to display a cloud of tags used on blog entries, you could use: -- cgit v1.2.3 From d6cdced589f31471622ed481f88e33e070388c27 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Oct 2009 15:22:17 -0400 Subject: fix documentation of quick It *always* turns off feeds, because feeds require a look at all pages. --- doc/ikiwiki/directive/inline.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/inline.mdwn b/doc/ikiwiki/directive/inline.mdwn index 99f795972..4e087ab6c 100644 --- a/doc/ikiwiki/directive/inline.mdwn +++ b/doc/ikiwiki/directive/inline.mdwn @@ -98,7 +98,7 @@ Here are some less often needed parameters: * `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 - metadata. By default, this also turns off generation of any feeds. + metadata. This also turns off generation of any feeds. * `timeformat` - Use this to specify how to display the time or date for pages in the blog. The format string is passed to the strftime(3) function. * `feedpages` - A [[PageSpec]] of inlined pages to include in the rss/atom -- cgit v1.2.3 From e7144e918f0d15a9bbb1a4842ff7300ce61a1886 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Oct 2009 15:36:51 -0400 Subject: clarify amoung I found it really hard to understand from the old description.. --- doc/ikiwiki/directive/pagestats.mdwn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/pagestats.mdwn b/doc/ikiwiki/directive/pagestats.mdwn index 66f851dbd..f14c80b07 100644 --- a/doc/ikiwiki/directive/pagestats.mdwn +++ b/doc/ikiwiki/directive/pagestats.mdwn @@ -12,13 +12,13 @@ And here's how to create a table of all the pages on the wiki: \[[!pagestats style="table"]] -The optional `among` parameter limits display to pages that match a -[[ikiwiki/PageSpec]]. For instance, to display a cloud of tags used on blog -entries, you could use: +The optional `among` parameter limits the pages whose outgoing links are +considered. For instance, to display a cloud of tags used on blog +entries, while ignoring other pages that use those tags, you could use: \[[!pagestats pages="tags/*" among="blog/posts/*"]] -or to display a cloud of tags related to Linux, you could use: +Or to display a cloud of tags related to Linux, you could use: \[[!pagestats pages="tags/* and not tags/linux" among="tagged(linux)"]] -- cgit v1.2.3 From af85f62d6fd7c3b437fa527bff3392616d3513dc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Oct 2009 17:47:10 -0400 Subject: linkmap: Use a combination of presence and link dependencies. This makes the map be regenerated much less frequently, so larger maps are more practical to use now. --- IkiWiki/Plugin/linkmap.pm | 6 +++--- debian/changelog | 3 +++ doc/ikiwiki/directive/linkmap.mdwn | 4 +--- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index d0671ae0e..d7ba68da9 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -28,9 +28,9 @@ sub preprocess (@) { $params{pages}="*" unless defined $params{pages}; - # Needs to update whenever a page is added, removed, or - # its links change, so register a dependency. - add_depends($params{page}, $params{pages}); + # Needs to update whenever a relevant page is added, or removed, or + # its links change. + add_depends($params{page}, $params{pages}, presence => 1, links => 1); # Can't just return the linkmap here, since the htmlscrubber # scrubs out all tags (with good reason!) diff --git a/debian/changelog b/debian/changelog index 89d377769..a006d3177 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,6 +26,9 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low This makes them more efficient. It also fixes a longstanding bug, where if only a small set of pages were considered by orphans/pagestats, changes to links on other pages failed to cause an update. + * linkmap: Use a combination of presence and link dependencies. + This makes the map be regenerated much less frequently, so larger + maps are more practical to use now. * Transitive dependencies are now correctly supported. * Rebuild wikis on upgrade to this version to get improved dependency info. diff --git a/doc/ikiwiki/directive/linkmap.mdwn b/doc/ikiwiki/directive/linkmap.mdwn index db79a1491..38cf0fd11 100644 --- a/doc/ikiwiki/directive/linkmap.mdwn +++ b/doc/ikiwiki/directive/linkmap.mdwn @@ -9,9 +9,7 @@ Only links between mapped pages will be shown; links pointing to or from unmapped pages will be omitted. If the pages to include are not specified, the links between all pages (and other files) in the wiki are mapped. For best results, only a small set of pages should be mapped, since otherwise -the map can become very large, unwieldy, and complicated. Also, the map is -rebuilt whenever one of the mapped pages is changed, which can make the -wiki a bit slow. +the map can become very large, unwieldy, and complicated. Here are descriptions of all the supported parameters to the `linkmap` directive: -- cgit v1.2.3 From 65d57902ca9f05b7958ea0a47b3fa3c651da89f5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 8 Oct 2009 18:17:36 -0400 Subject: add sorting page --- doc/ikiwiki/directive/inline.mdwn | 8 ++------ doc/ikiwiki/pagespec/sorting.mdwn | 11 +++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 doc/ikiwiki/pagespec/sorting.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/inline.mdwn b/doc/ikiwiki/directive/inline.mdwn index 4e087ab6c..c6a23ce3c 100644 --- a/doc/ikiwiki/directive/inline.mdwn +++ b/doc/ikiwiki/directive/inline.mdwn @@ -86,12 +86,8 @@ Here are some less often needed parameters: if raw is set to "yes", the page will be included raw, without additional markup around it, as if it were a literal part of the source of the inlining page. -* `sort` - Controls how inlined pages are sorted. The default, "age" is to - sort newest created pages first. Setting it to "title" will sort pages by - title, and "mtime" sorts most recently modified pages first. If - [[!cpan Sort::Naturally]] is installed, `sort` can be set to "title_natural" - to sort by title with numbers treated as such ("1 2 9 10 20" instead of - "1 10 2 20 9"). +* `sort` - Controls how inlined pages are [[sorted|pagespec/sorting]]. + The default is to sort the newest created pages first. * `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. diff --git a/doc/ikiwiki/pagespec/sorting.mdwn b/doc/ikiwiki/pagespec/sorting.mdwn new file mode 100644 index 000000000..1e0366029 --- /dev/null +++ b/doc/ikiwiki/pagespec/sorting.mdwn @@ -0,0 +1,11 @@ +Some [[directives|ikiwiki/directive]] that use +[[PageSpecs|ikiwiki/pagespec]], such as [[ikiwiki/directive/inline]], allow +specifying the order that matching pages are shown in. The following sort +orders can be specified. + +* `age` - List pages from the most recently created to the oldest. +* `mtime` - List pages with the most recently modified first. +* `title` - Order by title. +* `title_natural` - Only available if [[!cpan Sort::Naturally]] is + installed. Orders by title, but numbers in the title are treated + as such, ("1 2 9 10 20" instead of "1 10 2 20 9") -- cgit v1.2.3 From e1939185d29e1431861e63d6526cb3a498d6033e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 11 Oct 2009 16:42:49 -0400 Subject: ikiwiki-calendar: New command automates creation of archive pages using the calendar plugin. --- debian/changelog | 7 +++++ doc/examples/blog.mdwn | 4 +++ doc/ikiwiki-calendar.mdwn | 51 ++++++++++++++++++++++++++++++++ doc/ikiwiki/directive/calendar.mdwn | 29 ++++++++++++------ doc/plugins/calendar.mdwn | 8 ++--- ikiwiki-calendar | 59 +++++++++++++++++++++++++++++++++++++ templates/calendarmonth.tmpl | 3 ++ templates/calendaryear.tmpl | 1 + 8 files changed, 147 insertions(+), 15 deletions(-) create mode 100644 doc/ikiwiki-calendar.mdwn create mode 100755 ikiwiki-calendar create mode 100644 templates/calendarmonth.tmpl create mode 100644 templates/calendaryear.tmpl (limited to 'doc/ikiwiki/directive') diff --git a/debian/changelog b/debian/changelog index a79faf7fb..22935955a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ikiwiki (3.20091010) UNRELEASED; urgency=low + + * ikiwiki-calendar: New command automates creation of archive pages + using the calendar plugin. + + -- Joey Hess Sun, 11 Oct 2009 15:54:45 -0400 + ikiwiki (3.20091009) unstable; urgency=low * parentlinks: Add has_parentlinks template parameter to allow styling 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 + +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/ikiwiki-calendar b/ikiwiki-calendar new file mode 100755 index 000000000..ec572cb7c --- /dev/null +++ b/ikiwiki-calendar @@ -0,0 +1,59 @@ +#!/usr/bin/perl +use warnings; +use strict; +use IkiWiki; +use IkiWiki::Setup; +use Getopt::Long; + +sub usage () { + die gettext("usage: ikiwiki-calendar [-f] your.setup [pagespec] [year]"), "\n"; +} + +my $force=0; +GetOptions( + "force" => \$force, +) || usage(); +my $setup=shift || usage(); +my $pagespec=shift || "*"; +my $year=shift || 1900+(localtime(time))[5]; + +%config=IkiWiki::defaultconfig(); +IkiWiki::Setup::load($setup); +IkiWiki::loadplugins(); +IkiWiki::checkconfig(); + +my $archivebase = 'archives'; +$archivebase = $config{archivebase} if defined $config{archivebase}; + +sub writearchive ($$;$) { + my $template=template(shift); + my $year=shift; + my $month=shift; + + my $page=defined $month ? "$year/$month" : $year; + + my $pagefile=newpagefile("$archivebase/$page", $config{default_pageext}); + $template->param(pagespec => $pagespec); + $template->param(year => $year); + $template->param(month => $month) if defined $month; + + if ($force || ! -e "$config{srcdir}/$pagefile") { + writefile($pagefile, $config{srcdir}, $template->output); + IkiWiki::rcs_add($pagefile) if $config{rcs}; + } +} + +IkiWiki::lockwiki(); + +foreach my $y ($year-1, $year, $year+1) { + writearchive("calendaryear.tmpl", $y); + foreach my $m (qw{01 02 03 04 05 06 07 08 09 10 11 12}) { + writearchive("calendarmonth.tmpl", $y, $m); + } +} + +IkiWiki::rcs_commit_staged(gettext("calendar update"), undef, undef) + if $config{rcs}; +IkiWiki::unlockwiki(); + +system("ikiwiki", "-setup", $setup, "-refresh"); diff --git a/templates/calendarmonth.tmpl b/templates/calendarmonth.tmpl new file mode 100644 index 000000000..37ad78c5c --- /dev/null +++ b/templates/calendarmonth.tmpl @@ -0,0 +1,3 @@ +[[!calendar type=month month= year= pages=""]] + +[[!inline pages="creation_month() and creation_year() and " show=0 feeds=no reverse=yes]] diff --git a/templates/calendaryear.tmpl b/templates/calendaryear.tmpl new file mode 100644 index 000000000..714bd6d47 --- /dev/null +++ b/templates/calendaryear.tmpl @@ -0,0 +1 @@ +[[!calendar type=year year= pages=""]] -- cgit v1.2.3 From 0dbb16fd5a9f573c6b49006f7452cd60474d9803 Mon Sep 17 00:00:00 2001 From: PaulePanter Date: Sun, 25 Oct 2009 10:32:49 -0400 Subject: Typo. --- doc/ikiwiki/directive/comment.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/comment.mdwn b/doc/ikiwiki/directive/comment.mdwn index 21386dfc3..693a92770 100644 --- a/doc/ikiwiki/directive/comment.mdwn +++ b/doc/ikiwiki/directive/comment.mdwn @@ -32,7 +32,7 @@ metadata of the comment. * `ip` - Can be used to record the IP address of a commenter, if they posted anonymously. * `claimedauthor` - Records the name that the user entered, - if anonmous commenters are allowed to enter their (unverified) + if anonymous commenters are allowed to enter their (unverified) name. [[!meta robots="noindex, follow"]] -- cgit v1.2.3 From b54b8215d0c150410e4a629caa9b0035d69f89b2 Mon Sep 17 00:00:00 2001 From: PaulePanter Date: Sun, 25 Oct 2009 16:13:24 -0400 Subject: Question about interaction of `feedshow` and `show`. --- doc/ikiwiki/directive/inline/discussion.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/inline/discussion.mdwn b/doc/ikiwiki/directive/inline/discussion.mdwn index be0665d04..e5cfeb91c 100644 --- a/doc/ikiwiki/directive/inline/discussion.mdwn +++ b/doc/ikiwiki/directive/inline/discussion.mdwn @@ -124,3 +124,19 @@ My index page has: Else can you please suggest a smarter way of getting certain data out from pages for a inline index? --[[hendry]] + +--- + +## Interaction of `show` and `feedshow` + +Reading the documentation I would think that `feedshow` does not +influence `show`. + + [[!inline pages="./blog/*" archive=yes quick=yes feedshow=10 sort=title reverse=yes]] + +Only ten pages are listed in this example although `archive` is set to +yes. Removing `feedshow=10` all matching pages are shown. + +Is that behaviour intended? + +--[[PaulePanter]] -- cgit v1.2.3 From 88a217598d1254774f611f1878883083289606f1 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sun, 15 Nov 2009 00:33:28 +0100 Subject: Improve img's documentation. Jon is right, of course. User error, not an ikiwiki bug. So, I removed the false bug report and added its gist to img's documentation. --- doc/bugs/img_vs_align.mdwn | 11 ----------- doc/ikiwiki/directive/img.mdwn | 6 ++++++ 2 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 doc/bugs/img_vs_align.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/doc/bugs/img_vs_align.mdwn b/doc/bugs/img_vs_align.mdwn deleted file mode 100644 index dcb9129b9..000000000 --- a/doc/bugs/img_vs_align.mdwn +++ /dev/null @@ -1,11 +0,0 @@ -The *[[ikiwiki/directive/img]]* directive allows for specifying an -*align* parameter -- which is of limited usability as the image is -embedded as `

`. That's at least what I see on -. On the other -hand, CSS is supposed to be used instead, I guess. (But how... I forgot -almost of my CSS foo again ;-) it seems.) --[[tschwinge]] - -> [[!img logo/ikiwiki.png align=right]]The [img tag doesn't create P tags](http://git.ikiwiki.info/?p=ikiwiki;a=blob;f=IkiWiki/Plugin/img.pm;h=32023fa97af8ba8e63192cacaff10a4677d20654;hb=HEAD), but if you have surrounded the img directive with newlines, they will result in paragraph tags. -> -> I've edited the URL you provided to demonstrate this -- hope you don't mind! I've also added an inline, right-aligned image to this page.[[!tag done]] -> -- [[Jon]] diff --git a/doc/ikiwiki/directive/img.mdwn b/doc/ikiwiki/directive/img.mdwn index 94cc754bd..b847aa239 100644 --- a/doc/ikiwiki/directive/img.mdwn +++ b/doc/ikiwiki/directive/img.mdwn @@ -22,6 +22,12 @@ You can also pass `alt`, `title`, `class`, `align` and `id` parameters. These are passed through unchanged to the html img tag. If you include a `caption` parameter, the caption will be displayed centered beneath the image. +Note that for the `align` parameter to work, you have to make sure that the +`img` directive isn't surrounded with newlines, as the [[Markdown]] renderer +would otherwise put the image into its own paragraph, inhibiting this +functionality from working. On the other hand, CSS should probably rather be +used instead. + The `link` parameter is used to control whether the scaled image links to the full size version. By default it does; set "link=somepage" to link to another page instead, or "link=no" to disable the link, or -- cgit v1.2.3 From fb26b9ca849b2cc8090e317c0cba790da76c425a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 15 Nov 2009 14:52:53 -0500 Subject: Revert "Improve img's documentation." The information added is incorrect. --- doc/bugs/img_vs_align.mdwn | 11 +++++++++++ doc/ikiwiki/directive/img.mdwn | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 doc/bugs/img_vs_align.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/doc/bugs/img_vs_align.mdwn b/doc/bugs/img_vs_align.mdwn new file mode 100644 index 000000000..dcb9129b9 --- /dev/null +++ b/doc/bugs/img_vs_align.mdwn @@ -0,0 +1,11 @@ +The *[[ikiwiki/directive/img]]* directive allows for specifying an +*align* parameter -- which is of limited usability as the image is +embedded as `

`. That's at least what I see on +. On the other +hand, CSS is supposed to be used instead, I guess. (But how... I forgot +almost of my CSS foo again ;-) it seems.) --[[tschwinge]] + +> [[!img logo/ikiwiki.png align=right]]The [img tag doesn't create P tags](http://git.ikiwiki.info/?p=ikiwiki;a=blob;f=IkiWiki/Plugin/img.pm;h=32023fa97af8ba8e63192cacaff10a4677d20654;hb=HEAD), but if you have surrounded the img directive with newlines, they will result in paragraph tags. +> +> I've edited the URL you provided to demonstrate this -- hope you don't mind! I've also added an inline, right-aligned image to this page.[[!tag done]] +> -- [[Jon]] diff --git a/doc/ikiwiki/directive/img.mdwn b/doc/ikiwiki/directive/img.mdwn index b847aa239..94cc754bd 100644 --- a/doc/ikiwiki/directive/img.mdwn +++ b/doc/ikiwiki/directive/img.mdwn @@ -22,12 +22,6 @@ You can also pass `alt`, `title`, `class`, `align` and `id` parameters. These are passed through unchanged to the html img tag. If you include a `caption` parameter, the caption will be displayed centered beneath the image. -Note that for the `align` parameter to work, you have to make sure that the -`img` directive isn't surrounded with newlines, as the [[Markdown]] renderer -would otherwise put the image into its own paragraph, inhibiting this -functionality from working. On the other hand, CSS should probably rather be -used instead. - The `link` parameter is used to control whether the scaled image links to the full size version. By default it does; set "link=somepage" to link to another page instead, or "link=no" to disable the link, or -- cgit v1.2.3 From 65e9fbf6e98e0bf5525c39273f0327c0a122276f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 16 Nov 2009 15:30:08 -0500 Subject: add example of a map showing page descriptions --- doc/ikiwiki/directive/map.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/map.mdwn b/doc/ikiwiki/directive/map.mdwn index 09c95a0c9..4b6499547 100644 --- a/doc/ikiwiki/directive/map.mdwn +++ b/doc/ikiwiki/directive/map.mdwn @@ -13,6 +13,8 @@ the [[meta]] directive). For example: \[[!map pages="* and !blog/* and !*/Discussion" show=title]] + \[[!map pages="* and !blog/* and !*/Discussion" show=description]] + Hint: To limit the map to displaying pages less than a certain level deep, use a [[ikiwiki/PageSpec]] like this: `pages="* and !*/*/*"` -- cgit v1.2.3 From 4fa17df57de29e2b91c552c1b012f3f198dfaa2f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 16 Nov 2009 15:51:00 -0500 Subject: meta: Generate meta description tags even when the html scrubber is enabled. Unlike generic meta foo tags, meta description is known to be safe, so can be special cased to be allowed despite the html scrubber. This makes meta description much more useful, since it is otherwise limited to being used by other plugins like map. --- IkiWiki/Plugin/meta.pm | 4 ++++ debian/changelog | 7 +++++++ doc/ikiwiki/directive/meta.mdwn | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 6bdb6f39c..45d073e28 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -239,6 +239,10 @@ sub preprocess (@) { push @{$metaheaders{$page}}, ''; } + elsif ($key eq 'description') { + push @{$metaheaders{$page}}, ''; + } else { push @{$metaheaders{$page}}, scrub('', $destpage); diff --git a/debian/changelog b/debian/changelog index ad80d37b7..9bddf0733 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ikiwiki (3.20091114) UNRELEASED; urgency=low + + * meta: Generate meta description tags even when the html scrubber is + enabled. + + -- Joey Hess Mon, 16 Nov 2009 15:46:45 -0500 + ikiwiki (3.20091113) unstable; urgency=low * underlay: Fix example values put in setup file to be array diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn index 000f461c9..557441c0b 100644 --- a/doc/ikiwiki/directive/meta.mdwn +++ b/doc/ikiwiki/directive/meta.mdwn @@ -43,8 +43,8 @@ Supported fields: * description - Specifies a "description" of the page. You could use this to provide - a summary, for example, to be picked up by the [[map]] directive. + Specifies a short description for the page. This will be put in + the html header, and can also be displayed by eg, the [[map]] directive. * permalink -- cgit v1.2.3 From df75c5b93a1067461b649e48cc62d4c7f4d18ec7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 25 Nov 2009 01:18:43 -0500 Subject: date: New plugin that allows inserting date directives that expand to pretty-printed dates, using the same formatting as used for page modification date display, etc. --- IkiWiki/Plugin/date.pm | 33 +++++++++++++++++++++++++++++++++ debian/changelog | 3 +++ doc/ikiwiki/directive/date.mdwn | 14 ++++++++++++++ doc/plugins/date.mdwn | 6 ++++++ 4 files changed, 56 insertions(+) create mode 100644 IkiWiki/Plugin/date.pm create mode 100644 doc/ikiwiki/directive/date.mdwn create mode 100644 doc/plugins/date.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/date.pm b/IkiWiki/Plugin/date.pm new file mode 100644 index 000000000..8f2aa73d6 --- /dev/null +++ b/IkiWiki/Plugin/date.pm @@ -0,0 +1,33 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::date; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "meta", call => \&getsetup); + hook(type => "preprocess", id => "meta", call => \&preprocess); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => undef, + }, +} + +sub preprocess (@) { + my $str=shift; + + eval q{use Date::Parse}; + error $@ if $@; + my $time = str2time($str); + if (! defined $time) { + error("unable to parse $str"); + } + return displaytime($time); +} + +1 diff --git a/debian/changelog b/debian/changelog index 15d56a693..10fcebbec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,9 @@ ikiwiki (3.20091114) UNRELEASED; urgency=low larger for inlines of many, or complex pages. * Added (incomplete) Turkish po file. Closes: #556744 Thanks, Recai Oktaş + * date: New plugin that allows inserting date directives that expand to + pretty-printed dates, using the same formatting as used for page + modification date display, etc. -- Joey Hess Mon, 16 Nov 2009 15:46:45 -0500 diff --git a/doc/ikiwiki/directive/date.mdwn b/doc/ikiwiki/directive/date.mdwn new file mode 100644 index 000000000..df45fa840 --- /dev/null +++ b/doc/ikiwiki/directive/date.mdwn @@ -0,0 +1,14 @@ +The `date` directive is supplied by the [[!iki plugins/date desc=date]] plugin. + +This directive can be used to display a date on a page, using the same +display method that is used to display the modification date in the page +footer, and other dates in the wiki. This can be useful for consistency +of display, or if you want to embed parseable dates into the page source. + +Like the dates used by the [[meta]] directive, the date can be entered in +nearly any format, since it's parsed by [[!cpan TimeDate]]. + +For example, an update to a page with an embedded date stamp could look +like: + + Updated \[[!date "Wed, 25 Nov 2009 01:11:55 -0500"]]: mumble mumble diff --git a/doc/plugins/date.mdwn b/doc/plugins/date.mdwn new file mode 100644 index 000000000..b8dbdfee5 --- /dev/null +++ b/doc/plugins/date.mdwn @@ -0,0 +1,6 @@ +[[!template id=plugin name=date author="[[Joey]]"]] +[[!tag type/meta]] + +This plugin provides the [[ikiwiki/directive/date]] +[[ikiwiki/directive]], which provides a way to display an arbitrary date +in a page. -- cgit v1.2.3 From 3a1c8c2b463b8a4f6b3b2c866c5e1b1500f95193 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 25 Dec 2009 14:31:51 -0500 Subject: pagestats: Add show parameter. Closes: #562129 --- IkiWiki/Plugin/pagestats.pm | 10 ++++++++++ debian/changelog | 6 ++++++ doc/ikiwiki/directive/pagestats.mdwn | 6 ++++++ 3 files changed, 22 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 47638210a..4313aa271 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -63,6 +63,16 @@ sub preprocess (@) { $max = $counts{$page} if $counts{$page} > $max; } + if (exists $params{show}) { + my $i=0; + my %show; + foreach my $key (sort { $counts{$b} <=> $counts{$a} } keys %counts) { + last if ++$i > $params{show}; + $show{$key}=$counts{$key}; + } + %counts=%show; + } + if ($style eq 'table') { return "\n". join("\n", map { diff --git a/debian/changelog b/debian/changelog index 0e76bd727..e01037171 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ikiwiki (3.20091219) UNRELEASED; urgency=low + + * pagestats: Add show parameter. Closes: #562129 + + -- Joey Hess Fri, 25 Dec 2009 14:31:22 -0500 + ikiwiki (3.20091218) unstable; urgency=low * Add complete Spanish basewiki translation done by Fernando Gonzalez de diff --git a/doc/ikiwiki/directive/pagestats.mdwn b/doc/ikiwiki/directive/pagestats.mdwn index f14c80b07..68f4d2734 100644 --- a/doc/ikiwiki/directive/pagestats.mdwn +++ b/doc/ikiwiki/directive/pagestats.mdwn @@ -22,4 +22,10 @@ Or to display a cloud of tags related to Linux, you could use: \[[!pagestats pages="tags/* and not tags/linux" among="tagged(linux)"]] +The optional `show` parameter limits display to the specified number of +pages. For instance, to show a table of the top ten pages with the most +links: + + \[[!pagestats style="table" show="10"]] + [[!meta robots="noindex, follow"]] -- cgit v1.2.3 From 51bb7d38482cdb109f163594181e8209369b658c Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Fri, 25 Dec 2009 19:53:30 +0000 Subject: --- doc/ikiwiki/directive/pagestats/discussion.mdwn | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/pagestats/discussion.mdwn b/doc/ikiwiki/directive/pagestats/discussion.mdwn index 3c9dc7104..001217cf1 100644 --- a/doc/ikiwiki/directive/pagestats/discussion.mdwn +++ b/doc/ikiwiki/directive/pagestats/discussion.mdwn @@ -7,4 +7,10 @@ I would rather not find and create a page for every tag I have created or will c Thanks ----- +> Hello unknown person. + +> I think it would require a different approach to what "tags" are, and/or what "pagestats" are. The pagestats plugin gives statistical information about *pages*, so it requires the pages in question to exist before it can get information about them. The tags plugin creates links to tag *pages*, with the expectation that a human being will create said pages and put whatever content they want on them (such as describing what the tag is about, and a map linking back to the tagged pages). + +> The approach that [PmWiki](http://www.pmwiki.org) takes is that it enables the optional auto-creation of (empty) pages which match a particular "group" (set of sub-pages); thus one could set all the "tags/*" pages to be auto-created, creating a new tags/foo page the first time the \[[!tag foo]] directive is used. I'm not sure how this could be done in ikiwiki. + +> -- [[KathrynAndersen]] -- cgit v1.2.3 From cc63cee0d491c92b9a518b33d4fd7edcaef0bfc4 Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Fri, 25 Dec 2009 19:56:19 +0000 Subject: and someone already thought of tag-page auto-creation --- doc/ikiwiki/directive/pagestats/discussion.mdwn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/pagestats/discussion.mdwn b/doc/ikiwiki/directive/pagestats/discussion.mdwn index 001217cf1..d72b4058d 100644 --- a/doc/ikiwiki/directive/pagestats/discussion.mdwn +++ b/doc/ikiwiki/directive/pagestats/discussion.mdwn @@ -11,6 +11,5 @@ Thanks > I think it would require a different approach to what "tags" are, and/or what "pagestats" are. The pagestats plugin gives statistical information about *pages*, so it requires the pages in question to exist before it can get information about them. The tags plugin creates links to tag *pages*, with the expectation that a human being will create said pages and put whatever content they want on them (such as describing what the tag is about, and a map linking back to the tagged pages). -> The approach that [PmWiki](http://www.pmwiki.org) takes is that it enables the optional auto-creation of (empty) pages which match a particular "group" (set of sub-pages); thus one could set all the "tags/*" pages to be auto-created, creating a new tags/foo page the first time the \[[!tag foo]] directive is used. I'm not sure how this could be done in ikiwiki. - +> The approach that [PmWiki](http://www.pmwiki.org) takes is that it enables the optional auto-creation of (empty) pages which match a particular "group" (set of sub-pages); thus one could set all the "tags/*" pages to be auto-created, creating a new tags/foo page the first time the \[[!tag foo]] directive is used. See [[todo/auto-create_tag_pages_according_to_a_template]] for more discussion on this idea. > -- [[KathrynAndersen]] -- cgit v1.2.3 From ffc9f25e734a8ca5397f2dfd09c1e31725624ee0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 25 Dec 2009 15:28:18 -0500 Subject: toc: Add startlevel parameter. (kerravonsen) --- IkiWiki/Plugin/toc.pm | 11 ++++++++--- debian/changelog | 1 + doc/ikiwiki/directive/toc.mdwn | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm index a585564e7..b8537d3eb 100644 --- a/IkiWiki/Plugin/toc.pm +++ b/IkiWiki/Plugin/toc.pm @@ -53,8 +53,8 @@ sub format (@) { my $page=""; my $index=""; my %anchors; - my $curlevel; - my $startlevel=0; + my $startlevel=($params{startlevel} ? $params{startlevel} : 0); + my $curlevel=$startlevel-1; my $liststarted=0; my $indent=sub { "\t" x $curlevel }; $p->handler(start => sub { @@ -65,12 +65,17 @@ sub format (@) { my $anchor="index".++$anchors{$level}."h$level"; $page.="$text"; - # Take the first header level seen as the topmost level, + # Unless we're given startlevel as a parameter, + # take the first header level seen as the topmost level, # even if there are higher levels seen later on. if (! $startlevel) { $startlevel=$level; $curlevel=$startlevel-1; } + elsif (defined $params{startlevel} && + $level < $params{startlevel}) { + return; + } elsif ($level < $startlevel) { $level=$startlevel; } diff --git a/debian/changelog b/debian/changelog index d3a510d4a..ae0b5eefd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ikiwiki (3.20091219) UNRELEASED; urgency=low * pagestats: Add show parameter. Closes: #562129 (David Paleino) + * toc: Add startlevel parameter. (kerravonsen) -- Joey Hess Fri, 25 Dec 2009 14:31:22 -0500 diff --git a/doc/ikiwiki/directive/toc.mdwn b/doc/ikiwiki/directive/toc.mdwn index bf504dafc..bb1afa1ac 100644 --- a/doc/ikiwiki/directive/toc.mdwn +++ b/doc/ikiwiki/directive/toc.mdwn @@ -14,6 +14,12 @@ the `levels` parameter: The toc directive will take the level of the first header as the topmost level, even if there are higher levels seen later in the file. +To create a table of contents that only shows headers starting with a given +level, use the `startlevel` parameter. For example, to show only h2 and +smaller headers: + + \[[!toc startlevel=2]] + The table of contents will be created as an ordered list. If you want an unordered list instead, you can change the list-style in your local style sheet. -- cgit v1.2.3 From 2ae1d9d928c12be21a32c9fd4809f12bebc20e77 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 1 Jan 2010 03:37:59 -0500 Subject: linkmap: Add option to omit disconnected pages from the map. --- IkiWiki/Plugin/linkmap.pm | 25 ++++++++++++++++++++----- debian/changelog | 1 + doc/ikiwiki/directive/linkmap.mdwn | 13 ++++++++++--- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 9540bd112..28acbda32 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -49,6 +49,7 @@ sub genmap ($) { my $mapnum=shift; return "" unless exists $maps{$mapnum}; my %params=%{$maps{$mapnum}}; + my $connected=IkiWiki::yesno($params{connected}); # Get all the items to map. my %mapitems = map { $_ => urlto($_, $params{destpage}) } @@ -79,24 +80,38 @@ sub genmap ($) { print OUT "charset=\"utf-8\";\n"; print OUT "ratio=compress;\nsize=\"".($params{width}+0).", ".($params{height}+0)."\";\n" if defined $params{width} and defined $params{height}; + my %shown; + my $show=sub { + my $item=shift; + if (! $shown{$item}) { + print OUT "\"$item\" [shape=box,href=\"$mapitems{$item}\"];\n"; + $shown{$item}=1; + } + }; foreach my $item (keys %mapitems) { - print OUT "\"$item\" [shape=box,href=\"$mapitems{$item}\"];\n"; + $show->($item) unless $connected; foreach my $link (map { bestlink($item, $_) } @{$links{$item}}) { - print OUT "\"$item\" -> \"$link\";\n" - if $mapitems{$link}; + next unless length $link and $mapitems{$link}; + foreach my $endpoint ($item, $link) { + $show->($endpoint); + } + print OUT "\"$item\" -> \"$link\";\n"; } } print OUT "}\n"; - close OUT; + close OUT || error gettext("failed to run dot"); local $/=undef; my $ret="\n". . ""; - close IN; + close IN || error gettext("failed to run dot"); waitpid $pid, 0; + if ($?) { + error gettext("failed to run dot"); + } $SIG{PIPE}="DEFAULT"; error gettext("failed to run dot") if $sigpipe; diff --git a/debian/changelog b/debian/changelog index 984351415..eb9bf496f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ ikiwiki (3.20091219) UNRELEASED; urgency=low * comments: Add a checksum to the name of comment pages, to avoid merge conflicts when comments are posted to two branches of a site. + * linkmap: Add option to omit disconnected pages from the map. -- Joey Hess Fri, 25 Dec 2009 14:31:22 -0500 diff --git a/doc/ikiwiki/directive/linkmap.mdwn b/doc/ikiwiki/directive/linkmap.mdwn index 38cf0fd11..baa6fff61 100644 --- a/doc/ikiwiki/directive/linkmap.mdwn +++ b/doc/ikiwiki/directive/linkmap.mdwn @@ -7,9 +7,7 @@ graph showing the links between a set of pages in the wiki. Example usage: Only links between mapped pages will be shown; links pointing to or from unmapped pages will be omitted. If the pages to include are not specified, -the links between all pages (and other files) in the wiki are mapped. For -best results, only a small set of pages should be mapped, since otherwise -the map can become very large, unwieldy, and complicated. +the links between all pages (and other files) in the wiki are mapped. Here are descriptions of all the supported parameters to the `linkmap` directive: @@ -18,5 +16,14 @@ directive: * `height`, `width` - Limit the size of the map to a given height and width, in inches. Both must be specified for the limiting to take effect, otherwise the map's size is not limited. +* `connected` - Controls whether to include pages on the map that link to + no other pages (connected=no, the default), or to only show pages that + link to others (connected=yes). + +For best results, only a small set of pages should be mapped, since +otherwise the map can become very large, unwieldy, and complicated. +If too many pages are included, the map may get so large that graphviz +cannot render it. Using the `connected` parameter is a good way to prune +out pages that clutter the map. [[!meta robots="noindex, follow"]] -- cgit v1.2.3 From ddda9800d6bec39a86dd8f76d67a4972138ee394 Mon Sep 17 00:00:00 2001 From: PaulePanter Date: Fri, 1 Jan 2010 18:56:37 +0000 Subject: Update on interaction between `show`, `feedshow` and `quick`. --- doc/ikiwiki/directive/inline/discussion.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/inline/discussion.mdwn b/doc/ikiwiki/directive/inline/discussion.mdwn index e5cfeb91c..c0d7c76c6 100644 --- a/doc/ikiwiki/directive/inline/discussion.mdwn +++ b/doc/ikiwiki/directive/inline/discussion.mdwn @@ -134,9 +134,13 @@ influence `show`. [[!inline pages="./blog/*" archive=yes quick=yes feedshow=10 sort=title reverse=yes]] +> Somehow the line above is not displayed correctly. + Only ten pages are listed in this example although `archive` is set to yes. Removing `feedshow=10` all matching pages are shown. Is that behaviour intended? +> Is something going wrong because `quick="yes"` [[»turns off generation of any feeds«|inline]]? --[[PaulePanter]] + --[[PaulePanter]] -- cgit v1.2.3 From 63cc5384bb4bd6a033ff85821b1bb904150d76c2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 1 Jan 2010 15:09:15 -0500 Subject: inline: Fix bug that limited displayed pages when feedshow was specified w/o show. --- IkiWiki/Plugin/inline.pm | 2 +- debian/changelog | 2 ++ doc/ikiwiki/directive/inline/discussion.mdwn | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 93dc0149e..17d1611db 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -209,7 +209,7 @@ sub preprocess_inline (@) { if ($params{show}) { $num=$params{show}; } - if ($params{feedshow} && $num < $params{feedshow}) { + if ($params{feedshow} && $num < $params{feedshow} && $num > 0) { $num=$params{feedshow}; } if ($params{skip} && $num) { diff --git a/debian/changelog b/debian/changelog index eb9bf496f..4ad346c13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ ikiwiki (3.20091219) UNRELEASED; urgency=low avoid merge conflicts when comments are posted to two branches of a site. * linkmap: Add option to omit disconnected pages from the map. + * inline: Fix bug that limited displayed pages when feedshow was + specified w/o show. -- Joey Hess Fri, 25 Dec 2009 14:31:22 -0500 diff --git a/doc/ikiwiki/directive/inline/discussion.mdwn b/doc/ikiwiki/directive/inline/discussion.mdwn index c0d7c76c6..998ba642b 100644 --- a/doc/ikiwiki/directive/inline/discussion.mdwn +++ b/doc/ikiwiki/directive/inline/discussion.mdwn @@ -132,9 +132,7 @@ Else can you please suggest a smarter way of getting certain data out from pages Reading the documentation I would think that `feedshow` does not influence `show`. - [[!inline pages="./blog/*" archive=yes quick=yes feedshow=10 sort=title reverse=yes]] - -> Somehow the line above is not displayed correctly. + \[[!inline pages="./blog/*" archive=yes quick=yes feedshow=10 sort=title reverse=yes]] Only ten pages are listed in this example although `archive` is set to yes. Removing `feedshow=10` all matching pages are shown. @@ -144,3 +142,5 @@ Is that behaviour intended? > Is something going wrong because `quick="yes"` [[»turns off generation of any feeds«|inline]]? --[[PaulePanter]] --[[PaulePanter]] + +>> Bug was that if feedshow was specified without show it limited to it incorrectly. Fixed. --[[Joey]] -- cgit v1.2.3 From 03810ebf4003a5c1cb8c8a247f0e2b429923a675 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 6 Feb 2010 16:29:04 -0500 Subject: add noindex robots directives --- doc/ikiwiki/directive/date.mdwn | 2 ++ doc/ikiwiki/pagespec/po.mdwn | 2 ++ doc/ikiwiki/pagespec/sorting.mdwn | 2 ++ 3 files changed, 6 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/date.mdwn b/doc/ikiwiki/directive/date.mdwn index df45fa840..b89241e4c 100644 --- a/doc/ikiwiki/directive/date.mdwn +++ b/doc/ikiwiki/directive/date.mdwn @@ -12,3 +12,5 @@ For example, an update to a page with an embedded date stamp could look like: Updated \[[!date "Wed, 25 Nov 2009 01:11:55 -0500"]]: mumble mumble + +[[!meta robots="noindex, follow"]] diff --git a/doc/ikiwiki/pagespec/po.mdwn b/doc/ikiwiki/pagespec/po.mdwn index e0264dd50..40ed9efb6 100644 --- a/doc/ikiwiki/pagespec/po.mdwn +++ b/doc/ikiwiki/pagespec/po.mdwn @@ -14,3 +14,5 @@ wiki: Note that every non-po page is considered to be written in `po_master_language`, as specified in `ikiwiki.setup`. + +[[!meta robots="noindex, follow"]] diff --git a/doc/ikiwiki/pagespec/sorting.mdwn b/doc/ikiwiki/pagespec/sorting.mdwn index 41aa58151..697818a2a 100644 --- a/doc/ikiwiki/pagespec/sorting.mdwn +++ b/doc/ikiwiki/pagespec/sorting.mdwn @@ -9,3 +9,5 @@ orders can be specified. * `title_natural` - Only available if [[!cpan Sort::Naturally]] is installed. Orders by title, but numbers in the title are treated as such, ("1 2 9 10 20" instead of "1 10 2 20 9") + +[[!meta robots="noindex, follow"]] -- cgit v1.2.3 From 2e55a598350f422a8c064cad6bbba4e2fde13ed8 Mon Sep 17 00:00:00 2001 From: "http://gustaf.thorslund.org/" Date: Sun, 7 Feb 2010 14:09:15 +0000 Subject: Added missing '!' in "!format perl..." --- doc/ikiwiki/directive/format.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/format.mdwn b/doc/ikiwiki/directive/format.mdwn index 23830e9cd..7d11d225f 100644 --- a/doc/ikiwiki/directive/format.mdwn +++ b/doc/ikiwiki/directive/format.mdwn @@ -22,7 +22,7 @@ Note that if the highlight plugin is enabled, this directive can also be used to display syntax highlighted code. Many languages and formats are supported. For example: - \[[format perl """ + \[[!format perl """ print "hello, world\n"; """]] -- cgit v1.2.3 From 7495d30a6ab00d09ea142cfdc599c8abfb64340e Mon Sep 17 00:00:00 2001 From: Thiana Date: Mon, 1 Mar 2010 21:15:29 +0000 Subject: --- doc/ikiwiki/directive/inline/discussion.mdwn | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/inline/discussion.mdwn b/doc/ikiwiki/directive/inline/discussion.mdwn index 998ba642b..6a186cd93 100644 --- a/doc/ikiwiki/directive/inline/discussion.mdwn +++ b/doc/ikiwiki/directive/inline/discussion.mdwn @@ -1,3 +1,10 @@ +## Combine inline and toggle + +Is it possible to combine the behaviour of toggle and inline? ie, have it present of list of 'headlines' which are created from seperate subpages which can be clicked to expand to the body of the inlined page. Thanks. + +-- Thiana + +--- ## How do you provide the per post discussion links in your own blog? > That's configured by the "actions" parameter to the inline directive. See -- cgit v1.2.3 From 84d41fb86707890ae3bebe5f82fd438715f88c44 Mon Sep 17 00:00:00 2001 From: Thiana Date: Tue, 9 Mar 2010 00:07:17 +0000 Subject: --- doc/ikiwiki/directive/map/discussion.mdwn | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/map/discussion.mdwn b/doc/ikiwiki/directive/map/discussion.mdwn index 062b4267a..075b91b4d 100644 --- a/doc/ikiwiki/directive/map/discussion.mdwn +++ b/doc/ikiwiki/directive/map/discussion.mdwn @@ -1,3 +1,12 @@ +### Sorting + +Is there a way to have the generated maps sorted by *title* instead of *filename* when show=title is used? +Thanks + +-- Thiana + +---- + Question: Is there a way to generate a listing that shows *both* title and description meta information? Currently, a \[\[!map ...]] shows only one of the two, but I'd like to generate a navigation that looks like a description list. For example: * This is the title meta information. -- cgit v1.2.3 From 2af6a32aba4a7f96f63b3dfc176e1d4b40488a34 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 8 Mar 2010 20:24:02 -0500 Subject: add link --- doc/ikiwiki/directive/map/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/map/discussion.mdwn b/doc/ikiwiki/directive/map/discussion.mdwn index 075b91b4d..f6eaa6b80 100644 --- a/doc/ikiwiki/directive/map/discussion.mdwn +++ b/doc/ikiwiki/directive/map/discussion.mdwn @@ -5,6 +5,8 @@ Thanks -- Thiana +> [[bugs/map_sorts_by_pagename_and_not_title_when_show__61__title_is_used]] --[[Joey]] + ---- Question: Is there a way to generate a listing that shows *both* title and description meta information? Currently, a \[\[!map ...]] shows only one of the two, but I'd like to generate a navigation that looks like a description list. For example: -- cgit v1.2.3 From b0ae19872d443860aeaab7069255e3a68a520887 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 24 Mar 2010 03:18:24 +0000 Subject: Add an optional "sort" argument to meta titles, defaulting to the title This allows correct sorting of titles, names, etc., with: [[!meta title="David Bowie" sort="Bowie, David"]] [[!meta title="The Beatles" sort="Beatles, The"]] --- IkiWiki/Plugin/meta.pm | 16 +++++++++++----- doc/ikiwiki/directive/meta.mdwn | 7 +++++++ doc/ikiwiki/pagespec/sorting.mdwn | 7 ++++--- 3 files changed, 22 insertions(+), 8 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index bf8159814..a470041c9 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -90,6 +90,12 @@ sub preprocess (@) { # Metadata collection that needs to happen during the scan pass. if ($key eq 'title') { $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value); + if (exists $params{sort}) { + $pagestate{$page}{meta}{titlesort}=$params{sort}; + } + else { + $pagestate{$page}{meta}{titlesort}=$value; + } return ""; } elsif ($key eq 'description') { @@ -283,18 +289,18 @@ sub pagetemplate (@) { } } -sub title { - my $title = $pagestate{$_[0]}{meta}{title}; +sub titlesort { + my $key = $pagestate{$_[0]}{meta}{titlesort}; - if (defined $title) { - return $title; + if (defined $key) { + return $key; } return pagetitle(IkiWiki::basename($_[0])); } sub sort_meta_title { - return title($_[0]) cmp title($_[1]); + return titlesort($_[0]) cmp titlesort($_[1]); } sub match { diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn index 557441c0b..8d2a5b1ad 100644 --- a/doc/ikiwiki/directive/meta.mdwn +++ b/doc/ikiwiki/directive/meta.mdwn @@ -23,6 +23,13 @@ Supported fields: be set to a true value in the template; this can be used to format things differently in this case. + An optional `sort` parameter will be used preferentially when + [[ikiwiki/pagespec/sorting]] by `meta_title`: + + \[[!meta title="The Beatles" sort="Beatles, The"]] + + \[[!meta title="David Bowie" sort="Bowie, David"]] + * license Specifies a license for the page, for example, "GPL". Can contain diff --git a/doc/ikiwiki/pagespec/sorting.mdwn b/doc/ikiwiki/pagespec/sorting.mdwn index 3a9fef9b6..61516bec5 100644 --- a/doc/ikiwiki/pagespec/sorting.mdwn +++ b/doc/ikiwiki/pagespec/sorting.mdwn @@ -5,13 +5,14 @@ orders can be specified. * `age` - List pages from the most recently created to the oldest. * `mtime` - List pages with the most recently modified first. -* `title` - Order by title. +* `title` - Order by title (page name). * `title_natural` - Only available if [[!cpan Sort::Naturally]] is installed. Orders by title, but numbers in the title are treated as such, ("1 2 9 10 20" instead of "1 10 2 20 9") [[!if test="enabled(meta)" then=""" -* `meta_title` - Order by the full title set by the `\[[!meta title="foo"]]` - [[ikiwiki/directive]]. +* `meta_title` - Order according to the `\[[!meta title="foo" sort="bar"]]` + or `\[[!meta title="foo"]]` [[ikiwiki/directive]], or the page name if no + full title was set. """]] Plugins can add additional sort orders, so more might be available on this -- cgit v1.2.3 From 68c67efeffd0f51e01cd557722632367f0dc3849 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 29 Mar 2010 13:27:50 -0400 Subject: clarify example with whitespace --- doc/ikiwiki/directive/table.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/table.mdwn b/doc/ikiwiki/directive/table.mdwn index e27a94b7c..2dac97724 100644 --- a/doc/ikiwiki/directive/table.mdwn +++ b/doc/ikiwiki/directive/table.mdwn @@ -6,8 +6,8 @@ or DSV (delimiter-separated values) format. ## examples \[[!table data=""" - Customer|Amount - Fulanito|134,34 + Customer |Amount + Fulanito |134,34 Menganito|234,56 Menganito|234,56 """]] -- cgit v1.2.3 From 3c9cd4f156018aea3d10dbf02be529e85c05eb66 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 1 Apr 2010 18:13:38 +0100 Subject: Explain tab-delimited tables a bit better --- doc/bugs/Tab_delimited_tables_don__39__t_work.mdwn | 2 ++ doc/ikiwiki/directive/table.mdwn | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/bugs/Tab_delimited_tables_don__39__t_work.mdwn b/doc/bugs/Tab_delimited_tables_don__39__t_work.mdwn index 278826ea0..39d57a4fe 100644 --- a/doc/bugs/Tab_delimited_tables_don__39__t_work.mdwn +++ b/doc/bugs/Tab_delimited_tables_don__39__t_work.mdwn @@ -18,3 +18,5 @@ alpha beta """]] > > So, I think this can be considered [[not_a_bug|done]]? --[[smcv]] + +>> I've clarified the documentation. --[[smcv]] diff --git a/doc/ikiwiki/directive/table.mdwn b/doc/ikiwiki/directive/table.mdwn index 2dac97724..a6692f92c 100644 --- a/doc/ikiwiki/directive/table.mdwn +++ b/doc/ikiwiki/directive/table.mdwn @@ -42,4 +42,9 @@ cells. For example: as the table header. Set it to "no" to make a table without a header, or "column" to make the first column be the header. +For tab-delimited tables (often obtained by copying and pasting from HTML +or a spreadsheet), `delimiter` must be set to a literal tab character. These +are difficult to type in most web browsers - copying and pasting one from +the table data is likely to be the easiest way. + [[!meta robots="noindex, follow"]] -- cgit v1.2.3 From 618bbaee3815daffe329fc1e2d77f04fcd8392b8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 3 Apr 2010 14:17:48 +0100 Subject: meta: generalize meta_title into meta(title); support author, updated, date I've left meta_title in, undocumented, as a possible replacement for sort=title in IkiWiki 4.0 or something. --- IkiWiki/Plugin/meta.pm | 58 +++++++++++++++++++++++++++++++++------ doc/ikiwiki/directive/meta.mdwn | 7 ++++- doc/ikiwiki/pagespec/sorting.mdwn | 5 ++-- 3 files changed, 58 insertions(+), 12 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index cd7d0d127..c9fdbc934 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -122,6 +122,12 @@ sub preprocess (@) { } elsif ($key eq 'author') { $pagestate{$page}{meta}{author}=$value; + if (exists $params{sort}) { + $pagestate{$page}{meta}{authorsort}=$params{sort}; + } + else { + $pagestate{$page}{meta}{authorsort}=$value; + } # fallthorough } elsif ($key eq 'authorurl') { @@ -288,14 +294,31 @@ sub pagetemplate (@) { } } -sub titlesort { - my $key = $pagestate{$_[0]}{meta}{titlesort}; +sub get_sort_key { + my $page = $_[0]; + my $meta = $_[1]; - if (defined $key) { - return $key; - } + # e.g. titlesort (also makes sense for author) + my $key = $pagestate{$page}{meta}{$meta . "sort"}; + return $key if defined $key; + + # e.g. title + $key = $pagestate{$page}{meta}{$meta}; + return $key if defined $key; - return pagetitle(IkiWiki::basename($_[0])); + # fall back to closer-to-core things + if ($meta eq 'title') { + return pagetitle(IkiWiki::basename($page)); + } + elsif ($meta eq 'date') { + return $IkiWiki::pagectime{$page}; + } + elsif ($meta eq 'updated') { + return $IkiWiki::pagemtime{$page}; + } + else { + return ''; + } } sub match { @@ -350,10 +373,27 @@ sub match_copyright ($$;@) { package IkiWiki::SortSpec; +sub cmp_meta { + my $left = $_[0]; + my $right = $_[1]; + my $meta = $_[2]; + error(gettext("sort=meta requires a parameter")) unless defined $meta; + + if ($meta eq 'updated' || $meta eq 'date') { + return IkiWiki::Plugin::meta::get_sort_key($left, $meta) + <=> + IkiWiki::Plugin::meta::get_sort_key($right, $meta); + } + + return IkiWiki::Plugin::meta::get_sort_key($left, $meta) + cmp + IkiWiki::Plugin::meta::get_sort_key($right, $meta); +} + +# A prototype of how sort=title could behave in 4.0 or something sub cmp_meta_title { - IkiWiki::Plugin::meta::titlesort($_[0]) - cmp - IkiWiki::Plugin::meta::titlesort($_[1]) + $_[2] = 'title'; + return cmp_meta(@_); } 1 diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn index 8d2a5b1ad..c5f74fac5 100644 --- a/doc/ikiwiki/directive/meta.mdwn +++ b/doc/ikiwiki/directive/meta.mdwn @@ -24,7 +24,7 @@ Supported fields: differently in this case. An optional `sort` parameter will be used preferentially when - [[ikiwiki/pagespec/sorting]] by `meta_title`: + [[ikiwiki/pagespec/sorting]] by `meta(title)`: \[[!meta title="The Beatles" sort="Beatles, The"]] @@ -44,6 +44,11 @@ Supported fields: Specifies the author of a page. + An optional `sort` parameter will be used preferentially when + [[ikiwiki/pagespec/sorting]] by `meta(author)`: + + \[[!meta author="Joey Hess" sort="Hess, Joey"]] + * authorurl Specifies an url for the author of a page. diff --git a/doc/ikiwiki/pagespec/sorting.mdwn b/doc/ikiwiki/pagespec/sorting.mdwn index ba995a521..fbf598340 100644 --- a/doc/ikiwiki/pagespec/sorting.mdwn +++ b/doc/ikiwiki/pagespec/sorting.mdwn @@ -11,9 +11,10 @@ orders can be specified. as such, ("1 2 9 10 20" instead of "1 10 2 20 9") """]] [[!if test="enabled(meta)" then=""" -* `meta_title` - Order according to the `\[[!meta title="foo" sort="bar"]]` +* `meta(title)` - Order according to the `\[[!meta title="foo" sort="bar"]]` or `\[[!meta title="foo"]]` [[ikiwiki/directive]], or the page name if no - full title was set. + full title was set. `meta(author)`, `meta(date)`, `meta(updated)`, etc. + also work. """]] In addition, you can combine several sort orders and/or reverse the order of -- cgit v1.2.3 From 490f95616a8a49f2120655d07c282eefd067e640 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 3 Apr 2010 14:19:18 +0100 Subject: Rename sort parameter to meta title/author to sortas=bar Joey pointed out that sort=x usually takes a sort order. --- IkiWiki/Plugin/meta.pm | 8 ++++---- doc/ikiwiki/directive/meta.mdwn | 10 +++++----- doc/ikiwiki/pagespec/sorting.mdwn | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index c9fdbc934..4992617d0 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -89,8 +89,8 @@ sub preprocess (@) { # Metadata collection that needs to happen during the scan pass. if ($key eq 'title') { $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value); - if (exists $params{sort}) { - $pagestate{$page}{meta}{titlesort}=$params{sort}; + if (exists $params{sortas}) { + $pagestate{$page}{meta}{titlesort}=$params{sortas}; } else { $pagestate{$page}{meta}{titlesort}=$value; @@ -122,8 +122,8 @@ sub preprocess (@) { } elsif ($key eq 'author') { $pagestate{$page}{meta}{author}=$value; - if (exists $params{sort}) { - $pagestate{$page}{meta}{authorsort}=$params{sort}; + if (exists $params{sortas}) { + $pagestate{$page}{meta}{authorsort}=$params{sortas}; } else { $pagestate{$page}{meta}{authorsort}=$value; diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn index c5f74fac5..5a3919dea 100644 --- a/doc/ikiwiki/directive/meta.mdwn +++ b/doc/ikiwiki/directive/meta.mdwn @@ -23,12 +23,12 @@ Supported fields: be set to a true value in the template; this can be used to format things differently in this case. - An optional `sort` parameter will be used preferentially when + An optional `sortas` parameter will be used preferentially when [[ikiwiki/pagespec/sorting]] by `meta(title)`: - \[[!meta title="The Beatles" sort="Beatles, The"]] + \[[!meta title="The Beatles" sortas="Beatles, The"]] - \[[!meta title="David Bowie" sort="Bowie, David"]] + \[[!meta title="David Bowie" sortas="Bowie, David"]] * license @@ -44,10 +44,10 @@ Supported fields: Specifies the author of a page. - An optional `sort` parameter will be used preferentially when + An optional `sortas` parameter will be used preferentially when [[ikiwiki/pagespec/sorting]] by `meta(author)`: - \[[!meta author="Joey Hess" sort="Hess, Joey"]] + \[[!meta author="Joey Hess" sortas="Hess, Joey"]] * authorurl diff --git a/doc/ikiwiki/pagespec/sorting.mdwn b/doc/ikiwiki/pagespec/sorting.mdwn index fbf598340..5c6cfcc2b 100644 --- a/doc/ikiwiki/pagespec/sorting.mdwn +++ b/doc/ikiwiki/pagespec/sorting.mdwn @@ -11,7 +11,7 @@ orders can be specified. as such, ("1 2 9 10 20" instead of "1 10 2 20 9") """]] [[!if test="enabled(meta)" then=""" -* `meta(title)` - Order according to the `\[[!meta title="foo" sort="bar"]]` +* `meta(title)` - Order according to the `\[[!meta title="foo" sortas="bar"]]` or `\[[!meta title="foo"]]` [[ikiwiki/directive]], or the page name if no full title was set. `meta(author)`, `meta(date)`, `meta(updated)`, etc. also work. -- cgit v1.2.3 From 3131433f64235ad5425eb93d5773580b607876fb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 13:40:53 -0400 Subject: calendar: Add archive_pagespec, which is used by ikiwiki-calendar to specify which pages to include on the calendar archive pages. (The pagespec can still also be specified on the ikiwiki-calendar command line.) --- IkiWiki/Plugin/calendar.pm | 8 ++++++++ debian/changelog | 4 ++++ doc/ikiwiki-calendar.mdwn | 8 +++++--- doc/ikiwiki/directive/calendar.mdwn | 7 +++++-- ikiwiki-calendar.in | 6 +++++- 5 files changed, 27 insertions(+), 6 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index ff84bc440..0f0e9518a 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -47,6 +47,14 @@ sub getsetup () { safe => 1, rebuild => 1, }, + archive_pagespec => { + type => "pagespec", + example => "posts/* and !*/Discussion", + description => "PageSpec of pages to include in the archives; used by ikiwiki-calendar command", + link => 'ikiwiki/PageSpec', + safe => 1, + rebuild => 0, + }, } sub is_leap_year (@) { diff --git a/debian/changelog b/debian/changelog index 26b00a07c..7c607b2a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,10 @@ ikiwiki (3.20100410) UNRELEASED; urgency=low for master language. * po: Configuring the same language as master and slave confuses processing; so filter out such a misconfiguration. + * calendar: Add archive_pagespec, which is used by ikiwiki-calendar to + specify which pages to include on the calendar archive pages. + (The pagespec can still also be specified on the ikiwiki-calendar command + line.) -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/ikiwiki-calendar.mdwn b/doc/ikiwiki-calendar.mdwn index 982892fca..c1f4d7267 100644 --- a/doc/ikiwiki-calendar.mdwn +++ b/doc/ikiwiki-calendar.mdwn @@ -16,9 +16,11 @@ 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, +To control which pages are included on the calendars, +a [[ikiwiki/PageSpec]] can be specified. The default is +all pages, or the pages specified by the `comments_pagespec` +setting in the config file. A pagespec can also be specified +on the command line. To limit it to only posts in a blog, use something like "posts/* and !*/Discussion". It defaults to creating calendar pages for the current diff --git a/doc/ikiwiki/directive/calendar.mdwn b/doc/ikiwiki/directive/calendar.mdwn index b2ac75b11..8a08081ee 100644 --- a/doc/ikiwiki/directive/calendar.mdwn +++ b/doc/ikiwiki/directive/calendar.mdwn @@ -40,9 +40,12 @@ An example crontab: "month" or "year". The default is a month view calendar. * `pages` - Specifies the [[ikiwiki/PageSpec]] of pages to link to from the month calendar. Defaults to "*". -* `archivebase` - Configures the base of the archives hierarchy. The - default is "archives". Note that this default can also be overridden +* `archivebase` - Configures the base of the archives hierarchy. + The default is "archives". Note that this default can also be overridden for the whole wiki by setting `archivebase` in ikiwiki's setup file. + Calendars link to pages under here, with names like "2010/04" and + "2010". These pages can be automatically created using the + [[ikiwiki-calendar]] tool. * `year` - The year for which the calendar is requested. Defaults to the current year. * `month` - The numeric month for which the calendar is requested, in the diff --git a/ikiwiki-calendar.in b/ikiwiki-calendar.in index 9738ea5f7..6b6f693b3 100755 --- a/ikiwiki-calendar.in +++ b/ikiwiki-calendar.in @@ -15,7 +15,7 @@ GetOptions( "force" => \$force, ) || usage(); my $setup=shift || usage(); -my $pagespec=shift || "*"; +my $pagespec=shift; my $startyear=shift || 1900+(localtime(time))[5]; my $endyear=shift || $startyear; @@ -27,6 +27,10 @@ IkiWiki::checkconfig(); my $archivebase = 'archives'; $archivebase = $config{archivebase} if defined $config{archivebase}; +if (! defined $pagespec) { + $pagespec=$config{archive_pagespec} || "*"; +} + sub writearchive ($$;$) { my $template=template(shift); my $year=shift; -- cgit v1.2.3 From fe733e2a424f50227e4a501c3efbf1ce43e07352 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 14:29:14 -0400 Subject: enhance pagestats and rework example blog front page * pagestats: Class parameter can be used to override default class for custom styling. * pagestats: Use style=list to get a list of tags, scaled by use like in a tag cloud. This is useful to put in a sidebar. * Rework example blog front page. --- IkiWiki/Plugin/pagestats.pm | 21 ++++++++++++++++++--- debian/changelog | 5 +++++ doc/examples/blog/archives.mdwn | 7 +++++++ doc/examples/blog/comments.mdwn | 2 +- doc/examples/blog/index.mdwn | 12 ++++++++---- doc/ikiwiki/directive/pagestats.mdwn | 11 ++++++++++- 6 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 doc/examples/blog/archives.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 1c0b46830..48715bd3e 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -75,7 +75,7 @@ sub preprocess (@) { } if ($style eq 'table') { - return "
\n". + return "
\n". join("\n", map { "
". htmllink($params{page}, $params{destpage}, $_, noimageinline => 1). @@ -87,16 +87,31 @@ sub preprocess (@) { else { # In case of misspelling, default to a page cloud - my $res = "
\n"; + my $res; + if ($style eq 'list') { + $res = "
    \n"; + } + else { + $res = "
    \n"; + } foreach my $page (sort keys %counts) { next unless $counts{$page} > 0; my $class = $classes[$counts{$page} * scalar(@classes) / ($max + 1)]; + + $res.="
  • " if $style eq 'list'; $res .= "". htmllink($params{page}, $params{destpage}, $page). "\n"; + $res.="
  • " if $style eq 'list'; + + } + if ($style eq 'list') { + $res = "
\n"; + } + else { + $res .= "
\n"; } - $res .= "\n"; return $res; } diff --git a/debian/changelog b/debian/changelog index 7c607b2a5..c2b0c3c23 100644 --- a/debian/changelog +++ b/debian/changelog @@ -31,6 +31,11 @@ ikiwiki (3.20100410) UNRELEASED; urgency=low specify which pages to include on the calendar archive pages. (The pagespec can still also be specified on the ikiwiki-calendar command line.) + * pagestats: Class parameter can be used to override default class for + custom styling. + * pagestats: Use style=list to get a list of tags, scaled by use like + in a tag cloud. This is useful to put in a sidebar. + * Rework example blog front page. -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/examples/blog/archives.mdwn b/doc/examples/blog/archives.mdwn new file mode 100644 index 000000000..14686cdfe --- /dev/null +++ b/doc/examples/blog/archives.mdwn @@ -0,0 +1,7 @@ +[[!if test="enabled(calendar)" then=""" +Browse through blog archives by year: +[[!map pages="./archives/* and !./archives/*/* and !*/Discussion"]] +""" +else=""" +Calendar based archives are not enabled. See [[posts]] for a full list of posts. +"""]] diff --git a/doc/examples/blog/comments.mdwn b/doc/examples/blog/comments.mdwn index 4735dea08..0b503ba01 100644 --- a/doc/examples/blog/comments.mdwn +++ b/doc/examples/blog/comments.mdwn @@ -1,3 +1,3 @@ -This page will show all comments made to posts in my [[blog|index]]. +This page will show recent comments made to posts in the [[blog|index]]. [[!inline pages="./posts/*/Discussion or internal(./posts/*/comment_*)"]] diff --git a/doc/examples/blog/index.mdwn b/doc/examples/blog/index.mdwn index 01b714fcd..b273ba1a9 100644 --- a/doc/examples/blog/index.mdwn +++ b/doc/examples/blog/index.mdwn @@ -1,9 +1,13 @@ -[[!pagestats pages="./tags/*" among="./posts/*"]] +[[!template id=note text=""" -Welcome to my blog. +* [[Tags]]: [[!pagestats style="list" pages="./tags/*" among="./posts/*"]] +* [[Recent_Comments|comments]] +* [[Archives]] -Have a look at the most recent posts below, or browse the tag cloud on the -right. Archives of all [[posts]] and all [[comments]] are also available. +[[!if test="enabled(calendar)" then=""" +[[!calendar pages="./posts/* and !*/Discussion"]] + +"""]] [[!inline pages="./posts/* and !*/Discussion" show="10" actions=yes rootpage="posts"]] diff --git a/doc/ikiwiki/directive/pagestats.mdwn b/doc/ikiwiki/directive/pagestats.mdwn index 68f4d2734..d0e0e7be7 100644 --- a/doc/ikiwiki/directive/pagestats.mdwn +++ b/doc/ikiwiki/directive/pagestats.mdwn @@ -4,10 +4,16 @@ This directive can generate stats about how pages link to each other. It can produce either a tag cloud, or a table counting the number of links to each page. -Here's how to use it to create a [[tag]] cloud: +Here's how to use it to create a [[tag]] cloud, with tags sized based +on frequency of use: \[[!pagestats pages="tags/*"]] +Here's how to create a list of tags, sized by use as they would be in a +cloud. + + \[[!pagestats style="list" pages="tags/*"]] + And here's how to create a table of all the pages on the wiki: \[[!pagestats style="table"]] @@ -28,4 +34,7 @@ links: \[[!pagestats style="table" show="10"]] +The optional `class` parameter can be used to control the class +of the generated tag cloud `div` or page stats `table`. + [[!meta robots="noindex, follow"]] -- cgit v1.2.3 From d6bfe2a25ec20ea33a0537143afdfbb847e4183f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 14:32:53 -0400 Subject: don't link to ikiwiki-calendar, broken link on basewiki --- doc/ikiwiki/directive/calendar.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/calendar.mdwn b/doc/ikiwiki/directive/calendar.mdwn index 8a08081ee..198da9d51 100644 --- a/doc/ikiwiki/directive/calendar.mdwn +++ b/doc/ikiwiki/directive/calendar.mdwn @@ -45,7 +45,7 @@ An example crontab: for the whole wiki by setting `archivebase` in ikiwiki's setup file. Calendars link to pages under here, with names like "2010/04" and "2010". These pages can be automatically created using the - [[ikiwiki-calendar]] tool. + `ikiwiki-calendar` program. * `year` - The year for which the calendar is requested. Defaults to the current year. * `month` - The numeric month for which the calendar is requested, in the -- cgit v1.2.3 From 358fa953e189d6f8a7925be8533fe7b7c5699503 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 16:40:01 -0400 Subject: sidebar: Now a sidebar directive can be used to override the sidebar shown on a page. --- IkiWiki/Plugin/sidebar.pm | 42 +++++++++++++++++++++++++++++++++++++- debian/changelog | 2 ++ doc/ikiwiki/directive/sidebar.mdwn | 14 +++++++++++++ doc/plugins/sidebar.mdwn | 17 +++++++-------- 4 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 doc/ikiwiki/directive/sidebar.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index 41812e1c1..d63cb5246 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -10,6 +10,7 @@ use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "sidebar", call => \&getsetup); + hook(type => "preprocess", id => "sidebar", call => \&preprocess); hook(type => "pagetemplate", id => "sidebar", call => \&pagetemplate); } @@ -21,9 +22,39 @@ sub getsetup () { }, } +my %pagesidebar; + +sub preprocess (@) { + my %params=@_; + my $content=shift; + shift; + + if (! defined $content) { + error(gettext("sidebar content not specified")); + } + + my $page=$params{page}; + return "" unless $page eq $params{destpage}; + my $file = $pagesources{$page}; + my $type = pagetype($file); + + $pagesidebar{$page}= + IkiWiki::htmlize($page, $page, $type, + IkiWiki::linkify($page, $page, + IkiWiki::preprocess($page, $page, + IkiWiki::filter($page, $page, $content)))); + + return ""; +} + +my $oldfile; +my $oldcontent; + sub sidebar_content ($) { my $page=shift; + return $pagesidebar{$page} if exists $pagesidebar{$page}; + my $sidebar_page=bestlink($page, "sidebar") || return; my $sidebar_file=$pagesources{$sidebar_page} || return; my $sidebar_type=pagetype($sidebar_file); @@ -34,7 +65,16 @@ sub sidebar_content ($) { # currently requires a wiki rebuild. add_depends($page, $sidebar_page); - my $content=readfile(srcfile($sidebar_file)); + my $content; + if (defined $oldfile && $sidebar_file eq $oldfile) { + $content=$oldcontent; + } + else { + $content=readfile(srcfile($sidebar_file)); + $oldcontent=$content; + $oldfile=$sidebar_file; + } + return unless length $content; return IkiWiki::htmlize($sidebar_page, $page, $sidebar_type, IkiWiki::linkify($sidebar_page, $page, diff --git a/debian/changelog b/debian/changelog index 03361e6a0..267a2fd7a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -37,6 +37,8 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low in a tag cloud. This is useful to put in a sidebar. * Rework example blog front page. * CSS and templates for sidebar changed to use a class, not an id. + * sidebar: Now a sidebar directive can be used to override the sidebar + shown on a page. -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/ikiwiki/directive/sidebar.mdwn b/doc/ikiwiki/directive/sidebar.mdwn new file mode 100644 index 000000000..46f016747 --- /dev/null +++ b/doc/ikiwiki/directive/sidebar.mdwn @@ -0,0 +1,14 @@ +The `sidebar` directive is supplied by the [[!iki plugins/sidebar desc=sidebar]] plugin. + +This directive specifies a custom sidebar to display on the page, instead +of any sidebar that is displayed globally. + +## examples + + \[[!sidebar """ + This is my custom sidebar for this page. + + \[[!calendar pages="posts/*"]] + """]] + +[[!meta robots="noindex, follow"]] diff --git a/doc/plugins/sidebar.mdwn b/doc/plugins/sidebar.mdwn index 4e356d65a..cd0f0ecf1 100644 --- a/doc/plugins/sidebar.mdwn +++ b/doc/plugins/sidebar.mdwn @@ -10,15 +10,16 @@ Typically this will be a page in the root of the wiki, but it can also be a [[plugins/sidebar|plugins/sidebar]], will be treated as a sidebar for the [[plugins]] page, and of all of its SubPages, if the plugin is enabled. -Note that to disable a sidebar for a [[ikiwiki/SubPage]] of a page that has -a sidebar, you can create a sidebar page that is completely empty. This -will turn off the sidebar altogether. +There is also a [[ikiwiki/directive/sidebar]] directive that can be used +to provide a custom sidebar content for a page. -Warning: Any change to the sidebar will cause a rebuild of the whole wiki, -since every page includes a copy that has to be updated. This can -especially be a problem if the sidebar includes an [[ikiwiki/directive/inline]] -directive, since any changes to pages inlined into the sidebar -will change the sidebar and cause a full wiki rebuild. +---- + +Warning: Any change to the sidebar page will cause a rebuild of the whole +wiki, since every page includes a copy that has to be updated. This can +especially be a problem if the sidebar includes an +[[ikiwiki/directive/inline]] directive, since any changes to pages inlined +into the sidebar will change the sidebar and cause a full wiki rebuild. Instead, if you include a [[ikiwiki/directive/map]] directive on the sidebar, and it does not use the `show` parameter, only adding or removing pages -- cgit v1.2.3 From 1f7175e891f87c350decc1ec821bebb5adc22c2a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 17:31:50 -0400 Subject: sidebar: Add global_sidebars setting. --- IkiWiki/Plugin/sidebar.pm | 9 +++++++++ debian/changelog | 1 + doc/ikiwiki/directive/sidebar.mdwn | 4 ++-- doc/plugins/sidebar.mdwn | 8 +++++--- 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index d63cb5246..1b302dcf9 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -20,6 +20,13 @@ sub getsetup () { safe => 1, rebuild => 1, }, + global_sidebars => { + type => "boolean", + examples => 1, + description => "show sidebar page on all pages?" + safe => 1, + rebuild => 1, + }, } my %pagesidebar; @@ -55,6 +62,8 @@ sub sidebar_content ($) { return $pagesidebar{$page} if exists $pagesidebar{$page}; + return if defined $config{global_sidebars} && !$config{global_sidebars}; + my $sidebar_page=bestlink($page, "sidebar") || return; my $sidebar_file=$pagesources{$sidebar_page} || return; my $sidebar_type=pagetype($sidebar_file); diff --git a/debian/changelog b/debian/changelog index af19f4a00..c379253d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,7 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low * sidebar: Now a sidebar directive can be used to override the sidebar shown on a page. * Enable calendar and sidebar in auto-blog.setup. + * sidebar: Add global_sidebars setting. -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/ikiwiki/directive/sidebar.mdwn b/doc/ikiwiki/directive/sidebar.mdwn index 46f016747..34f078672 100644 --- a/doc/ikiwiki/directive/sidebar.mdwn +++ b/doc/ikiwiki/directive/sidebar.mdwn @@ -1,7 +1,7 @@ The `sidebar` directive is supplied by the [[!iki plugins/sidebar desc=sidebar]] plugin. -This directive specifies a custom sidebar to display on the page, instead -of any sidebar that is displayed globally. +This directive specifies a custom sidebar to display on the page, +overriding any sidebar that is displayed globally. ## examples diff --git a/doc/plugins/sidebar.mdwn b/doc/plugins/sidebar.mdwn index cd0f0ecf1..012733456 100644 --- a/doc/plugins/sidebar.mdwn +++ b/doc/plugins/sidebar.mdwn @@ -1,9 +1,11 @@ [[!template id=plugin name=sidebar author="Tuomo Valkonen"]] [[!tag type/chrome]] -If this plugin is enabled, then a sidebar is added to pages in the wiki. -The content of the sidebar is simply the content of a page named -"sidebar" (ie, create a "sidebar.mdwn"). +This plugin allows adding a sidebar to pages in the wiki. + +By default, and unless the `global_sidebars` setting is turned off, +a sidebar is added to all pages in the wiki. The content of the sidebar +is simply the content of a page named "sidebar" (ie, create a "sidebar.mdwn"). Typically this will be a page in the root of the wiki, but it can also be a [[ikiwiki/SubPage]]. In fact, this page, -- cgit v1.2.3 From d63e043f0abf642ff4048cc20c6caf03db3e55fb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 17:38:13 -0400 Subject: allow sidebar directive to enable use of sidebar page This way, the example blog always has a sidebar on the index page, but not the overhead of sidebars on all the other pages. And if a user wants to, they can enable global_sidebars to switch to sidebars on every page. --- IkiWiki/Plugin/sidebar.pm | 33 ++++++++++++++++++--------------- doc/examples/blog/index.mdwn | 10 +--------- doc/examples/blog/sidebar.mdwn | 9 +++++++++ doc/ikiwiki/directive/sidebar.mdwn | 8 +++++++- 4 files changed, 35 insertions(+), 25 deletions(-) create mode 100644 doc/examples/blog/sidebar.mdwn (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index 1b302dcf9..f706480ca 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -23,7 +23,7 @@ sub getsetup () { global_sidebars => { type => "boolean", examples => 1, - description => "show sidebar page on all pages?" + description => "show sidebar page on all pages?", safe => 1, rebuild => 1, }, @@ -36,20 +36,22 @@ sub preprocess (@) { my $content=shift; shift; - if (! defined $content) { - error(gettext("sidebar content not specified")); - } - my $page=$params{page}; return "" unless $page eq $params{destpage}; - my $file = $pagesources{$page}; - my $type = pagetype($file); - - $pagesidebar{$page}= - IkiWiki::htmlize($page, $page, $type, - IkiWiki::linkify($page, $page, - IkiWiki::preprocess($page, $page, - IkiWiki::filter($page, $page, $content)))); + + if (! defined $content) { + $pagesidebar{$page}=undef; + } + else { + my $file = $pagesources{$page}; + my $type = pagetype($file); + + $pagesidebar{$page}= + IkiWiki::htmlize($page, $page, $type, + IkiWiki::linkify($page, $page, + IkiWiki::preprocess($page, $page, + IkiWiki::filter($page, $page, $content)))); + } return ""; } @@ -60,9 +62,10 @@ my $oldcontent; sub sidebar_content ($) { my $page=shift; - return $pagesidebar{$page} if exists $pagesidebar{$page}; + return $pagesidebar{$page} if defined $pagesidebar{$page}; - return if defined $config{global_sidebars} && !$config{global_sidebars}; + return if ! exists $pagesidebar{$page} && + defined $config{global_sidebars} && ! $config{global_sidebars}; my $sidebar_page=bestlink($page, "sidebar") || return; my $sidebar_file=$pagesources{$sidebar_page} || return; diff --git a/doc/examples/blog/index.mdwn b/doc/examples/blog/index.mdwn index 062c71f2e..a22c40c72 100644 --- a/doc/examples/blog/index.mdwn +++ b/doc/examples/blog/index.mdwn @@ -1,14 +1,6 @@ [[!inline pages="./posts/* and !*/Discussion" show="10" actions=yes rootpage="posts"]] -[[!sidebar """ -[[Tags]]: [[!pagestats style="list" pages="./tags/*" among="./posts/*"]] - -[[Recent Comments|comments]] - -[[Archives]] - -[[!calendar pages="./posts/* and !*/Discussion"]] -"""]] +[[!sidebar]] This blog is powered by [ikiwiki](http://ikiwiki.info). diff --git a/doc/examples/blog/sidebar.mdwn b/doc/examples/blog/sidebar.mdwn new file mode 100644 index 000000000..f24a8e57a --- /dev/null +++ b/doc/examples/blog/sidebar.mdwn @@ -0,0 +1,9 @@ +[[Tags]]: [[!pagestats style="list" pages="./tags/*" among="./posts/*"]] + +[[Recent Comments|comments]] + +[[Archives]] + +[[!if "enabled(calendar)" then=""" +[[!calendar pages="./posts/* and !*/Discussion"]] +"""]] diff --git a/doc/ikiwiki/directive/sidebar.mdwn b/doc/ikiwiki/directive/sidebar.mdwn index 34f078672..401d7c786 100644 --- a/doc/ikiwiki/directive/sidebar.mdwn +++ b/doc/ikiwiki/directive/sidebar.mdwn @@ -1,8 +1,12 @@ The `sidebar` directive is supplied by the [[!iki plugins/sidebar desc=sidebar]] plugin. -This directive specifies a custom sidebar to display on the page, +This directive can specify a custom sidebar to display on the page, overriding any sidebar that is displayed globally. +If no custom sidebar content is specified, it forces the sidebar page to +be used as the sidebar, even if the `global_sidebars` setting has been +used to disable use of the sidebar page by default. + ## examples \[[!sidebar """ @@ -11,4 +15,6 @@ overriding any sidebar that is displayed globally. \[[!calendar pages="posts/*"]] """]] + \[[!sidebar]] + [[!meta robots="noindex, follow"]] -- cgit v1.2.3 From 4c6f5a48bcfc2462a915387515bfa39b9239a7da Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Apr 2010 17:50:43 -0400 Subject: fix sidebar directive parameter handling --- IkiWiki/Plugin/sidebar.pm | 6 ++---- doc/ikiwiki/directive/sidebar.mdwn | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index f706480ca..808f0bed2 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -33,13 +33,11 @@ my %pagesidebar; sub preprocess (@) { my %params=@_; - my $content=shift; - shift; my $page=$params{page}; return "" unless $page eq $params{destpage}; - if (! defined $content) { + if (! defined $params{content}) { $pagesidebar{$page}=undef; } else { @@ -50,7 +48,7 @@ sub preprocess (@) { IkiWiki::htmlize($page, $page, $type, IkiWiki::linkify($page, $page, IkiWiki::preprocess($page, $page, - IkiWiki::filter($page, $page, $content)))); + IkiWiki::filter($page, $page, $params{content})))); } return ""; diff --git a/doc/ikiwiki/directive/sidebar.mdwn b/doc/ikiwiki/directive/sidebar.mdwn index 401d7c786..599695d22 100644 --- a/doc/ikiwiki/directive/sidebar.mdwn +++ b/doc/ikiwiki/directive/sidebar.mdwn @@ -9,7 +9,7 @@ used to disable use of the sidebar page by default. ## examples - \[[!sidebar """ + \[[!sidebar content=""" This is my custom sidebar for this page. \[[!calendar pages="posts/*"]] -- cgit v1.2.3 From 129cd00bdb03e32df8645b12138cb4c79952775e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 21 Apr 2010 20:15:11 -0400 Subject: remove broken ./tag support The commit that added the (working) support for using /tag to override tagbase also tried to make ./tag work. Problem is, tags are links, and ./foo is not a valid link (though I think there's a wishlist about it). So, using ./tag really resulted in tag creation links that led to a "bad page name" error. And even if the tag were created in the right place, the link didn't go to it. --- IkiWiki/Plugin/tag.pm | 2 +- doc/ikiwiki/directive/tag.mdwn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 62e0cc3b8..8ec08e936 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -39,7 +39,7 @@ sub getsetup () { sub tagpage ($) { my $tag=shift; - if ($tag !~ m{^\.?/} && + if ($tag !~ m{^/} && defined $config{tagbase}) { $tag="/".$config{tagbase}."/".$tag; $tag=~y#/#/#s; # squash dups diff --git a/doc/ikiwiki/directive/tag.mdwn b/doc/ikiwiki/directive/tag.mdwn index 64736f8cd..807a96f25 100644 --- a/doc/ikiwiki/directive/tag.mdwn +++ b/doc/ikiwiki/directive/tag.mdwn @@ -28,7 +28,7 @@ into the `link()` [[ikiwiki/PageSpec]] you use: e.g., if your tagbase is If you want to override the tagbase for a particular tag, you can use something like this: - \[[!tag ./foo]] + \[[!tag /foo]] \[[!taglink /foo]] [[!meta robots="noindex, follow"]] -- cgit v1.2.3 From d048e9c64aca24b8e064aaf1608862b50c427de2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 21 Apr 2010 20:39:20 -0400 Subject: turn on tag_autocreate by default if tagbase is set --- IkiWiki/Plugin/tag.pm | 5 +++-- debian/NEWS | 4 ++++ doc/ikiwiki/directive/tag.mdwn | 3 ++- doc/plugins/tag.mdwn | 8 ++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index cd7ecc212..62f030f4e 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -36,7 +36,7 @@ sub getsetup () { }, tag_autocreate => { type => "boolean", - example => 0, + example => 1, description => "autocreate new tag pages?", safe => 1, rebuild => undef, @@ -67,7 +67,8 @@ sub htmllink_tag ($$$;@) { sub gentag ($) { my $tag=shift; - if ($config{tag_autocreate}) { + if ($config{tag_autocreate} || + ($config{tagbase} && ! defined $config{tag_autocreate})) { my $tagpage=taglink($tag); if ($tagpage=~/^\.\/(.*)/) { $tagpage=$1; diff --git a/debian/NEWS b/debian/NEWS index 9fd882ad2..8b87bc601 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -11,6 +11,10 @@ ikiwiki (3.20100406) unstable; urgency=low not regular wikilinks. If your wiki accidentially relied on the old, buggy behavior, you might need to change pagespecs to use `link()`. + Tag pages can automatically be created as new tags are used. This + feature is enabled by default if you have configured a tagbase. It + can be turned on or off using the `tag_autocreate` setting. + The title_natural sort method (as used by the inline directive, etc) have been moved to the new sortnaturally plugin, which is not enabled by default since it requires the Sort::Naturally perl module. diff --git a/doc/ikiwiki/directive/tag.mdwn b/doc/ikiwiki/directive/tag.mdwn index 807a96f25..c8d9b9816 100644 --- a/doc/ikiwiki/directive/tag.mdwn +++ b/doc/ikiwiki/directive/tag.mdwn @@ -19,7 +19,8 @@ instead: Note that if the wiki is configured to use a tagbase, then the tags will be located under a base directory, such as "tags/". This is a useful way to avoid having to write the full path to tags, if you want to keep them -grouped together out of the way. +grouped together out of the way. Also, since ikiwiki then knows where to put +tags, it will automatically create tag pages when new tags are used. Bear in mind that specifying a tagbase means you will need to incorporate it into the `link()` [[ikiwiki/PageSpec]] you use: e.g., if your tagbase is diff --git a/doc/plugins/tag.mdwn b/doc/plugins/tag.mdwn index bdf39d7e8..8e1286e62 100644 --- a/doc/plugins/tag.mdwn +++ b/doc/plugins/tag.mdwn @@ -8,8 +8,12 @@ These directives allow tagging pages. It also provides the `tagged()` [[ikiwiki/PageSpec]], which can be used to match pages that are tagged with a specific tag. -If the `tag_autocreate` setting is enabled, tag pages will automatically be -created as needed. +The `tagbase` setting can be used to make tags default to being put in a +particular subdirectory. + +The `tag_autocreate` setting can be used to control whether new tag pages +are created as needed. It defaults to being done only if a `tagbase` is +set. [[!if test="enabled(tag)" then=""" This wiki has the tag plugin enabled, so you'll see a note below that this -- cgit v1.2.3 From 170725dc3e6dd99397959c50d8f33bb0c7926f3a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 22 Apr 2010 00:40:05 -0400 Subject: update --- doc/ikiwiki/directive/pagestats/discussion.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/pagestats/discussion.mdwn b/doc/ikiwiki/directive/pagestats/discussion.mdwn index d72b4058d..99029e88e 100644 --- a/doc/ikiwiki/directive/pagestats/discussion.mdwn +++ b/doc/ikiwiki/directive/pagestats/discussion.mdwn @@ -13,3 +13,6 @@ Thanks > The approach that [PmWiki](http://www.pmwiki.org) takes is that it enables the optional auto-creation of (empty) pages which match a particular "group" (set of sub-pages); thus one could set all the "tags/*" pages to be auto-created, creating a new tags/foo page the first time the \[[!tag foo]] directive is used. See [[todo/auto-create_tag_pages_according_to_a_template]] for more discussion on this idea. > -- [[KathrynAndersen]] + +> Update: Ikiwiki can auto-create tags now, though it only defaults to +> doing so when tagbase is set. --[[Joey]] -- cgit v1.2.3 From 8eac7c2ad4966bdf2a1ea003df9e356da4c4e6bd Mon Sep 17 00:00:00 2001 From: "http://seph.myopenid.com/" Date: Thu, 22 Apr 2010 19:15:42 +0000 Subject: --- doc/ikiwiki/directive/map/discussion.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/map/discussion.mdwn b/doc/ikiwiki/directive/map/discussion.mdwn index f6eaa6b80..a39862347 100644 --- a/doc/ikiwiki/directive/map/discussion.mdwn +++ b/doc/ikiwiki/directive/map/discussion.mdwn @@ -83,3 +83,9 @@ Is there any way to do that? I don't mind mucking around with `\[[!meta]]` on e >>> I think that the ideas and code in >>> [[todo/tracking_bugs_with_dependencies]] might also handle this case. >>> --[[Joey]] + +---- + +I feel like this should be obvious, but I can't figure out how to sort numerically. + +I have `map pages="./* and !*/Discussion and !*/sidebar"` and a bunch of pages with names like 1, 2, 3, 11, 12, 1/1.1, 12/12.3 etc. I want to sort them numerically. I see lots of conversation implying there's a simple way to do it, but not how. -- cgit v1.2.3 From 418670c7e85ca32252b82b505ba6bb907229306e Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Thu, 22 Apr 2010 19:28:31 +0000 Subject: map can't currently change sort ordering --- doc/ikiwiki/directive/map/discussion.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/map/discussion.mdwn b/doc/ikiwiki/directive/map/discussion.mdwn index a39862347..b7ac17b1a 100644 --- a/doc/ikiwiki/directive/map/discussion.mdwn +++ b/doc/ikiwiki/directive/map/discussion.mdwn @@ -89,3 +89,9 @@ Is there any way to do that? I don't mind mucking around with `\[[!meta]]` on e I feel like this should be obvious, but I can't figure out how to sort numerically. I have `map pages="./* and !*/Discussion and !*/sidebar"` and a bunch of pages with names like 1, 2, 3, 11, 12, 1/1.1, 12/12.3 etc. I want to sort them numerically. I see lots of conversation implying there's a simple way to do it, but not how. + +> No, you can't: map can't currently use a non-default sort order. If it +> could, then you could use [[plugins/sortnaturally]]. There's a +> [[feature_request|todo/sort_parameter_for_map_plugin_and_directive]]; +> [[a_bug_references_it|bugs/map_sorts_by_pagename_and_not_title_when_show=title_is_used]]. +> --[[smcv]] -- cgit v1.2.3 From 83703d2f4a8832155e3c111792489062ccc4793b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Apr 2010 15:32:39 -0400 Subject: move template documentation to the template directive allow new templates to be created via the inline that lists them --- doc/ikiwiki/directive/template.mdwn | 71 ++++++++++++++++++++++++++++++-- doc/templates.mdwn | 82 ++----------------------------------- 2 files changed, 71 insertions(+), 82 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/template.mdwn b/doc/ikiwiki/directive/template.mdwn index d538b69b1..ae71ba5b5 100644 --- a/doc/ikiwiki/directive/template.mdwn +++ b/doc/ikiwiki/directive/template.mdwn @@ -5,14 +5,79 @@ wiki, by using the template directive. The directive has an `id` parameter that identifies the template to use. The remaining parameters are used to fill out the template. -Example: +## Example \[[!template id=note text="""Here is the text to insert into my note."""]] This fills out the `note` template, filling in the `text` field with the specified value, and inserts the result into the page. -For a list of available templates, and details about how to create more, -see the [[templates]] page. +## Using a template + +Generally, a value can include any markup that would be allowed in the wiki +page outside the template. Triple-quoting the value even allows quotes to +be included in it. Combined with multi-line quoted values, this allows for +large chunks of marked up text to be embedded into a template: + + \[[!template id=foo name="Sally" color="green" age=8 notes=""" + * \[[Charley]]'s sister. + * "I want to be an astronaut when I grow up." + * Really 8 and a half. + """]] + +## Creating a template + +The template is a regular wiki page, located in the `templates/` +subdirectory inside the source directory of the wiki. + +(Alternatively, templates can be stored in a directory outside the wiki, +as files with the extension ".tmpl". +By default, these are searched for in `/usr/share/ikiwiki/templates`; +the `templatedir` setting can be used to make another directory be searched +first.) + +The template uses the syntax used by the [[!cpan HTML::Template]] perl +module, which allows for some fairly complex things to be done. Consult its +documentation for the full syntax, but all you really need to know are a +few things: + +* Each parameter you pass to the template directive will generate a + template variable. There are also some pre-defined variables like PAGE + and BASENAME. +* To insert the value of a variable, use ``. Wiki markup + in the value will first be converted to html. +* To insert the raw value of a variable, with wiki markup not yet converted + to html, 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` + +Here's a sample template: + + + Name: \[[]]
+ Age:
+ + Favorite color:
+ + No favorite color.
+
+ +
+ +
+
+ +The filled out template will be formatted the same as the rest of the page +that contains it, so you can include WikiLinks and all other forms of wiki +markup in the template. Note though that such WikiLinks will not show up as +backlinks to the page that uses the template. + +Note the use of "raw_name" inside the [[ikiwiki/WikiLink]] generator in the +example above. This ensures that if the name contains something that might +be mistaken for wiki markup, it's not converted to html before being +processed as a [[ikiwiki/WikiLink]]. + [[!meta robots="noindex, follow"]] diff --git a/doc/templates.mdwn b/doc/templates.mdwn index 07531ae98..f2b581d2f 100644 --- a/doc/templates.mdwn +++ b/doc/templates.mdwn @@ -9,85 +9,9 @@ wiki. [[!if test="enabled(template) and enabled(inline)" then=""" -These templates are available for inclusion onto other pages in this -wiki: +These templates are available for use with the template directive. [[!inline pages="templates/* and !*/discussion" feeds=no archive=yes -sort=title template=titlepage]] +sort=title template=titlepage +rootpage=templates postformtext="Add a new template named:"]] """]] - -## Using a template - -Using a template works like this: - - \[[!template id=note text="""Here is the text to insert into my note."""]] - -This fills out the [[note]] template, filling in the `text` field with -the specified value, and inserts the result into the page. - -Generally, a value can include any markup that would be allowed in the wiki -page outside the template. Triple-quoting the value even allows quotes to -be included in it. Combined with multi-line quoted values, this allows for -large chunks of marked up text to be embedded into a template: - - \[[!template id=foo name="Sally" color="green" age=8 notes=""" - * \[[Charley]]'s sister. - * "I want to be an astronaut when I grow up." - * Really 8 and a half. - """]] - -## Creating a template - -To create a template, simply add a template directive to a page, and the -page will provide a link that can be used to create the template. The template -is a regular wiki page, located in the `templates/` subdirectory inside -the source directory of the wiki. - -(Alternatively, templates can be stored in a directory outside the wiki, -as files with the extension ".tmpl". -By default, these are searched for in `/usr/share/ikiwiki/templates`; -the `templatedir` setting can be used to make another directory be searched -first.) - -The template uses the syntax used by the [[!cpan HTML::Template]] perl -module, which allows for some fairly complex things to be done. Consult its -documentation for the full syntax, but all you really need to know are a -few things: - -* Each parameter you pass to the template directive will generate a - template variable. There are also some pre-defined variables like PAGE - and BASENAME. -* To insert the value of a variable, use ``. Wiki markup - in the value will first be converted to html. -* To insert the raw value of a variable, with wiki markup not yet converted - to html, 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` - -Here's a sample template: - - - Name: \[[]]
- Age:
- - Favorite color:
- - No favorite color.
-
- -
- -
-
- -The filled out template will be formatted the same as the rest of the page -that contains it, so you can include WikiLinks and all other forms of wiki -markup in the template. Note though that such WikiLinks will not show up as -backlinks to the page that uses the template. - -Note the use of "raw_name" inside the [[ikiwiki/WikiLink]] generator. This -ensures that if the name contains something that might be mistaken for wiki -markup, it's not converted to html before being processed as a -[[ikiwiki/WikiLink]]. -- cgit v1.2.3 From d822e37d0efc34f2267f275030de11cd3c7ff7bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Apr 2010 15:32:39 -0400 Subject: move template documentation to the template directive allow new templates to be created via the inline that lists them (cherry picked from commit 83703d2f4a8832155e3c111792489062ccc4793b) --- doc/ikiwiki/directive/template.mdwn | 71 ++++++++++++++++++++++++++++++-- doc/templates.mdwn | 82 ++----------------------------------- 2 files changed, 71 insertions(+), 82 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/template.mdwn b/doc/ikiwiki/directive/template.mdwn index d538b69b1..ae71ba5b5 100644 --- a/doc/ikiwiki/directive/template.mdwn +++ b/doc/ikiwiki/directive/template.mdwn @@ -5,14 +5,79 @@ wiki, by using the template directive. The directive has an `id` parameter that identifies the template to use. The remaining parameters are used to fill out the template. -Example: +## Example \[[!template id=note text="""Here is the text to insert into my note."""]] This fills out the `note` template, filling in the `text` field with the specified value, and inserts the result into the page. -For a list of available templates, and details about how to create more, -see the [[templates]] page. +## Using a template + +Generally, a value can include any markup that would be allowed in the wiki +page outside the template. Triple-quoting the value even allows quotes to +be included in it. Combined with multi-line quoted values, this allows for +large chunks of marked up text to be embedded into a template: + + \[[!template id=foo name="Sally" color="green" age=8 notes=""" + * \[[Charley]]'s sister. + * "I want to be an astronaut when I grow up." + * Really 8 and a half. + """]] + +## Creating a template + +The template is a regular wiki page, located in the `templates/` +subdirectory inside the source directory of the wiki. + +(Alternatively, templates can be stored in a directory outside the wiki, +as files with the extension ".tmpl". +By default, these are searched for in `/usr/share/ikiwiki/templates`; +the `templatedir` setting can be used to make another directory be searched +first.) + +The template uses the syntax used by the [[!cpan HTML::Template]] perl +module, which allows for some fairly complex things to be done. Consult its +documentation for the full syntax, but all you really need to know are a +few things: + +* Each parameter you pass to the template directive will generate a + template variable. There are also some pre-defined variables like PAGE + and BASENAME. +* To insert the value of a variable, use ``. Wiki markup + in the value will first be converted to html. +* To insert the raw value of a variable, with wiki markup not yet converted + to html, 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` + +Here's a sample template: + + + Name: \[[]]
+ Age:
+ + Favorite color:
+ + No favorite color.
+
+ +
+ +
+
+ +The filled out template will be formatted the same as the rest of the page +that contains it, so you can include WikiLinks and all other forms of wiki +markup in the template. Note though that such WikiLinks will not show up as +backlinks to the page that uses the template. + +Note the use of "raw_name" inside the [[ikiwiki/WikiLink]] generator in the +example above. This ensures that if the name contains something that might +be mistaken for wiki markup, it's not converted to html before being +processed as a [[ikiwiki/WikiLink]]. + [[!meta robots="noindex, follow"]] diff --git a/doc/templates.mdwn b/doc/templates.mdwn index 07531ae98..f2b581d2f 100644 --- a/doc/templates.mdwn +++ b/doc/templates.mdwn @@ -9,85 +9,9 @@ wiki. [[!if test="enabled(template) and enabled(inline)" then=""" -These templates are available for inclusion onto other pages in this -wiki: +These templates are available for use with the template directive. [[!inline pages="templates/* and !*/discussion" feeds=no archive=yes -sort=title template=titlepage]] +sort=title template=titlepage +rootpage=templates postformtext="Add a new template named:"]] """]] - -## Using a template - -Using a template works like this: - - \[[!template id=note text="""Here is the text to insert into my note."""]] - -This fills out the [[note]] template, filling in the `text` field with -the specified value, and inserts the result into the page. - -Generally, a value can include any markup that would be allowed in the wiki -page outside the template. Triple-quoting the value even allows quotes to -be included in it. Combined with multi-line quoted values, this allows for -large chunks of marked up text to be embedded into a template: - - \[[!template id=foo name="Sally" color="green" age=8 notes=""" - * \[[Charley]]'s sister. - * "I want to be an astronaut when I grow up." - * Really 8 and a half. - """]] - -## Creating a template - -To create a template, simply add a template directive to a page, and the -page will provide a link that can be used to create the template. The template -is a regular wiki page, located in the `templates/` subdirectory inside -the source directory of the wiki. - -(Alternatively, templates can be stored in a directory outside the wiki, -as files with the extension ".tmpl". -By default, these are searched for in `/usr/share/ikiwiki/templates`; -the `templatedir` setting can be used to make another directory be searched -first.) - -The template uses the syntax used by the [[!cpan HTML::Template]] perl -module, which allows for some fairly complex things to be done. Consult its -documentation for the full syntax, but all you really need to know are a -few things: - -* Each parameter you pass to the template directive will generate a - template variable. There are also some pre-defined variables like PAGE - and BASENAME. -* To insert the value of a variable, use ``. Wiki markup - in the value will first be converted to html. -* To insert the raw value of a variable, with wiki markup not yet converted - to html, 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` - -Here's a sample template: - - - Name: \[[]]
- Age:
- - Favorite color:
- - No favorite color.
-
- -
- -
-
- -The filled out template will be formatted the same as the rest of the page -that contains it, so you can include WikiLinks and all other forms of wiki -markup in the template. Note though that such WikiLinks will not show up as -backlinks to the page that uses the template. - -Note the use of "raw_name" inside the [[ikiwiki/WikiLink]] generator. This -ensures that if the name contains something that might be mistaken for wiki -markup, it's not converted to html before being processed as a -[[ikiwiki/WikiLink]]. -- 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/ikiwiki/directive') 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 f52f395437a946478da2a126015c05e3e0afdc1f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 May 2010 21:08:41 -0400 Subject: consistently drop NAME= in templates also add template syntax smoke test --- doc/ikiwiki/directive/template.mdwn | 8 ++--- doc/templates.mdwn | 4 +-- doc/templates/gitbranch.mdwn | 2 +- doc/templates/note.mdwn | 2 +- doc/templates/plugin.mdwn | 2 +- doc/templates/popup.mdwn | 2 +- templates/aggregatepost.tmpl | 18 +++++------ templates/archivepage.tmpl | 6 ++-- templates/atomitem.tmpl | 24 +++++++------- templates/atompage.tmpl | 10 +++--- templates/blogpost.tmpl | 8 ++--- templates/change.tmpl | 18 +++++------ templates/comment.tmpl | 30 ++++++++--------- templates/commentmoderation.tmpl | 4 +-- templates/editcomment.tmpl | 12 +++---- templates/editpage.tmpl | 12 +++---- templates/feedlink.tmpl | 8 ++--- templates/googleform.tmpl | 1 + templates/inlinepage.tmpl | 18 +++++------ templates/microblog.tmpl | 4 +-- templates/page.tmpl | 64 ++++++++++++++++++------------------- templates/pocreatepage.tmpl | 4 +-- templates/renamesummary.tmpl | 4 +-- templates/rssitem.tmpl | 14 ++++---- templates/titlepage.tmpl | 2 +- 25 files changed, 141 insertions(+), 140 deletions(-) (limited to 'doc/ikiwiki/directive') diff --git a/doc/ikiwiki/directive/template.mdwn b/doc/ikiwiki/directive/template.mdwn index 052ca7873..6c50fa32e 100644 --- a/doc/ikiwiki/directive/template.mdwn +++ b/doc/ikiwiki/directive/template.mdwn @@ -53,21 +53,21 @@ few things: * To insert the raw value of a variable, with wiki markup not yet converted to html, use ``. * To make a block of text conditional on a variable being set use - `text`. + `text`. * To use one block of text if a variable is set and a second if it's not, - use `textother text` + use `textother text` Here's a sample template: Name: \[[]]
Age:
- + Favorite color:
No favorite color.
- +
diff --git a/doc/templates.mdwn b/doc/templates.mdwn index 2444cf14d..8f6561fcf 100644 --- a/doc/templates.mdwn +++ b/doc/templates.mdwn @@ -12,9 +12,9 @@ easy to learn. All you really need to know to modify templates is this: * To insert the value of a template variable, use ``. * To make a block of text conditional on a variable being set use - `text`. + `text`. * To use one block of text if a variable is set and a second if it's not, - use `textother text` + use `textother text` [[!if test="enabled(template)" then=""" ## template pages diff --git a/doc/templates/gitbranch.mdwn b/doc/templates/gitbranch.mdwn index fcce925d9..962420940 100644 --- a/doc/templates/gitbranch.mdwn +++ b/doc/templates/gitbranch.mdwn @@ -3,7 +3,7 @@ Available in a [[!taglink /git]] repository.
Branch:
Author:
- + This template is used to create an infobox for a git branch. It uses these parameters: diff --git a/doc/templates/note.mdwn b/doc/templates/note.mdwn index 4cc323c0e..9ef5ad942 100644 --- a/doc/templates/note.mdwn +++ b/doc/templates/note.mdwn @@ -1,7 +1,7 @@
- + Use this template to insert a note into a page. The note will be styled to float to the right of other text on the page. This template has one parameter: diff --git a/doc/templates/plugin.mdwn b/doc/templates/plugin.mdwn index c1d1974d6..322c49445 100644 --- a/doc/templates/plugin.mdwn +++ b/doc/templates/plugin.mdwn @@ -8,7 +8,7 @@ Currently enabled: [[!if test="enabled()" then="yes" else="no"]]< [[!if test="sourcepage(plugins/contrib/*)" then="""[[!meta title=" (third party plugin)"]]"""]] [[!tag plugins/type/core]] - + This template is used to create an infobox for an ikiwiki plugin. It uses these parameters:
    diff --git a/doc/templates/popup.mdwn b/doc/templates/popup.mdwn index b355daa2e..92455eb21 100644 --- a/doc/templates/popup.mdwn +++ b/doc/templates/popup.mdwn @@ -1,4 +1,4 @@ - + Use this template to create a popup window that is displayed when the mouse is over part of the page. This template has two parameters:
      diff --git a/templates/aggregatepost.tmpl b/templates/aggregatepost.tmpl index 8b8936733..4e89efe32 100644 --- a/templates/aggregatepost.tmpl +++ b/templates/aggregatepost.tmpl @@ -1,15 +1,15 @@ - + [[!tag ]] - -[[!meta title=""]] + +[[!meta title=""]] - -[[!meta permalink=""]] + +[[!meta permalink=""]] - -[[!meta copyright=""]] + +[[!meta copyright=""]] -[[!meta author=""]] -[[!meta authorurl=""]] +[[!meta author=""]] +[[!meta authorurl=""]] diff --git a/templates/archivepage.tmpl b/templates/archivepage.tmpl index 28800e763..93bdd9ce0 100644 --- a/templates/archivepage.tmpl +++ b/templates/archivepage.tmpl @@ -1,14 +1,14 @@

      - +

      Posted - + by - + diff --git a/templates/atomitem.tmpl b/templates/atomitem.tmpl index 87cbee9e0..4ed17bc62 100644 --- a/templates/atomitem.tmpl +++ b/templates/atomitem.tmpl @@ -1,17 +1,17 @@ <TMPL_VAR TITLE> - + - + - + - + @@ -19,30 +19,30 @@ - + - - + + - + - - " type="text/html" /> + + - - " type="application/atom+xml" /> + + diff --git a/templates/atompage.tmpl b/templates/atompage.tmpl index fc0088ae8..e82b59827 100644 --- a/templates/atompage.tmpl +++ b/templates/atompage.tmpl @@ -5,15 +5,15 @@ - + - + - + @@ -21,13 +21,13 @@ - + - + diff --git a/templates/blogpost.tmpl b/templates/blogpost.tmpl index 7eeede603..5a31e3f8a 100644 --- a/templates/blogpost.tmpl +++ b/templates/blogpost.tmpl @@ -1,10 +1,10 @@

      - -RSS + +RSS - -Atom + +Atom diff --git a/templates/change.tmpl b/templates/change.tmpl index 5f277a0fb..671b9e483 100644 --- a/templates/change.tmpl +++ b/templates/change.tmpl @@ -2,15 +2,15 @@ [[!meta authorurl=""""""]] -[[!meta title="""change to on """]] +[[!meta title="""change to on """]] [[!meta permalink=""]]
      - - -
      + + +
      - +
      -
      +
       
      diff --git a/templates/comment.tmpl b/templates/comment.tmpl index 39cba0ff9..fa90e6d26 100644 --- a/templates/comment.tmpl +++ b/templates/comment.tmpl @@ -1,5 +1,5 @@ -
      -
      +
      +
      @@ -15,40 +15,40 @@
      Comment by - - + + - + - - + + - + - - + + - - + + - +
      - +