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.
43 lines
730 B
Plaintext
43 lines
730 B
Plaintext
18 years ago
|
#!/usr/bin/env ruby
|
||
|
$:.unshift('vendor/ruby-mediawiki/lib')
|
||
|
require 'mediawiki/dotfile'
|
||
|
@wiki = MediaWiki.dotfile(nil,'entropia')
|
||
|
|
||
|
roh = @wiki.article("Vorlage:GPN6:Fahrplan").text
|
||
|
|
||
|
def cleanse (t)
|
||
|
t.gsub(/\[\[.*\|(.*)\]\]/, '\1')
|
||
|
end
|
||
|
|
||
|
uhrzeit = nil
|
||
|
titel1 = nil
|
||
|
titel2 = nil
|
||
|
tag = 1
|
||
|
|
||
|
roh.split("\n").each do |line|
|
||
|
|
||
|
if line =~ /^\| *(.*:00) *$/
|
||
|
if uhrzeit
|
||
|
puts "#{tag} #{uhrzeit} KLAMMER AUF #{titel1}"
|
||
|
puts "#{tag} #{uhrzeit} KLAMMER ZU #{titel2}"
|
||
|
end
|
||
|
|
||
|
if uhrzeit && $1 < uhrzeit
|
||
|
tag += 1
|
||
|
end
|
||
|
|
||
|
uhrzeit = $1
|
||
|
titel1 = nil
|
||
|
titel2 = nil
|
||
|
end
|
||
|
|
||
|
if line =~/^\| *'''(.*)''' *$/
|
||
|
if titel1 == nil
|
||
|
titel1 = cleanse($1)
|
||
|
else
|
||
|
titel2 = cleanse($1)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|