]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge branch 'master' into prefix-directives
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 5 Feb 2008 20:59:42 +0000 (15:59 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 5 Feb 2008 20:59:42 +0000 (15:59 -0500)
1  2 
IkiWiki.pm
debian/NEWS
debian/changelog
doc/ikiwiki/blog.mdwn

diff --combined IkiWiki.pm
index 56be7ed475f0b77bce1a55273632c780c064651c,0c05bb0d377c8622b2e0ea3ff6a21abea14a6322..ca75d885b3e738ef9e99923f6d8c17941a17bfd6
@@@ -38,9 -38,9 +38,9 @@@ sub defaultconfig () { #{{
                qr/(^|\/)_MTN\//,
                qr/\.dpkg-tmp$/],
        wiki_link_regexp => qr{
 -              \[\[                    # beginning of link
 +              \[\[(?=[^!])            # beginning of link
                (?:
 -                      ([^\]\|\n\s]+)  # 1: link text
 +                      ([^\]\|]+)      # 1: link text
                        \|              # followed by '|'
                )?                      # optional
                
        cgi => 0,
        post_commit => 0,
        rcs => '',
-       notify => 0,
        url => '',
        cgiurl => '',
        historyurl => '',
        diffurl => '',
        rss => 0,
        atom => 0,
+       allowrss => 0,
+       allowatom => 0,
        discussion => 1,
        rebuild => 0,
        refresh => 0,
@@@ -76,7 -77,6 +77,6 @@@
        w3mmode => 0,
        wrapper => undef,
        wrappermode => undef,
-       svnrepo => undef,
        svnpath => "trunk",
        gitorigin_branch => "origin",
        gitmaster_branch => "master",
@@@ -90,7 -90,7 +90,7 @@@
        adminuser => undef,
        adminemail => undef,
        plugin => [qw{mdwn inline htmlscrubber passwordauth openid signinedit
-                     lockedit conditional}],
+                     lockedit conditional recentchanges}],
        libdir => undef,
        timeformat => '%c',
        locale => undef,
        usedirs => 1,
        numbacklinks => 10,
        account_creation_password => "",
 +      prefix_directives => 0,
  } #}}}
  
  sub checkconfig () { #{{{
                umask(possibly_foolish_untaint($config{umask}));
        }
  
 +      if (!$config{prefix_directives}) {
 +              $config{wiki_link_regexp} = qr{
 +                      \[\[                    # beginning of link
 +                      (?:
 +                              ([^\]\|\n\s]+)  # 1: link text
 +                              \|              # followed by '|'
 +                      )?                      # optional
 +
 +                      ([^\s\]#]+)             # 2: page to link to
 +                      (?:
 +                              \#              # '#', beginning of anchor
 +                              ([^\s\]]+)      # 3: anchor text
 +                      )?                      # optional
 +
 +                      \]\]                    # end of link
 +              }x,
 +      }
 +
        run_hooks(checkconfig => sub { shift->() });
  
        return 1;
@@@ -281,6 -262,12 +281,12 @@@ sub pagetype ($) { #{{
        return;
  } #}}}
  
