]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Rename inlinepage to depends, so that it can be used to refer to more
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 1 May 2006 22:27:37 +0000 (22:27 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 1 May 2006 22:27:37 +0000 (22:27 +0000)
  dependency relationships than just inlining. This will require a rebuild
  on upgrade to this version.
* Move the rss link, put it in the blogpost form if there is one and at the
  top if not. This is both nicer because easier to find, and it cleans up
  the code which had used inlinepage as a flag for adding the link later.
* Allow the depends GlobList to be built up from multiple sources (such as
  plugins) during a page render.
* Which means that more than one blog is now supported to appear on a
  single page. (With some limitations.)

13 files changed:
IkiWiki/Render.pm
basewiki/helponformatting.mdwn
debian/changelog
debian/postinst
doc/bugs.mdwn
doc/news.mdwn
doc/templates.mdwn
doc/todo.mdwn
doc/todo/plugin.mdwn
ikiwiki
templates/blogpost.tmpl
templates/page.tmpl
templates/rsslink.tmpl [new file with mode: 0644]

index d0d28e80276db70650a196323fea9054d79967cc..f9da33e300e6837cf9e1224b332dbb4e0383b22c 100644 (file)
@@ -139,17 +139,17 @@ sub preprocess ($$) { #{{{
                my $command=shift;
                my $params=shift;
                if (length $escape) {
-                       "[[$command $params]]";
+                       return "[[$command $params]]";
                }
                elsif (exists $commands{$command}) {
                        my %params;
                        while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) {
                                $params{$1}=$2;
                        }
-                       $commands{$command}->($page, %params);
+                       return $commands{$command}->($page, %params);
                }
                else {
-                       "[[bad directive $command]]";
+                       return "[[bad directive $command]]";
                }
        };
        
