|
|
|
@ -4,6 +4,15 @@ $:.unshift('vendor/htree')
|
|
|
|
|
require 'mediawiki/dotfile'
|
|
|
|
|
@wiki = MediaWiki.dotfile(nil,'entropia')
|
|
|
|
|
|
|
|
|
|
def link_to (title)
|
|
|
|
|
if /^(Category|Kategorie):/.match(title)
|
|
|
|
|
link = "[[:" + title + "]]"
|
|
|
|
|
else
|
|
|
|
|
link = "[[" + title + "]]"
|
|
|
|
|
end
|
|
|
|
|
link
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def check_page_against_category (page, category)
|
|
|
|
|
body = "== #{page} ==\n\n"
|
|
|
|
|
body += "[[Category:FIXME]]\n\n"
|
|
|
|
@ -12,9 +21,12 @@ def check_page_against_category (page, category)
|
|
|
|
|
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)))
|
|
|
|
|
# mjaammm...
|
|
|
|
|
re = Regexp.new("(" + Regexp.escape("title=") + "(\"|')" +
|
|
|
|
|
Regexp.escape(CGI.escapeHTML(title)) + "(\"|')" +
|
|
|
|
|
"|>" + Regexp.escape(title) + "<)")
|
|
|
|
|
if ! re.match(page_html) && title != page
|
|
|
|
|
body += "* [[" + title + "]]\n"
|
|
|
|
|
body += "* " + link_to(title) + "\n"
|
|
|
|
|
count += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|