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

47 lines
1.4 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')
@putwhere = "Benutzer:Neinomat/"
19 years ago
19 years ago
def link_to (title)
if /^(Category|Kategorie):/.match(title)
link = "[[:" + title + "]]"
else
link = "[[" + title + "]]"
end
link
end
def check_page_against_category (page, category)
19 years ago
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|
19 years ago
# mjaammm...
re = Regexp.new("(" + Regexp.escape("title=") + "(\"|')" +
Regexp.escape(CGI.escapeHTML(title)) + "(\"|')" +
"|>" + Regexp.escape(title) + "<)")
if ! re.match(page_html) && title != page && title != @putwhere + page
19 years ago
body += "* " + link_to(title) + "\n"
19 years ago
count += 1
end
end
body += "\n#{count} Artikel.\n"
19 years ago
a = @wiki.article(@putwhere + page)
a.text = body
a.submit("wiki ex machina")
19 years ago
end
19 years ago
#----------------------------------------------------------------------------
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")