+ sub isinternal ($) { #{{{
+       my $page=shift;
+       return exists $pagesources{$page} &&
+               $pagesources{$page} =~ /\._([^.]+)$/;
+ } #}}}
  sub pagename ($) { #{{{
        my $file=shift;
  
@@@ -628,6 -615,20 +634,20 @@@ sub htmllink ($$$;@) { #{{
        return "<a href=\"$bestlink\"@attrs>$linktext</a>";
  } #}}}
  
+ sub userlink ($) { #{{{
+       my $user=shift;
+       my $oiduser=eval { openiduser($user) };
+       if (defined $oiduser) {
+               return "<a href=\"$user\">$oiduser</a>";
+       }
+       else {
+               return htmllink("", "", escapeHTML(
+                       length $config{userdir} ? $config{userdir}."/".$user : $user
+               ), noimageinline => 1);
+       }
+ } #}}}
  sub htmlize ($$$) { #{{{
        my $page=shift;
        my $type=shift;
@@@ -698,11 -699,10 +718,11 @@@ sub preprocess ($$$;$$) { #{{
  
        my $handle=sub {
                my $escape=shift;
 +              my $prefix=shift;
                my $command=shift;
                my $params=shift;
                if (length $escape) {
 -                      return "[[$command $params]]";
 +                      return "[[$prefix$command $params]]";
                }
                elsif (exists $hooks{preprocess}{$command}) {
                        return "" if $scan && ! $hooks{preprocess}{$command}{scan};
                        return $ret;
                }
                else {
 -                      return "[[$command $params]]";
 +                      return "[[$prefix$command $params]]";
                }
        };
        
 -      $content =~ s{
 -              (\\?)           # 1: escape?
 -              \[\[            # directive open
 -              ([-\w]+)        # 2: command
 -              \s+
 -              (               # 3: the parameters..
 -                      (?:
 -                              (?:[-\w]+=)?            # named parameter key?
 +      my $regex;
 +      if ($config{prefix_directives}) {
 +              $regex = qr{
 +                      (\\?)           # 1: escape?
 +                      \[\[(!)         # directive open; 2: prefix
 +                      ([-\w]+)        # 3: command
 +                      (               # 4: the parameters..
 +                              \s+     # Must have space if parameters present
 +                              (?:
 +                                      (?:[-\w]+=)?            # named parameter key?
 +                                      (?:
 +                                              """.*?"""       # triple-quoted value
 +                                              |
 +                                              "[^"]+"         # single-quoted value
 +                                              |
 +                                              [^\s\]]+        # unquoted value
 +                                      )
 +                                      \s*                     # whitespace or end
 +                                                              # of directive
 +                              )
 +                      *)?             # 0 or more parameters
 +                      \]\]            # directive closed
 +              }sx;
 +      } else {
 +              $regex = qr{
 +                      (\\?)           # 1: escape?
 +                      \[\[(!?)        # directive open; 2: optional prefix
 +                      ([-\w]+)        # 3: command
 +                      \s+
 +                      (               # 4: the parameters..
                                (?:
 -                                      """.*?"""       # triple-quoted value
 -                                      |
 -                                      "[^"]+"         # single-quoted value
 -                                      |
 -                                      [^\s\]]+        # unquoted value
 +                                      (?:[-\w]+=)?            # named parameter key?
 +                                      (?:
 +                                              """.*?"""       # triple-quoted value
 +                                              |
 +                                              "[^"]+"         # single-quoted value
 +                                              |
 +                                              [^\s\]]+        # unquoted value
 +                                      )
 +                                      \s*                     # whitespace or end
 +                                                              # of directive
                                )
 -                              \s*                     # whitespace or end
 -                                                      # of directive
 -                      )
 -              *)              # 0 or more parameters
 -              \]\]            # directive closed
 -      }{$handle->($1, $2, $3)}sexg;
 +                      *)              # 0 or more parameters
 +                      \]\]            # directive closed
 +              }sx;
 +      }
 +
 +      $content =~ s{$regex}{$handle->($1, $2, $3, $4)}eg;
        return $content;
  } #}}}
  
