From 6ca570e8fc2d9176486129570a45055f01ec9636 Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 17 Apr 2006 21:34:08 +0000 Subject: [PATCH] mjaammmm --- neinomat-uebersichten | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/neinomat-uebersichten b/neinomat-uebersichten index a7a7b2b..45b9414 100755 --- a/neinomat-uebersichten +++ b/neinomat-uebersichten @@ -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