our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
bestlink htmllink readfile writefile pagetype srcfile pagename
displaytime will_render gettext urlto targetpage
+ add_underlay
%config %links %renderedfiles %pagesources %destsources);
our $VERSION = 2.00; # plugin interface version, next is ikiwiki version
our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
pingurl => [],
templatedir => "$installdir/share/ikiwiki/templates",
underlaydir => "$installdir/share/ikiwiki/basewiki",
+ underlaydirs => [],
setup => undef,
adminuser => undef,
adminemail => undef,
my $file=shift;
return "$config{srcdir}/$file" if -e "$config{srcdir}/$file";
- return "$config{underlaydir}/$file" if -e "$config{underlaydir}/$file";
- error("internal error: $file cannot be found in $config{srcdir} or $config{underlaydir}");
+ foreach my $dir (@{$config{underlaydirs}}, $config{underlaydir}) {
+ return "$dir/$file" if -e "$dir/$file";
+ }
+ error("internal error: $file cannot be found in $config{srcdir} or underlay");
return;
} #}}}
+sub add_underlay ($) { #{{{
+ my $dir=shift;
+
+ if ($dir=~/^\//) {
+ unshift @{$config{underlaydirs}}, $dir;
+ }
+ else {
+ unshift @{$config{underlaydirs}}, "$config{underlaydir}/../$dir";
+ }
+
+ return 1;
+} #}}}
+
sub readfile ($;$$) { #{{{
my $file=shift;
my $binary=shift;
# characters.
my ($page)=$form->field('page');
$page=titlepage(possibly_foolish_untaint($page));
- if (! defined $page || ! length $page || file_pruned($page, $config{srcdir}) || $page=~/^\//) {
+ if (! defined $page || ! length $page ||
+ file_pruned($page, $config{srcdir}) || $page=~/^\//) {
error("bad page name");
}
my $exists=-e "$config{srcdir}/$file";
- if ($form->field("do") ne "create" &&
- ! $exists && ! -e "$config{underlaydir}/$file") {
+ if ($form->field("do") ne "create" && ! $exists &&
+ ! eval { srcfile($file) }) {
$form->tmpl_param("page_gone", 1);
$form->field(name => "do", value => "create", force => 1);
$form->tmpl_param("page_select", 0);
my $smiley_regexp;
sub import { #{{{
+ add_underlay("smiley");
hook(type => "filter", id => "smiley", call => \&filter);
} # }}}
}
},
}, $config{srcdir});
- find({
- no_chdir => 1,
- wanted => sub {
- $_=decode_utf8($_);
- if (file_pruned($_, $config{underlaydir})) {
- $File::Find::prune=1;
- }
- elsif (! -d $_ && ! -l $_) {
- my ($f)=/$config{wiki_file_regexp}/; # untaint
- if (! defined $f) {
- warn(sprintf(gettext("skipping bad filename %s"), $_)."\n");
+ foreach my $dir (@{$config{underlaydirs}}, $config{underlaydir}) {
+ find({
+ no_chdir => 1,
+ wanted => sub {
+ $_=decode_utf8($_);
+ if (file_pruned($_, $dir)) {
+ $File::Find::prune=1;
}
- else {
- # Don't add pages that are in the
- # srcdir.
- $f=~s/^\Q$config{underlaydir}\E\/?//;
- if (! -e "$config{srcdir}/$f" &&
- ! -l "$config{srcdir}/$f") {
- my $page=pagename($f);
- if (! $exists{$page}) {
- push @files, $f;
- $exists{$page}=1;
+ elsif (! -d $_ && ! -l $_) {
+ my ($f)=/$config{wiki_file_regexp}/; # untaint
+ if (! defined $f) {
+ warn(sprintf(gettext("skipping bad filename %s"), $_)."\n");
+ }
+ else {
+ $f=~s/^\Q$dir\E\/?//;
+ # avoid underlaydir
+ # override attacks; see
+ # security.mdwn
+ if (! -e "$config{srcdir}/$f" &&
+ ! -l "$config{srcdir}/$f") {
+ my $page=pagename($f);
+ if (! $exists{$page}) {
+ push @files, $f;
+ $exists{$page}=1;
+ }
}
}
}
- }
- },
- }, $config{underlaydir});
+ },
+ }, $dir);
+ };
my %rendered;
extra_build: ikiwiki.out
LANG= perl -I. $(extramodules) $(tflag) ikiwiki.out doc html --templatedir=templates \
- --underlaydir=basewiki --nousedirs\
+ --underlaydir=underlays/basewiki --nousedirs\
--wikiname="ikiwiki" --verbose \
--exclude=/discussion --no-discussion --userdir=users \
--plugin=goodstuff \
extra_install:
install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
- for dir in `find basewiki templates -follow -type d ! -regex '.*\.svn.*'`; do \
+ for dir in `cd underlays && find . -follow -type d ! -regex '.*\.svn.*'`; do \
+ install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
+ for file in `find underlays/$$dir -follow -maxdepth 1 -type f`; do \
+ install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
+ done; \
+ done
+ for dir in `find templates -follow -type d ! -regex '.*\.svn.*'`; do \
install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
for file in `find $$dir -follow -maxdepth 1 -type f`; do \
install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
+++ /dev/null
-../doc/blog.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/favicon.ico
\ No newline at end of file
+++ /dev/null
-../doc/helponformatting.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/basewiki/index.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/local.css
\ No newline at end of file
+++ /dev/null
-../doc/markdown.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/openid.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/pagespec.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/preprocessordirective.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/basewiki/sandbox.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/shortcuts.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/smileys
\ No newline at end of file
+++ /dev/null
-../doc/smileys.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/style.css
\ No newline at end of file
+++ /dev/null
-../doc/subpage
\ No newline at end of file
+++ /dev/null
-../doc/subpage.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/templates.mdwn
\ No newline at end of file
+++ /dev/null
-../../doc/templates/note.mdwn
\ No newline at end of file
+++ /dev/null
-../../doc/templates/popup.mdwn
\ No newline at end of file
+++ /dev/null
-../doc/wikiicons
\ No newline at end of file
+++ /dev/null
-../doc/wikilink.mdwn
\ No newline at end of file
-ikiwiki (2.6.2) UNRELEASED; urgency=low
+ikiwiki (2.7) UNRELEASED; urgency=low
* Add an editcontent hook.
+ * Support for looking in multiple directories for underlay files.
+ * Plugins can add new directories to the search path with the add_underlay
+ function.
+ * Split out smiley underlay files into a separate underlay, so if the plugin
+ isn't used, the wiki isn't bloated with all those files.
- -- Joey Hess <joeyh@debian.org> Sun, 26 Aug 2007 16:50:24 -0400
+ -- Joey Hess <joeyh@debian.org> Mon, 27 Aug 2007 20:48:51 -0400
ikiwiki (2.6.1) unstable; urgency=low
* [[pagespec]]
* [[PreprocessorDirective]]
* [[shortcuts]]
-* [[smileys]]
* [[subpage]]
* [[wikilink]]
* `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|wikitemplates]] is used, while
+ page. By default the `inlinepage` template 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
--- /dev/null
+The [[plugin/brokenlinks]] plugin falsely complains that
+[[helponformatting]] has a broken link to [[smileys]], if the smiley plgin
+is disabled. While the helponformatting page links to it inside a
+conditional, and so doesn't show the link in this case, ikiwiki scans for
+links w/o looking at conditionals and so still thinks the page contains the
+link.
#### `srcfile($)`
Given the name of a source file in the wiki, searches for the file in
-the source directory and the underlay directory, and returns the full
-path to the first file found.
+the source directory and the underlay directories (most recently added
+underlays first), and returns the full path to the first file found.
+
+#### `add_underlay($)`
+
+Adds a directory to the set of underlay directories that ikiwiki will
+search for files.
+
+If the directory name is not absolute, ikiwiki will assume it is in
+the parent directory of the configured underlaydir.
#### `displaytime($)`
-[[if test="enabled(smiley)"
- then="This wiki has smileys **enabled**."
- else="This wiki has smileys **disabled**."]]
-
This page is used to control what smileys are supported by the wiki.
Just write the text of a smiley to display it.
> plugins were enabled.
>
> Using the conditionals in a page to control what other pages get built
-> feels complex to me, --[[Joey]]
+> feels complex to me.
+>
+> Instead, this has been implmented as the `add_underlay()` function.
+> [[done]]
+> --[[Joey]]
+
you have something pretty specific in mind. I can talk to you about that more
on IRC later(assuming my internet is working right).
* Basically the idea is to change `$config{underlaydir}` to an array..
+ Ok, take a look at the new `add_underlay()` function. You can now just
+ `add_underlay("wikiwyg")` and it'll look in
+ /usr/share/ikiwiki/wikiwyg/ for the files.
* When is the WIKIWYG variable in misc.tmpl used?
* The WIKIWYG variable in misc.tmpl is used for the edit page. I believe that is what
you wanted me to do (Check [Revision 3840][]).
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-08-26 13:39-0400\n"
+"POT-Creation-Date: 2007-08-27 21:24-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "Preferences saved."
msgstr ""
-#: ../IkiWiki/CGI.pm:353
+#: ../IkiWiki/CGI.pm:354
#, perl-format
msgid "%s is not an editable page"
msgstr ""
-#: ../IkiWiki/CGI.pm:432 ../IkiWiki/Plugin/brokenlinks.pm:24
+#: ../IkiWiki/CGI.pm:441 ../IkiWiki/Plugin/brokenlinks.pm:24
#: ../IkiWiki/Plugin/inline.pm:209 ../IkiWiki/Plugin/opendiscussion.pm:17
#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:99
#: ../IkiWiki/Render.pm:179
msgid "discussion"
msgstr ""
-#: ../IkiWiki/CGI.pm:478
+#: ../IkiWiki/CGI.pm:487
#, perl-format
msgid "creating %s"
msgstr ""
-#: ../IkiWiki/CGI.pm:496 ../IkiWiki/CGI.pm:514 ../IkiWiki/CGI.pm:524
-#: ../IkiWiki/CGI.pm:550 ../IkiWiki/CGI.pm:594
+#: ../IkiWiki/CGI.pm:505 ../IkiWiki/CGI.pm:523 ../IkiWiki/CGI.pm:533
+#: ../IkiWiki/CGI.pm:566 ../IkiWiki/CGI.pm:610
#, perl-format
msgid "editing %s"
msgstr ""
-#: ../IkiWiki/CGI.pm:688
+#: ../IkiWiki/CGI.pm:704
msgid "You are banned."
msgstr ""
-#: ../IkiWiki/CGI.pm:708
+#: ../IkiWiki/CGI.pm:724
msgid "login failed, perhaps you need to turn on cookies?"
msgstr ""
msgid "shortcut %s points to <i>%s</i>"
msgstr ""
-#: ../IkiWiki/Plugin/smiley.pm:22
+#: ../IkiWiki/Plugin/smiley.pm:23
msgid "failed to parse any smileys"
msgstr ""
"notifications"
msgstr ""
-#: ../IkiWiki/Render.pm:263 ../IkiWiki/Render.pm:283
+#: ../IkiWiki/Render.pm:263 ../IkiWiki/Render.pm:284
#, perl-format
msgid "skipping bad filename %s"
msgstr ""
-#: ../IkiWiki/Render.pm:323
+#: ../IkiWiki/Render.pm:326
#, perl-format
msgid "removing old page %s"
msgstr ""
-#: ../IkiWiki/Render.pm:356
+#: ../IkiWiki/Render.pm:359
#, perl-format
msgid "scanning %s"
msgstr ""
-#: ../IkiWiki/Render.pm:361
+#: ../IkiWiki/Render.pm:364
#, perl-format
msgid "rendering %s"
msgstr ""
-#: ../IkiWiki/Render.pm:373
+#: ../IkiWiki/Render.pm:376
#, perl-format
msgid "rendering %s, which links to %s"
msgstr ""
-#: ../IkiWiki/Render.pm:390
+#: ../IkiWiki/Render.pm:393
#, perl-format
msgid "rendering %s, which depends on %s"
msgstr ""
-#: ../IkiWiki/Render.pm:428
+#: ../IkiWiki/Render.pm:431
#, perl-format
msgid "rendering %s, to update its backlinks"
msgstr ""
-#: ../IkiWiki/Render.pm:440
+#: ../IkiWiki/Render.pm:443
#, perl-format
msgid "removing %s, no longer rendered by %s"
msgstr ""
-#: ../IkiWiki/Render.pm:466
+#: ../IkiWiki/Render.pm:469
#, perl-format
msgid "ikiwiki: cannot render %s"
msgstr ""
msgid "usage: --set var=value"
msgstr ""
-#: ../IkiWiki.pm:126
+#: ../IkiWiki.pm:128
msgid "Must specify url to wiki with --url when using --cgi"
msgstr ""
-#: ../IkiWiki.pm:191 ../IkiWiki.pm:192
+#: ../IkiWiki.pm:193 ../IkiWiki.pm:194
msgid "Error"
msgstr ""
#. translators: preprocessor directive name,
#. translators: the second a page name, the
#. translators: third a number.
-#: ../IkiWiki.pm:688
+#: ../IkiWiki.pm:705
#, perl-format
msgid "%s preprocessing loop detected on %s at depth %i"
msgstr ""
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 3;
+use Test::More 'no_plan';
-ok(! system("make ikiwiki.out"));
-ok(! system("LANG=C perl -T -I. ./ikiwiki.out -plugin brokenlinks -rebuild -underlaydir=basewiki -templatedir=templates t/basewiki_brokenlinks t/basewiki_brokenlinks/out"));
-ok(`grep 'no broken links' t/basewiki_brokenlinks/out/index.html`);
-system("rm -rf t/basewiki_brokenlinks/out t/basewiki_brokenlinks/.ikiwiki");
+ok(! system("mkdir t/tmp"));
+ok(! system("make -q ikiwiki.out"));
+ok(! system("make extra_install DESTDIR=t/tmp/install PREFIX=/usr >/dev/null"));
+ok(! system("LANG= perl -T -I. ./ikiwiki.out -plugin smiley -plugin brokenlinks -rebuild -underlaydir=t/tmp/install/usr/share/ikiwiki/basewiki -templatedir=templates t/basewiki_brokenlinks t/tmp/out"));
+ok(`grep 'no broken links' t/tmp/out/index.html`);
+ok(-e "t/tmp/out/style.css");
+ok(! system("rm -rf t/tmp t/basewiki_brokenlinks/.ikiwiki"));
--- /dev/null
+../../doc/blog.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/favicon.ico
\ No newline at end of file
--- /dev/null
+../../doc/helponformatting.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/basewiki/index.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/local.css
\ No newline at end of file
--- /dev/null
+../../doc/markdown.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/openid.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/pagespec.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/preprocessordirective.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/basewiki/sandbox.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/shortcuts.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/style.css
\ No newline at end of file
--- /dev/null
+../../doc/subpage
\ No newline at end of file
--- /dev/null
+../../doc/subpage.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/templates.mdwn
\ No newline at end of file
--- /dev/null
+../../../doc/templates/note.mdwn
\ No newline at end of file
--- /dev/null
+../../../doc/templates/popup.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/wikiicons
\ No newline at end of file
--- /dev/null
+../../doc/wikilink.mdwn
\ No newline at end of file
--- /dev/null
+../../doc/smileys
\ No newline at end of file
--- /dev/null
+../../doc/smileys.mdwn
\ No newline at end of file