@@@ -913,7 -886,7 +933,7 @@@ sub loadindex () { #{{
        %oldrenderedfiles=%pagectime=();
        if (! $config{rebuild}) {
                %pagesources=%pagemtime=%oldlinks=%links=%depends=
-                       %destsources=%renderedfiles=%pagecase=();
+                       %destsources=%renderedfiles=%pagecase=%pagestate=();
        }
        open (my $in, "<", "$config{wikistatedir}/index") || return;
        while (<$in>) {
@@@ -979,7 -952,7 +999,7 @@@ sub saveindex () { #{{
                if (exists $pagestate{$page}) {
                        foreach my $id (@hookids) {
                                foreach my $key (keys %{$pagestate{$page}{$id}}) {
-                                       $line.=' '.$id.'_'.encode_entities($key)."=".encode_entities($pagestate{$page}{$id}{$key});
+                                       $line.=' '.$id.'_'.encode_entities($key)."=".encode_entities($pagestate{$page}{$id}{$key}, " \t\n");
                                }
                        }
                }
@@@ -1299,13 -1272,22 +1319,22 @@@ sub match_glob ($$;@) { #{{
        $glob=~s/\\\?/./g;
  
        if ($page=~/^$glob$/i) {
-               return IkiWiki::SuccessReason->new("$glob matches $page");
+               if (! IkiWiki::isinternal($page) || $params{internal}) {
+                       return IkiWiki::SuccessReason->new("$glob matches $page");
+               }
+               else {
+                       return IkiWiki::FailReason->new("$glob matches $page, but the page is an internal page");
+               }
        }
        else {
                return IkiWiki::FailReason->new("$glob does not match $page");
        }
  } #}}}
  
+ sub match_internal ($$;@) { #{{{
+       return match_glob($_[0], $_[1], @_, internal => 1)
+ } #}}}
  sub match_link ($$;@) { #{{{
        my $page=shift;
        my $link=lc(shift);
@@@ -1401,19 -1383,4 +1430,4 @@@ sub match_creation_year ($$;@) { #{{
        }
  } #}}}
  
- sub match_user ($$;@) { #{{{
-       shift;
-       my $user=shift;
-       my %params=@_;
-       return IkiWiki::FailReason->new('cannot match user')
-               unless exists $params{user};
-       if ($user eq $params{user}) {
-               return IkiWiki::SuccessReason->new("user is $user")
-       }
-       else {
-               return IkiWiki::FailReason->new("user is not $user");
-       }
- } #}}}
  1
diff --combined debian/NEWS
index eefc12acb32f362b736bf62f6c2088b5404ffdf7,c3ed55c03842f18556760c36c61d3ad3907e7a30..908cfdb1534db3e0180eade62f49f43465c6a6eb
@@@ -1,36 -1,26 +1,59 @@@
- ikiwiki (2.21) unstable; urgency=low
++ikiwiki (2.31) unstable; urgency=low
 +
 +  ikiwiki now has an new syntax for preprocessor directives, using the
 +  prefix '!':
 +
 +  [[!directive ...]]
 +
 +  This new syntax no longer relies on spaces to distinguish between
 +  wikilinks and preprocessor directives.  Thus, wikilinks can use spaces
 +  in their link text, and preprocessor directives without arguments (such
 +  as "toc") need not use a trailing space.
 +
 +  To enable the new syntax, set prefix_directives to true in your ikiwiki
 +  config.  For backward compatibility with existing wikis,
 +  prefix_directives currently defaults to false.  In ikiwiki 3.0,
 +  prefix_directives will default to true, and wikis which have not yet
 +  converted to the new syntax will need to set prefix_directives to false
 +  in their setup files.
 +
 +  To convert your wiki to the new syntax, ikiwiki provides a new script
 +  ikiwiki-transition.  It will convert preprocessor directives in
 +  all files given on the command line.  To convert an entire wiki:
 +
 +  find wikidir/ -type f -name '*.mdwn' -print0 | xargs -0 ikiwiki-transition prefix_directives
 +
 +  Even with prefix_directives disabled, ikiwiki now allows an optional '!'
 +  prefix on preprocessor directives (but still requires a space).  Thus, a
 +  directive which uses a '!' prefix and contains a space will work with
 +  ikiwiki 2.21 and newer, regardless of the value of prefix_directives.
 +  This allows the underlay to work with all ikiwikis.
 +
 + -- Josh Triplett <josh@freedesktop.org>  Sat, 26 Jan 2008 16:26:47 -0800
 +
+ ikiwiki (2.30) unstable; urgency=low
+   Ever feel that ikiwiki's handling of RecentChanges wasn't truely in the
+   spirit of a wiki compiler? Well, that's changed. The RecentChanges page is
+   now a static page, not a CGI. Users can subscribe to its rss/atom feeds.
+   Custom RecentChanges pages can be easily set up that display only changes
+   to a subset of pages, or only changes by a subset of users.
+   
+   All wikis need to be rebuilt on upgrade to this version. If you listed your
+   wiki in /etc/ikiwiki/wikilist this will be done automatically when the
+   Debian package is upgraded. Or use ikiwiki-mass-rebuild to force a rebuild.
+   With this excellent new RecentChanges support, the mail notification system
 -  is showing its age (and known to be variously buggy and underimplemented for
++  is its age (and known to be variously buggy and underimplemented for
+   various VCSes), and so ikiwiki's support for sending commit mails is REMOVED
+   from this version. If you were subscribed to commit mails, you should be
+   able to accomplish the same thing by subscribing to a RecentChanges feed.
+   The "svnrepo" and "notify" fields in setup files are no longer used, and
+   silently ignored. You may want to remove them from your setup file.
+  -- Joey Hess <joeyh@debian.org>  Tue, 29 Jan 2008 17:18:31 -0500
  ikiwiki (2.20) unstable; urgency=low
  
    The template plugin has begin to htmlize the variables passed to templates.
diff --combined debian/changelog
index e81cc21adcdd5a969c9b3184433a6ad4e40bf4f7,b32c7ad51b58b38dcdbe09543a9676d778e30643..397ecca1b0107c58a26f54b32fd31d6619c9f188
@@@ -1,4 -1,45 +1,45 @@@
- ikiwiki (2.21) UNRELEASED; urgency=low
+ ikiwiki (2.31) UNRELEASED; urgency=low
+   * Revert preservation of input file modification times in output files,
+     since this leads to too many problems with web caching, especially with
+     inlined pages. Properly solving this would involve tracking every page
+     that contributes to a page's content and using the youngest of them all,
+     as well as special cases for things like the version plugin, and it's just
+     too complex to do.
+   * aggregate: Forking a child broke the one state that mattered: Forcing
+     the aggregating page to be rebuilt. Fix this.
+   * cgi hooks are now run before ikiwiki state is loaded.
+   * This allows locking the wiki before loading state, which avoids some
+     tricky locking code when saving a web edit.
+   * poll: This plugin turns out to have edited pages w/o doing any locking.
+     Oops. Convert it from a cgi to a sessioncgi hook, which will work
+     much better.
+   * recentchanges: Improve handling of links on the very static changes pages
+     by thunking to the CGI, which can redirect to the page, or allow it to be
+     created if it doesn't exist.
+   * recentchanges: Exipre all *._change pages, even if the directory
+     they're in has changed.
+   * aggregate: Lots of changes; aggregation can now run without locking the
+     wiki, and there is a separate aggregatelock to prevent multiple concurrent
+     aggregation runs.
+   * monotone changes by Brian May:
+     - On commits, replace "mtn sync" bidirectional with "mtn push" single
+       direction. No need to pull changes when doing a commit. mtn sync
+       is still called in rcs_update.
+     - Support for viewing differences via patches using viewmtn.
+   * inline: When previewing, still call will_render on rss/atom files,
+     just avoid actually writing the files. This is necessary because ikiwiki
+     saves state after a preview (in case it actually *did* write files),
+     and if will_render isn't called its security checks will get upset
+     when the page is saved. Thanks to Edward Betts for his help tracking this
+     tricky bug down.
+   * inline: Add new `allowrss` and `allowatom` config options. These can be
+     used if you want a wiki that doesn't default to generating rss or atom
+     feeds, but that does allow them to be turned on for specific blogs.
+  -- Joey Hess <joeyh@debian.org>  Sat, 02 Feb 2008 23:36:31 -0500
+ ikiwiki (2.30) unstable; urgency=low
  
    [ Joey Hess ]
    * Old versions of git-init don't support --git-dir or GIT_DIR with
    [ Josh Triplett ]
    * Add trailing comma to commented-out umask in sample ikiwiki.setup, so
      that uncommenting it does not break the setup file.
 +  * Add new preprocessor directive syntax¸ using a '!' prefix.  Add a
 +    prefix_directives option to the setup file to turn this syntax on;
 +    currently defaults to false, for backward compatibility.  Support
 +    optional '!' prefix even with prefix_directives off, and use that in
 +    the underlay to support either setting of prefix_directives.  Add NEWS
 +    entry with migration information.
  
-  -- Joey Hess <joeyh@debian.org>  Fri, 11 Jan 2008 15:09:37 -0500
+   [ Joey Hess ]
+   * inline: The template can check for FIRST and LAST, which will be
+     set for the first and last inlined page. Useful for templates that build
+     tables and the like.
+   * prettydate,ddate: Don't ignore time formats passed to displaytime
+     function.
+   * Pages with extensions starting with "_" are internal-use, and will
+     not be rendered or web-edited, or matched by normal pagespecs.
+   * Add "internal()" pagespec that matches internal-use pages.
+   * RecentChanges is now a static html page, that's updated whenever a commit
+     is made to the wiki. It's built as a blog using inline, so it can have
+     an rss feed that users can subscribe to.
+   * Removed support for sending commit notification mails. Along with it went
+     the svnrepo and notify settings, though both will be ignored if left in
+     setup files. Also gone with it is the "user()" pagespec.
+   * Add refresh hook.
+   * meta: Add pagespec functions to match against title, author, authorurl,
+     license, and copyright. This can be used to create custom RecentChanges.
+   * meta: To support the pagespec functions, metadata about pages has to be
+     retained as pagestate.
+   * Fix encoding bug when pagestate values contained spaces.
+   * Add support for bzr, written by Jelmer Vernooij. Thanks also to bma for
+     his independent work on bzr support.
+   * Copyright file updates.
+  -- Joey Hess <joeyh@debian.org>  Sat, 02 Feb 2008 17:41:57 -0500
  
  ikiwiki (2.20) unstable; urgency=low
  
diff --combined doc/ikiwiki/blog.mdwn
index 8a9c50d0bf4bbea887e4bee4ec50897320f4eba1,80a3d20b396f0d418b52b3e77de7415ea357e845..1a816dceb4a9ff768ad0eef09b57acdce76f35bd
@@@ -1,14 -1,14 +1,14 @@@
 -[[if test="enabled(inline)"
 +[[!if test="enabled(inline)"
       then="This wiki has the inline plugin **enabled**."
       else="This wiki has the inline plugin **disabled**."]]
  
 -[[if test="enabled(inline)"
 +[[!if test="enabled(inline)"
       then="You can"
       else="If this wiki had the inline plugin enabled, you could"]]
  turn any page on this wiki into a weblog by using the `inline`
  [[PreProcessorDirective]]. For example:
  
 -      \[[inline pages="blog/* and !*/Discussion" show="10" rootpage="blog"]]
 +      \[[!inline pages="blog/* and !*/Discussion" show="10" rootpage="blog"]]
  
  Any pages that match the specified [[PageSpec]] (in the example, any
  [[SubPage]] of "blog") will be part of the blog, and the newest 10
@@@ -23,23 -23,23 +23,23 @@@ top of the blog that can be used to ad
  If you want your blog to have an archive page listing every post ever made
  to it, you can accomplish that like this:
  
 -      \[[inline pages="blog/* and !*/Discussion" archive="yes"]]
 +      \[[!inline pages="blog/* and !*/Discussion" archive="yes"]]
  
  You can even create an automatically generated list of all the pages on the
  wiki, with the most recently added at the top, like this:
  
 -      \[[inline pages="* and !*/Discussion" archive="yes"]]
 +      \[[!inline pages="* and !*/Discussion" archive="yes"]]
  
  If you want to be able to add pages to a given blog feed by tagging them,
  you can do that too. To tag a page, just make it link to a page or pages 
  that represent its tags. Then use the special `link()` [[PageSpec]] to match
  all pages that have a given tag:
  
 -      \[[inline pages="link(life)"]]
 +      \[[!inline pages="link(life)"]]
  
  Or include some tags and exclude others:
  
 -      \[[inline pages="link(debian) and !link(social)"]]
 +      \[[!inline pages="link(debian) and !link(social)"]]
  
  ## usage
  
@@@ -52,10 -52,12 +52,12 @@@ directive
    Set to 0 to show all matching pages.
  * `skip` - Specify a number of pages to skip displaying. Can be useful
    to produce a feed that only shows archived pages.
- * `rss` - controls generation of an rss feed. On by default if the wiki is
-   configured to use rss feeds, set to "no" to disable.
- * `atom` - controls generation of an atom feed. On by default if the wiki is
-   configured to use atom feeds, set to "no" to disable.
+ * `rss` - controls generation of an rss feed. If the wiki is configured to
+   generate tss feeds by default, set to "no" to disable. If the wiki is
+   configured to `allowrss`, set to "yes" to enable.
+ * `atom` - controls generation of an atom feed. If the wiki is configured to
+   generate atom feeds by default, set to "no" to disable. If the wiki is
+   configured to `allowatom`, set to "yes" to enable.
  * `feeds` - controls generation of all types of feeds. Set to "no" to
    disable generating any feeds.
  * `postform` - Set to "yes" to enables a form to post new pages to a [[blog]].