neingeist
/
neinomaten
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
neinomaten/neinomat-uebersichten

46 lines
1.3 KiB
Plaintext

19 years ago
#!/usr/bin/env ruby
19 years ago
$:.unshift('vendor/ruby-mediawiki/lib')
$:.unshift('vendor/htree')
require 'mediawiki/dotfile'
@wiki = MediaWiki.dotfile(nil,'entropia')
19 years ago
19 years ago
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
19 years ago
end
#----------------------------------------------------------------------------
def fasel (page, category)
fasel_title = "Benutzer:Neinomat/#{page}"
19 years ago
body_old = @wiki.article(fasel_title).text
body_new = category_checker(page, category).gsub(/\n*$/sm, "")
19 years ago
19 years ago
if body_old != body_new
a = @wiki.article(fasel_title)
a.text = body_new
a.submit("wiki ex machina")
end
19 years ago
end
19 years ago
#----------------------------------------------------------------------------
fasel("Übersicht über Vorträge", "Kategorie:Vorträge")
fasel("Übersicht über Projekte", "Kategorie:Projekte")
fasel("Entropia:FIXME", "Kategorie:FIXME")