* Add an orphans plugin for finding pages that nothing links to.
* Removed backlinks page, which it turns out nothing used.master
parent
f84b47d080
commit
99292550fd
|
@ -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
|
|
@ -15,7 +15,7 @@ extra_build:
|
|||
./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:
|
||||
|
|
|
@ -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.
|
||||
* 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
|
||||
|
||||
|
|
|
@ -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.
|
|
@ -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 ]]
|
|
@ -1,12 +1,24 @@
|
|||
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]]
|
||||
* [[todo/sigs]] ?
|
||||
* [[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.)
|
||||
* 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
|
||||
* For another type of plugin, see [[todo/PluggableRenderers]].
|
||||
|
||||
|
@ -14,10 +26,6 @@ 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>
|
||||
|
|
Loading…
Reference in New Issue