1
0
Fork 0
This repository has been archived on 2019-12-19. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
neinomaten/neinomat-uebersichten

46 lines
1.4 KiB
Text
Raw Normal View History

2005-10-01 16:26:34 +00:00
#!/usr/bin/env ruby
2006-04-17 14:59:44 +00:00
$:.unshift('vendor/ruby-mediawiki/lib')
require 'mediawiki/dotfile'
@wiki = MediaWiki.dotfile(nil,'entropia')
2006-04-17 21:47:34 +00:00
@putwhere = "Benutzer:Neinomat/"
2005-10-01 16:26:34 +00:00
2006-04-17 21:34:08 +00:00
def link_to (title)
if /^(Category|Kategorie):/.match(title)
link = "[[:" + title + "]]"
else
link = "[[" + title + "]]"
end
link
end
2006-04-17 20:51:17 +00:00
def check_page_against_category (page, category)
2006-04-17 14:59:44 +00:00
body = "== #{page} ==\n\n"
body += "[[Category:FIXME]]\n\n"
body += "Unter [[#{page}]] fehlen folgende Artikel aus [[:#{category}]]:\n\n"
count = 0
page_html = @wiki.article(page).xhtml.to_s
@wiki.category(category).articles.each do |title|
2006-04-17 21:34:08 +00:00
# mjaammm...
re = Regexp.new("(" + Regexp.escape("title=") + "(\"|')" +
Regexp.escape(CGI.escapeHTML(title)) + "(\"|')" +
"|>" + Regexp.escape(title) + "<)")
2006-08-29 15:15:03 +00:00
if ! re.match(page_html) && title != page && title.to_s !~ /#{@putwhere}/
2006-04-17 21:34:08 +00:00
body += "* " + link_to(title) + "\n"
2006-04-17 14:59:44 +00:00
count += 1
end
end
body += "\n#{count} Artikel.\n"
2005-10-01 16:26:34 +00:00
2006-04-17 21:47:34 +00:00
a = @wiki.article(@putwhere + page)
2006-04-17 20:51:17 +00:00
a.text = body
a.submit("wiki ex machina")
2005-10-02 21:09:17 +00:00
end
2006-04-17 14:59:44 +00:00
#----------------------------------------------------------------------------
2006-04-17 20:51:17 +00:00
check_page_against_category("Übersicht über Vorträge", "Kategorie:Vorträge")
check_page_against_category("Übersicht über Projekte", "Kategorie:Projekte")
check_page_against_category("Entropia:FIXME", "Kategorie:FIXME")