File: orphan.rb

package info (click to toggle)
hiki 0.8.6-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,772 kB
  • ctags: 1,746
  • sloc: ruby: 20,067; lisp: 926; sh: 269; makefile: 10
file content (20 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# $Id: orphan.rb,v 1.5 2005/09/30 11:45:49 fdiary Exp $
# Copyright (C) 2003 TAKEUCHI Hitoshi <hitoshi@namaraii.com>

def orphan_pages
  pages = @db.pages.select{|p| @db.get_references(p).empty?}
  pages.collect!{|p| [p, page_name(p)]}
  pages.sort_by{|i| i[1].unescapeHTML}
end

def orphan
  s = '<ul>'

  orphan_pages.each do |p, page_name|
    s << %Q!<li>#{hiki_anchor(p.escape, page_name)}</li>\n!
  end

  s << "</ul>\n"
end

export_plugin_methods(:orphan)