From d73eb7d9b2569ebb44fc79480b6ec2d8c1faea5d Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 31 Mar 2007 06:55:12 +0000 Subject: [PATCH] * Add a templates page to the basewiki. It will automatically list all available templates. Rename the old templates page to wikitemplates. * Include the note template in the basewiki. * Add a popup template in the basewiki. CSS based on some by Martin Krafft. * Make the note, popup, and plugin templates detect missing variables and be self-documenting, listing the available variables. --- basewiki/templates.mdwn | 1 + basewiki/templates/note.mdwn | 1 + basewiki/templates/popup.mdwn | 1 + debian/changelog | 10 ++++-- doc/features.mdwn | 6 ++-- doc/freesoftware.mdwn | 4 +-- doc/plugins/inline.mdwn | 2 +- doc/plugins/search.mdwn | 4 +-- doc/plugins/template.mdwn | 6 +++- doc/style.css | 63 ++++++++++++++++++++++++----------- doc/templates.mdwn | 58 ++++---------------------------- doc/templates/note.mdwn | 8 +++++ doc/templates/plugin.mdwn | 9 +++++ doc/templates/popup.mdwn | 16 +++++++++ doc/todo/html.mdwn | 2 +- doc/usage.mdwn | 4 +-- doc/wikitemplates.mdwn | 53 +++++++++++++++++++++++++++++ mdwn2man | 2 +- po/ikiwiki.pot | 2 +- 19 files changed, 166 insertions(+), 86 deletions(-) create mode 120000 basewiki/templates.mdwn create mode 120000 basewiki/templates/note.mdwn create mode 120000 basewiki/templates/popup.mdwn create mode 100644 doc/templates/popup.mdwn create mode 100644 doc/wikitemplates.mdwn diff --git a/basewiki/templates.mdwn b/basewiki/templates.mdwn new file mode 120000 index 000000000..414cb4233 --- /dev/null +++ b/basewiki/templates.mdwn @@ -0,0 +1 @@ +../doc/templates.mdwn \ No newline at end of file diff --git a/basewiki/templates/note.mdwn b/basewiki/templates/note.mdwn new file mode 120000 index 000000000..40337b9b1 --- /dev/null +++ b/basewiki/templates/note.mdwn @@ -0,0 +1 @@ +../../doc/templates/note.mdwn \ No newline at end of file diff --git a/basewiki/templates/popup.mdwn b/basewiki/templates/popup.mdwn new file mode 120000 index 000000000..9391631f6 --- /dev/null +++ b/basewiki/templates/popup.mdwn @@ -0,0 +1 @@ +../../doc/templates/popup.mdwn \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index b39fa95b9..fb310dd5e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,14 @@ ikiwiki (1.49) UNRELEASED; urgency=low real post-commit hook that sshs back to the web server, and runs ikiwiki in post-commit mode to update the wiki. * Fix urls generated by mirrorlist plugin. - - -- Joey Hess Fri, 30 Mar 2007 20:40:35 -0400 + * Add a templates page to the basewiki. It will automatically list all + available templates. Rename the old templates page to wikitemplates. + * Include the note template in the basewiki. + * Add a popup template in the basewiki. CSS based on some by Martin Krafft. + * Make the note, popup, and plugin templates detect missing variables and be + self-documenting, listing the available variables. + + -- Joey Hess Sat, 31 Mar 2007 02:23:46 -0400 ikiwiki (1.48) unstable; urgency=low diff --git a/doc/features.mdwn b/doc/features.mdwn index 26a98295b..551edf811 100644 --- a/doc/features.mdwn +++ b/doc/features.mdwn @@ -68,9 +68,9 @@ you would care to syndicate. ## Valid html and [[css]] ikiwiki aims to produce -[valid XHTML 1.0](http://validator.w3.org/check?url=referer). -ikiwiki generates html using [[templates]], and uses [[css]], so you can -change the look and layout of all pages in any way you would like. +[valid XHTML 1.0](http://validator.w3.org/check?url=referer). ikiwiki +generates html using [[templates|wikitemplates]], 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 96293c90e..2b3a0af0c 100644 --- a/doc/freesoftware.mdwn +++ b/doc/freesoftware.mdwn @@ -3,6 +3,6 @@ ikiwiki is 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 -and the [[templates]]) are licensed as follows: Redistribution and use in -source and compiled forms, with or without modification, are permitted under +and the [[templates|wikitemplates]]) are licensed as follows: Redistribution and +use in source and compiled forms, with or without modification, are permitted under any circumstances. No warranty. diff --git a/doc/plugins/inline.mdwn b/doc/plugins/inline.mdwn index fd894baa1..3b1aaf0a0 100644 --- a/doc/plugins/inline.mdwn +++ b/doc/plugins/inline.mdwn @@ -37,7 +37,7 @@ directive: * `quick` - Build archives in quick mode, without reading page contents for metadata. By default, this also turns off generation of any feeds. * `template` - Specifies the template to fill out to display each inlined - page. By default the `inlinepage` [[template|templates]] is used, while + page. By default the `inlinepage` [[template|wikitemplates]] is used, while the `archivepage` template is used for archives. Set this parameter to use some other, custom template, such as the `titlepage` template that only shows post titles. Note that you should still set `archive=yes` if diff --git a/doc/plugins/search.mdwn b/doc/plugins/search.mdwn index b324251bf..7b32714f4 100644 --- a/doc/plugins/search.mdwn +++ b/doc/plugins/search.mdwn @@ -5,8 +5,8 @@ This plugin is included in ikiwiki, but is not enabled by default. It adds full text search to ikiwiki, using the [[HyperEstraier]] engine. It's possible to configure HyperEstraier via one of ikiwiki's -[[templates]], but for most users, no configuration should be needed aside -from enabling the plugin. +[[templates|wikitemplates]], but for most users, no configuration should be +needed aside from enabling the plugin. This plugin has a configuration option. To change the path to estseek.cgi, set `--estseek=/path/to/estseek.cgi` diff --git a/doc/plugins/template.mdwn b/doc/plugins/template.mdwn index 98188d7dc..4efab57e3 100644 --- a/doc/plugins/template.mdwn +++ b/doc/plugins/template.mdwn @@ -23,9 +23,13 @@ large chunks of marked up text to be embedded into a template: * Really 8 and a half. """]] +Some templates are included in the wiki by default; these are listed in the +[[templates]] page. + To create a template, make a page in the wiki named `template/foo`. Note that this is a different location than the directory used for the -[[templates]] used to build the wiki itself, which is not part of the wiki. +[[templates|wikitemplates]] used to build the wiki itself, which is not +part of the wiki. 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 diff --git a/doc/style.css b/doc/style.css index 0fc29f9e1..af460dd0d 100644 --- a/doc/style.css +++ b/doc/style.css @@ -161,25 +161,6 @@ td.changelog { padding: 2ex 2ex; } -.infobox { - float: right; - margin-left: 2ex; - margin-top: 1ex; - margin-bottom: 1ex; - padding: 1ex 1ex; - border: 1px solid #aaa; -} - -.notebox { - float: right; - margin-left: 2ex; - margin-top: 1ex; - margin-bottom: 1ex; - padding: 1ex 1ex; - border: 1px solid #aaa; - width: 25% -} - /* outlines */ li.L1 { list-style: upper-roman; @@ -236,3 +217,47 @@ input#openid_url { #blogform { display: none; } #backlinks { display: none; } } + +/* Provided for use by template plugin for floating info boxes. */ +.infobox { + float: right; + margin-left: 2ex; + margin-top: 1ex; + margin-bottom: 1ex; + padding: 1ex 1ex; + border: 1px solid #aaa; +} + +/* Provided for use by template plugin for floating note boxes. */ +.notebox { + float: right; + margin-left: 2ex; + margin-top: 1ex; + margin-bottom: 1ex; + padding: 1ex 1ex; + border: 1px solid #aaa; + width: 25% +} + +/* Used by the popup template. */ +.popup { + border-bottom: 1px dotted #366; + color: #366; +} +.popup .balloon, +.popup .paren { + display: none; +} +.popup:hover .balloon, +.popup:focus .balloon { + position: absolute; + display: inline; + margin: 1em 0 0 -2em; + padding: 0.625em; + border: 2px solid; + background-color: #dee; + color: black; + opacity: 0.95; + -moz-opacity: 0.95; + filter: alpha(opacity=95); +} diff --git a/doc/templates.mdwn b/doc/templates.mdwn index 1f98334c9..71bf8a47a 100644 --- a/doc/templates.mdwn +++ b/doc/templates.mdwn @@ -1,53 +1,9 @@ -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. +[[if test="enabled(template)" + then="This wiki has templates **enabled**." + else="This wiki has templates **disabled**."]] -The aim is to keep almost all html out of ikiwiki and in the templates. +These templates are available for inclusion onto other pages in this +wiki: -It ships with some basic templates which can be customised. These are -located in /usr/share/ikiwiki/templates by default. - -* `page.tmpl` - Used for displaying all regular wiki pages. -* `misc.tmpl` - Generic template used for any page that doesn't - have a custom template. -* `recentchanges.tmpl` - Used for the RecentChanges page. -* `editpage.tmpl` - Create/edit page. -* `notifymail.tmpl` - Not a html template, this is used to - generate change notification mails for users who have subscribed to - changes to a page. -* `passwordmail.tmpl` - Not a html template, this is used to - generate the mail with the user's password in it. -* `rsspage.tmpl` - Used for generating rss feeds for [[blog]]s. -* `rssitem.tmpl` - Used for generating individual items on rss feeds. -* `atompage.tmpl` - Used for generating atom feeds for [[blog]]s. -* `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. -* `estseek.conf` - Not a html template, this is actually a template for - a config file for the [[HyperEstraier]] search engine. If you like you - can read the [[HyperEstraier]] docs and configure it using this. -* `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. - -If you like, you can add these to further customise it: - -* `signin.tmpl` - If it exists, it is used for customising the - layout of the SignIn form and all assciated forms. The misc.tmpl is - wrapped around this, so it should only be a template for the form. -* `prefs.tmpl` - If it exists, it is used for customising the - layout of the Prefs form and all assciated forms. The misc.tmpl is - wrapped around this, so it should only be a template for the form. - -Note that the SignIn and Prefs forms are implemented using -CGI::FormBuilder, which interfaces to HTML::Template, so not all of it can -be customised with templates, although most of it can, by creating these -templates. Without the templates, CGI::FormBuilder creates the page bodies -by itself. - -The [[plugins/template]] plugin also uses templates, though those templates -are stored in the wiki. +[[inline pages="templates/* and !*/discussion" feeds=no archive=yes +sort=title template=titlepage]] diff --git a/doc/templates/note.mdwn b/doc/templates/note.mdwn index 2cbc230b3..d992e0236 100644 --- a/doc/templates/note.mdwn +++ b/doc/templates/note.mdwn @@ -1,3 +1,11 @@ + +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: +
    +
  • `text` - the text to display in the note +
