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.

59 lines
1.1 KiB
Plaintext

17 years ago
#!/usr/bin/env ruby
$:.unshift('vendor/ruby-mediawiki/lib')
require 'mediawiki/dotfile'
@wiki = MediaWiki.dotfile(nil,'entropia')
roh = @wiki.article("Vorlage:GPN7:Fahrplan").text
17 years ago
def cleanse (t)
t.gsub(/\[\[.*\|(.*)\]\]/, '\1')
end
uhrzeit = nil
titel1 = nil
titel2 = nil
17 years ago
titel3 = nil
17 years ago
tag = 1
roh.split("\n").each do |line|
if line =~ /^\| *(.*:[0-9]+) *$/
17 years ago
if uhrzeit
puts "#{tag} #{uhrzeit} ÜBERALL #{titel1}" if titel1
puts "#{tag} #{uhrzeit} NIRGENDS #{titel2}" if titel2
puts "#{tag} #{uhrzeit} IRGENDWO #{titel3}" if titel3
17 years ago
end
if uhrzeit && $1 < uhrzeit
tag += 1
end
uhrzeit = $1
titel1 = nil
titel2 = nil
17 years ago
titel3 = nil
elsif line =~ /^\|(?: *(?:valign=top|align=center) *\|)? *('''(.*)'''|.*(GOTO).*)\s*$/
17 years ago
# yum
17 years ago
if $3 == "GOTO"
17 years ago
# *frickl*
if line =~ /colspan=2/
titel1 = ""
end
17 years ago
t = ""
else
17 years ago
t = $2
17 years ago
end
17 years ago
if titel1 == nil
17 years ago
titel1 = cleanse(t)
elsif titel2 == nil
titel2 = cleanse(t)
else
titel3 = cleanse(t)
17 years ago
end
end
end