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.3 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')
$:.unshift('vendor/htree')
require 'mediawiki/dotfile'
@wiki = MediaWiki.dotfile(nil,'entropia')
2005-10-01 16:26:34 +00:00
2006-04-17 14:59:44 +00:00
def category_checker (page, category)
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|
re = Regexp.new(Regexp.escape("title='" + CGI.escapeHTML(title)))
if ! re.match(page_html) && title != page
body += "* [[" + title + "]]\n"
count += 1
end
end
body += "\n#{count} Artikel.\n"
return body
2005-10-01 16:26:34 +00:00
end
#----------------------------------------------------------------------------
def fasel (page, category)
fasel_title = "Benutzer:Neinomat/#{page}"
2006-04-17 14:59:44 +00:00
body_old = @wiki.article(fasel_title).text
body_new = category_checker(page, category).gsub(/\n*$/sm, "")
2005-10-02 21:09:17 +00:00
2006-04-17 14:59:44 +00:00
if body_old != body_new
a = @wiki.article(fasel_title)
a.text = body_new
a.submit("wiki ex machina")
end
2005-10-02 21:09:17 +00:00
end
2006-04-17 14:59:44 +00:00
#----------------------------------------------------------------------------
fasel("Übersicht über Vorträge", "Kategorie:Vorträge")
fasel("Übersicht über Projekte", "Kategorie:Projekte")
fasel("Entropia:FIXME", "Kategorie:FIXME")