neingeist
/
neinomaten
Archived
1
0
Fork 0
master
neingeist 19 years ago
parent 08a815fbc3
commit 5333fa06f5

@ -0,0 +1,33 @@
#!/usr/bin/env ruby
$:.unshift('vendor/ruby-mediawiki/lib')
$:.unshift('vendor/htree')
require 'mediawiki/dotfile'
@wiki = MediaWiki.dotfile(nil,'entropia')
def is_redirect?(title)
@wiki.article(title).text =~ /REDIRECT/
end
def check_category(title_re, category)
category_articles = @wiki.category(category).articles
missing = []
@wiki.allpages.delete_if { |t| t !~ title_re }.each do |title|
if !is_redirect?(title) && !category_articles.member?(title)
missing << title
end
end
if missing.size > 0
puts "Folgenden Artikel fehlt die Kategorie: #{category}\n"
missing.each do |t|
puts t.chomp
end
puts
end
end
check_category(/GPN/, "GPN")
(1..5).each do |n|
check_category(/GPN#{n}/, "GPN#{n}")
end