@@ -200,17 +200,32 @@ sub preprocess_inline ($@) { #{{{
        if (! exists $params{show} && $params{archive} eq "no") {
                $params{show}=10;
        }
-       $inlinepages{$parentpage}=$params{pages};
+       if (! exists $depends{$parentpage}) {
+               $depends{$parentpage}=$params{pages};
+       }
+       else {
+               $depends{$parentpage}.=" ".$params{pages};
+       }
 
        my $ret="";
        
        if (exists $params{rootpage}) {
+               # Add a blog post form, with a rss link button.
                my $formtemplate=HTML::Template->new(blind_cache => 1,
                        filename => "$config{templatedir}/blogpost.tmpl");
                $formtemplate->param(cgiurl => $config{cgiurl});
                $formtemplate->param(rootpage => $params{rootpage});
-               my $form=$formtemplate->output;
-               $ret.=$form;
+               if ($config{rss}) {
+                       $formtemplate->param(rssurl => rsspage(basename($parentpage)));
+               }
+               $ret.=$formtemplate->output;
+       }
+       elsif ($config{rss}) {
+               # Add a rss link button.
+               my $linktemplate=HTML::Template->new(blind_cache => 1,
+                       filename => "$config{templatedir}/rsslink.tmpl");
+               $linktemplate->param(rssurl => rsspage(basename($parentpage)));
+               $ret.=$linktemplate->output;
        }
        
        my $template=HTML::Template->new(blind_cache => 1,
@@ -267,10 +282,6 @@ sub genpage ($$$) { #{{{
                $template->param(hyperestraierurl => cgiurl());
        }
 
-       if ($config{rss} && $inlinepages{$page}) {
-               $template->param(rssurl => rsspage(basename($page)));
-       }
-       
        $template->param(
                title => $title,
                wikiname => $config{wikiname},
@@ -375,7 +386,7 @@ sub render ($) { #{{{
                my $page=pagename($file);
                
                $links{$page}=[findlinks($content, $page)];
-               delete $inlinepages{$page};
+               delete $depends{$page};
                
                $content=linkify($content, $page);
                $content=preprocess($page, $content);
@@ -569,18 +580,18 @@ FILE:             foreach my $file (@files) {
        }
 
        # Handle backlinks; if a page has added/removed links, update the
-       # pages it links to. Also handle inlining here.
+       # pages it links to. Also handles rebuilding dependat pages.
        # TODO: inefficient; pages may get rendered above and again here;
        # problem is the backlinks could be wrong in the first pass render
        # above
        if (%rendered || @del) {
                foreach my $f (@files) {
                        my $p=pagename($f);
-                       if (exists $inlinepages{$p}) {
+                       if (exists $depends{$p}) {
                                foreach my $file (keys %rendered, @del) {
                                        my $page=pagename($file);
-                                       if (globlist_match($page, $inlinepages{$p})) {
-                                               debug("rendering $f, which inlines $page");
+                                       if (globlist_match($page, $depends{$p})) {
+                                               debug("rendering $f, which depends on $page");
                                                render($f);
                                                $rendered{$f}=1;
                                                last;
index 286946169d21b58271f155847f8a514fa0f63c72..9f7bcd9d13803bea69956c3cbfa6aac0cfe6ba4c 100644 (file)
@@ -38,7 +38,7 @@ To quote someone, prefix the quote with ">":
 > To be or not to be,
 > that is the question.
 
-To write a code block, indent each line with a tab:
+To write a code block, indent each line with a tab or 8 spaces:
 
        10 PRINT "Hello, world!"
        20 GOTO 10
index e1eb577100c8abb1cb08e3b8a412ed6098cdd71a..28011339b107ec39252bbc02ba8a89755e77f0d1 100644 (file)
@@ -1,3 +1,18 @@
+ikiwiki (1.1) UNRELEASED; urgency=low
+
+  * Rename inlinepage to depends, so that it can be used to refer to more
+    dependency relationships than just inlining. This will require a rebuild
+    on upgrade to this version.
+  * Move the rss link, put it in the blogpost form if there is one and at the
+    top if not. This is both nicer because easier to find, and it cleans up
+    the code which had used inlinepage as a flag for adding the link later.
+  * Allow the depends GlobList to be built up from multiple sources (such as
+    plugins) during a page render.
+  * Which means that more than one blog is now supported to appear on a
+    single page. (With some limitations.)
+
+ -- Joey Hess <joeyh@debian.org>  Mon,  1 May 2006 18:21:16 -0400
+
 ikiwiki (1.0) unstable; urgency=low
 
   * First official release.
index be5f539396741fac81cbe3f878e870b9cdd98e58..b9630b5254d857429cdc16ee3f4103b56bc3a587 100755 (executable)
@@ -4,7 +4,7 @@ set -e
 
 # Change this when some incompatible change is made that requires
 # rebuilding all wikis.
-firstcompat=0.2
+firstcompat=1.1
 
 wikilist=/etc/ikiwiki/wikilist
 
index 6e02e4533ffe6927ac55d51911172f1be43ac04e..47799676a6e3df1a0e5dc2397fa66e5e4b7debf0 100644 (file)
@@ -23,8 +23,6 @@
       pages generated from the underlaydir as it can never work for them.
 * If a page stops inlining anthing, its rss feed file
   will linger around and not be deleted.
-* Currently only one blog is supported per page. Attempts to add more
-  will make it only update one of the blogs on the page.
 * RSS output contains relative links. Ie. http://kitenet.net/~joey/blog/index.rss contains a link to http://kitenet.net/~joey/blog/../blog.html
 * If a file in the srcdir is removed, exposing a file in the underlaydir,
   ikiwiki will not notice the change and rebuild it until the file in the
index cc2adcbc17283d5b781081054b474979cc8ddc47..2141ca2864855bfaf5e69a0f1b596bdec4f1c551 100644 (file)
@@ -1,5 +1,7 @@
-This is where annoucements of new releases, features, and other news is posted. [[IkiWikiUsers]] are recommended to subscribe to this page's RSS feed.
+This is where annoucements of new releases, features, and other news is
+posted. [[IkiWikiUsers]] are recommended to subscribe to this page's RSS
+feed.
 
 [[inline pages="news/* !*/Discussion" rootpage="news" show="30"]]
 
-By the way, some other pages with RSS feeds about ikiwiki include [[TODO]] and [[TODO/done]].
\ No newline at end of file
+By the way, some other pages with RSS feeds about ikiwiki include [[TODO]] and [[TODO/done]].
index 97a91d28bb667a234611b402aee97585b67e980e..cb07f27addefb142567092a37323a167f5dda9aa 100644 (file)
@@ -24,6 +24,8 @@ It ships with some basic templates which can be customised:
 * `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 link)
+* `rsslink.tmpl` - Used to add a rss link if blogpost.tmpl is not used.
 
 If you like, you can add these to further customise it:
 
index 4bf9eb4c0d96671942f5331220199e8a52753f8d..764872eeaef63689fb25a0ca7f08abfb0ea62e4e 100644 (file)
@@ -7,3 +7,9 @@ Welcome to ikiwiki's todo list. Items are moved to [[todo/done]] when done.
 # Full list of open items:
 
 [[inline pages="todo/* !todo/done* !*/Discussion" archive="yes"]]
+
+----
+
+Test:
+
+[[inline pages="news/* !*/Discussion" rootpage="news" show="30"]]
index 5f070dd92060a7748e876dd63dbd9049e001b1c5..0a8a0942e096a5a723531705685c4a407712cc20 100644 (file)
@@ -20,7 +20,11 @@ Considering ikiwiki plugins, one idea I have is to make the [[PreProcessorDirect
 
 Since preprocessing happens before htmlization but after a page is loaded and linkified, it should be possible to use it to create something like a link map or lists, or a page index. Page inlining and rss generation is already done via preprocessor directives and seems a natureal as a plugin too. 
 
-Note that things like a link map or a broken link list page would need to be updated whenever a set (or all) pages change; the %inlinepages hash already allows for pages to register this, although it might need to be renamed. 
+Note that things like a link map or a broken link list page would need to
+be updated whenever a set (or all) pages change; the %depends hash
+already allows for pages to register this, although there could be some
+strange behavior if mixing multiple directives some of which exclude pages
+that others might want to include.
 
 I need to look at the full range of things that other wikis use their plugin systems for, but preprocessor directives as plugins certianly seems useful, even if it's  not a complete solution.
 
diff --git a/ikiwiki b/ikiwiki
index 6c157132fc53e076cf18ce86c5700d60987682bb..dfb484f6402cc15fba20f577d6be57e57a9dd7fa 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -9,7 +9,7 @@ use HTML::Template;
 use lib '.'; # For use without installation, removed by Makefile.
 
 use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
-            %renderedfiles %pagesources %inlinepages};
+            %renderedfiles %pagesources %depends};
 
 sub usage () { #{{{
        die "usage: ikiwiki [options] source dest\n";
@@ -399,8 +399,8 @@ sub loadindex () { #{{{
                        $oldpagemtime{$page}=$items{mtime}[0];
                        $oldlinks{$page}=[@{$items{link}}];
                        $links{$page}=[@{$items{link}}];
-                       $inlinepages{$page}=join(" ", @{$items{inlinepage}})
-                               if exists $items{inlinepage};
+                       $depends{$page}=join(" ", @{$items{depends}})
+                               if exists $items{depends};
                        $renderedfiles{$page}=$items{dest}[0];
                }
                $pagectime{$page}=$items{ctime}[0];
@@ -421,8 +421,8 @@ sub saveindex () { #{{{
                        "src=$pagesources{$page} ".
                        "dest=$renderedfiles{$page}";
                $line.=" link=$_" foreach @{$links{$page}};
-               if (exists $inlinepages{$page}) {
-                       $line.=" inlinepage=$_" foreach split " ", $inlinepages{$page};
+               if (exists $depends{$page}) {
+                       $line.=" depends=$_" foreach split " ", $depends{$page};
                }
                print OUT $line."\n";
        }
index 22253d60bcf828b4c37ac08d38f0fb930c6b669b..1b93adc14c69f1fb6c3e29830a0b30e4a3ed958e 100644 (file)
@@ -1,5 +1,8 @@
 <form action="<TMPL_VAR CGIURL>" method="get">
 <div id="blogform">
+<TMPL_IF NAME="RSSURL">
+<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
+</TMPL_IF>
 <input type="hidden" name="do" value="blog" />
 <input type="hidden" name="from" value="<TMPL_VAR ROOTPAGE>" />
 <input type="hidden" name="subpage" value="1" />
index c9ec2a34ff065e40d5557cdd2b3c61ae9802b177..4dc8e11394afa26da4d8d1f209d675d996fabbe4 100644 (file)
@@ -67,9 +67,6 @@ Links:
 <!-- from <TMPL_VAR NAME=WIKINAME> -->
 Last edited <TMPL_VAR NAME=MTIME>
 </span>
-<TMPL_IF NAME="RSSURL">
-<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
-</TMPL_IF>
 </div>
 
 </body>
diff --git a/templates/rsslink.tmpl b/templates/rsslink.tmpl
new file mode 100644 (file)
index 0000000..f70c959
--- /dev/null
@@ -0,0 +1,5 @@
+<div id="rsslink">
+<TMPL_IF NAME="RSSURL">
+<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
+</TMPL_IF>
+</div>