+
diff --git a/doc/templates/plugin.mdwn b/doc/templates/plugin.mdwn index 5ce05b231..b4dabc341 100644 --- a/doc/templates/plugin.mdwn +++ b/doc/templates/plugin.mdwn @@ -7,3 +7,12 @@ Currently enabled: [[if test="enabled()" then="yes" else="no"]] [[if test="sourcepage(plugins/contrib/*)" then="""[[meta title=" (third party plugin)"]]"""]] [[tag type/core]] + +This template is used to create an infobox for an ikiwiki plugin. It uses +these parameters: +
    +
  • name - the name of the plugin +
  • author - the author of the plugin +
  • core - set to a true value if the plugin is enabled by default +
+
diff --git a/doc/templates/popup.mdwn b/doc/templates/popup.mdwn new file mode 100644 index 000000000..244c1d4dd --- /dev/null +++ b/doc/templates/popup.mdwn @@ -0,0 +1,16 @@ + +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: +
    +
  • `mouseover` - This is the text or other content that triggers the +popup. +
  • `popup` - This should be the content of the popup window. It can be +anything, even images or a whole little wiki page, but should not be too +large for good usability. +
+Note that browsers that do not support the CSS will display the popup +inline in the page, inside parens. +
+ +[] + diff --git a/doc/todo/html.mdwn b/doc/todo/html.mdwn index a99f87c8a..1c9fe0690 100644 --- a/doc/todo/html.mdwn +++ b/doc/todo/html.mdwn @@ -1,4 +1,4 @@ Create some nice(r) stylesheets. Should be doable w/o touching a single line of code, just -editing the [[templates]] and/or editing [[style.css]]. +editing the [[wikitemplates]] and/or editing [[style.css]]. diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 3102245b2..bb6f06aea 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -109,8 +109,8 @@ configuration options of their own. * --templatedir - Specify the directory that the page [[templates]] are stored in. Default - is `/usr/share/ikiwiki/templates`, or another location as configured at + Specify the directory that the page [[templates|wikitemplates]] 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. diff --git a/doc/wikitemplates.mdwn b/doc/wikitemplates.mdwn new file mode 100644 index 000000000..1f98334c9 --- /dev/null +++ b/doc/wikitemplates.mdwn @@ -0,0 +1,53 @@ +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. + +* `page.tmpl` - Used for displaying all regular wiki pages. +* `misc.tmpl` - Generic template used for any page that doesn't + have a custom template. +* `recentchanges.tmpl` - Used for the RecentChanges page. +* `editpage.tmpl` - Create/edit page. +* `notifymail.tmpl` - Not a html template, this is used to + generate change notification mails for users who have subscribed to + changes to a page. +* `passwordmail.tmpl` - Not a html template, this is used to + generate the mail with the user's password in it. +* `rsspage.tmpl` - Used for generating rss feeds for [[blog]]s. +* `rssitem.tmpl` - Used for generating individual items on rss feeds. +* `atompage.tmpl` - Used for generating atom feeds for [[blog]]s. +* `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. +* `estseek.conf` - Not a html template, this is actually a template for + a config file for the [[HyperEstraier]] search engine. If you like you + can read the [[HyperEstraier]] docs and configure it using this. +* `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. + +If you like, you can add these to further customise it: + +* `signin.tmpl` - If it exists, it is used for customising the + layout of the SignIn form and all assciated forms. The misc.tmpl is + wrapped around this, so it should only be a template for the form. +* `prefs.tmpl` - If it exists, it is used for customising the + layout of the Prefs form and all assciated forms. The misc.tmpl is + wrapped around this, so it should only be a template for the form. + +Note that the SignIn and Prefs forms are implemented using +CGI::FormBuilder, which interfaces to HTML::Template, so not all of it can +be customised with templates, although most of it can, by creating these +templates. Without the templates, CGI::FormBuilder creates the page bodies +by itself. + +The [[plugins/template]] plugin also uses templates, though those templates +are stored in the wiki. diff --git a/mdwn2man b/mdwn2man index e78a4d18c..86a524bd6 100755 --- a/mdwn2man +++ b/mdwn2man @@ -7,7 +7,7 @@ my $section=shift; print ".TH $prog $section\n"; while (<>) { - s{(\\?)\[\[([^\s\]]+)\]\]}{$1 ? "[[$2]]" : $2}eg; + s{(\\?)\[\[([^\s\|\]]+)(\|[^\s\]])?\]\]}{$1 ? "[[$2]]" : $2}eg; if (/^#\s/) { s/^#\s/.SH /; <>; # blank; diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 73a5356f7..43f869441 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-03-28 13:46-0400\n" +"POT-Creation-Date: 2007-03-31 02:06-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -- 2.39.5