]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Add an orphans plugin for finding pages that nothing links to.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 2 May 2006 06:15:31 +0000 (06:15 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 2 May 2006 06:15:31 +0000 (06:15 +0000)
* Removed backlinks page, which it turns out nothing used.

IkiWiki/Plugin/orphans.pm [new file with mode: 0644]
Makefile.PL
debian/changelog
doc/backlinks.mdwn [deleted file]
doc/plugins/orphans.mdwn [new file with mode: 0644]
doc/todo/plugin.mdwn

diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
new file mode 100644 (file)
index 0000000..06b51bd
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+# Provides a list of pages no other page links to.
+package IkiWiki::Plugin::orphans;
+
+use warnings;
+use strict;
+
+sub import { #{{{
+       IkiWiki::register_plugin("preprocess", "orphans", \&preprocess);
+} # }}}
+
+sub preprocess (@) { #{{{
+       my %params=@_;
+       $params{pages}="*" unless defined $params{pages};
+       
+       # Needs to update whenever a page is added or removed, so
+       # register a dependency.
+       IkiWiki::add_depends($params{page}, $params{pages});
+       
+       my %linkedto;
+       foreach my $p (keys %IkiWiki::links) {
+               map { $linkedto{IkiWiki::bestlink($p, $_)}=1 if length $_ }
+                       @{$IkiWiki::links{$p}};
+       }
+       
+       my @orphans;
+       foreach my $page (keys %IkiWiki::renderedfiles) {
+               next if $linkedto{$page};
+               next unless IkiWiki::globlist_match($page, $params{pages});
+               # If the page has a link to some other page, it's
+               # indirectly linked to a page via that page's backlinks.
+               next if grep { length $_ && $_ !~/\/Discussion$/i && IkiWiki::bestlink($page, $_) ne $page } @{$IkiWiki::links{$page}};
+               push @orphans, $page;
+       }
+       
+       return "All pages are linked to by other pages." unless @orphans;
+       return "<ul>\n".join("\n", map { "<li>".IkiWiki::htmllink($params{page}, $_, 1)."</li>" } sort @orphans)."</ul>\n";
+} # }}}
+
+1
index 85fc075433cd2fbaa6d15856fa6573001f7080e8..91ba6c50df975ade5547554455f9a1c86985dc35 100755 (executable)
@@ -15,7 +15,7 @@ extra_build:
        ./ikiwiki doc html --templatedir=templates --underlaydir=basewiki \
                --wikiname="ikiwiki" --verbose --nosvn \
                --exclude=/discussion --plugin=brokenlinks \
        ./ikiwiki doc html --templatedir=templates --underlaydir=basewiki \
                --wikiname="ikiwiki" --verbose --nosvn \
                --exclude=/discussion --plugin=brokenlinks \
-               --plugin=pagecount
+               --plugin=pagecount --plugin=orphans
        ./mdwn2man doc/usage.mdwn > ikiwiki.man
                
 extra_clean:
        ./mdwn2man doc/usage.mdwn > ikiwiki.man
                
 extra_clean:
index e1c6979dca24e173fbeab79cd57468cc7f06ea91..5e1c05f30a905d8e8a8e586ada2cbb005d77db5a 100644 (file)
@@ -22,8 +22,10 @@ ikiwiki (1.1) UNRELEASED; urgency=low
   * Fix several broken links in the doc wiki.
   * Smarter behavior when creating a page and a page of the same name (but
     different location) already exists.
   * Fix several broken links in the doc wiki.
   * Smarter behavior when creating a page and a page of the same name (but
     different location) already exists.
+  * Add an orphans plugin for finding pages that nothing links to.
+  * Removed backlinks page, which it turns out nothing used.
 
 
- -- Joey Hess <joeyh@debian.org>  Mon,  1 May 2006 22:57:04 -0400
+ -- Joey Hess <joeyh@debian.org>  Tue,  2 May 2006 01:45:34 -0400
 
 ikiwiki (1.0) unstable; urgency=low
 
 
 ikiwiki (1.0) unstable; urgency=low
 
diff --git a/doc/backlinks.mdwn b/doc/backlinks.mdwn
deleted file mode 100644 (file)
index fb15af3..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-This is the list of links at the bottom of the page. It's all other pages that
-link to this one.
\ No newline at end of file
diff --git a/doc/plugins/orphans.mdwn b/doc/plugins/orphans.mdwn
new file mode 100644 (file)
index 0000000..ad16faa
--- /dev/null
@@ -0,0 +1,14 @@
+This plugin generates a list of orhpaned pages -- pages that no other page
+links to.
+
+The optional parameter "pages" can be a [[GlobList]] specifying the pages
+to check for orphans, default is search them all.
+
+Note that it takes backlinks into account, but does not count inlining a
+page as linking to it, so will generally count many blog-type pages as
+orphans.
+
+This plugin is included in ikiwiki, but is not enabled by default.
+If it is turned on, here's a list of orphaned pages on this wiki:
+
+[[orphans ]]
index 4cbe256382e2ee626d03144e667eba46ff8bb50e..2280a97e2807ed5d14f2f0134fb2c6eb552b50d6 100644 (file)
@@ -1,23 +1,31 @@
 A plugin system should ideally support things like:
 
 A plugin system should ideally support things like:
 
-* [[todo/lists]] of pages, of mising pages / broken links, of registered users, etc
+* [[todo/lists]] of pages, of mising pages / broken links (done), orphaned
+  pages (done), of registered users, etc
 * a [[todo/link_map]]
 * a [[todo/link_map]]
+* [[todo/sigs]] ?
 * [[pageindexes]]
 * [[pageindexes]]
-* Wiki stats, such as the total number of pages, total number of links, most linked to pages, etc, etc.
+* Wiki stats, such as the total number of pages (done), total number of links, most linked to pages, etc, etc.
 * wiki info page, giving the ikiwiki version etc
 * would it be useful to reimplement the hyperestradier search integration as a plugin?
 * Support [[RecentChanges]] as a regular page containing a plugin that updates each time there is a change, and statically builds the recent changes list. (Would this be too expensive/inflexible? There might be other ways to do it as a plugin, like making all links to RecentChanges link to the cgi and have the cgi render it on demand.)
 * wiki info page, giving the ikiwiki version etc
 * would it be useful to reimplement the hyperestradier search integration as a plugin?
 * Support [[RecentChanges]] as a regular page containing a plugin that updates each time there is a change, and statically builds the recent changes list. (Would this be too expensive/inflexible? There might be other ways to do it as a plugin, like making all links to RecentChanges link to the cgi and have the cgi render it on demand.)
+* Support for smileys or other symbols. I appreciate the support for check
+  marks, etc in other wikis.
+* For PlaceWiki I want to be able to do some custom plugins, including one
+  that links together subpages about the same place created by different
+  users. This seems to call for a plugin that applies to every page w/o any
+  specific marker being used, and pre-or-post-processes the full page
+  content. It also needs to update pages when related pages are added,
+  so it needs to register dependencies pre-emptively between pages,
+  or something. It's possible that this is a special case of backlinks and
+  is best implemented by making backlinks a plugin somehow. --[[Joey]]
 * etc
 * etc
-* For another type of plugin, see [[todo/PluggableRenderers]]. 
+* For another type of plugin, see [[todo/PluggableRenderers]].
 
 Another, separate plugin system that already (mostly) exists in ikiwiki is
 the RCS backend, which allows writing modules to drive other RCS systems
 than subversion.
 
 
 Another, separate plugin system that already (mostly) exists in ikiwiki is
 the RCS backend, which allows writing modules to drive other RCS systems
 than subversion.
 
-## preprocessor plugins
-
-done
-
 ## case study: Moin Moin plugins
 
 See <http://moinmoin.wikiwikiweb.de/MoinDev/PluginConcept>
 ## case study: Moin Moin plugins
 
 See <http://moinmoin.wikiwikiweb.de/MoinDev/PluginConcept>