This page must use the Rübÿ Spëëd Mëtäl Cödïng template!!!111

This commit is contained in:
Astro 2008-06-26 17:12:43 +00:00
parent 4f81937bee
commit e14b810b24
1 changed files with 4 additions and 17 deletions

View File

@ -1,13 +1,9 @@
Generiert Schilder zum Umhängen auf der Demo gegen die Vorratsdatenspeicherung. Nutzung:
ruby vds-badges.rb 23 > vds-badges.fo && fop -fo vds-badges.fo -pdf vds-badges.pdf
Dabei sollte ''chaosknoten.jpg'' im Verzeichnis liegen.
<source lang="ruby">
#!/usr/bin/env ruby
require 'cgi'
NAMEN = ['Wolfgang Schäuble',
'Rudolf Seiters',
'Manfred Kanther',
@ -31,36 +27,30 @@ NAMEN = ['Wolfgang Schäuble',
'Karl Heinz Gasser']
namen1 = NAMEN.collect { |n| n.split(' ')[0..-2].join(' ') }
namen2 = NAMEN.collect { |n| n.split(' ')[-1] }
class Array
def any_one
self[(rand * size)]
end
end
class Symbol
def u2m
to_s.gsub('_', '-')
end
end
class Fixnum
def rjust(*a)
to_s.rjust(*a)
end
end
class Builder
def self.print
puts '<?xml version="1.0" encoding="utf-8"?>'
yield new($stdout)
puts
end
def initialize(output)
@o = output
end
def method_missing(fname, attrs={})
@o << "<#{fname.u2m}"
@o << attrs.collect { |k,v| " #{k}=\"#{CGI::escapeHTML(v)}\"" }.to_s
@ -71,16 +61,13 @@ class Builder
else
@o << '/>'
end
nil
end
end
class BadgeMaker
def initialize(fo)
@fo = fo
end
def make(text)
@fo.page_sequence('master-reference' => 'A4') {
@fo.static_content('flow-name' => 'xsl-region-after') {
@ -99,9 +86,7 @@ class BadgeMaker
}
end
end
n = (ARGV.shift || 1).to_i
XMLNS_FO = 'http://www.w3.org/1999/XSL/Format'
Builder.print { |fo|
fo.root('xmlns' => XMLNS_FO) {
@ -116,7 +101,6 @@ Builder.print { |fo|
'margin-bottom' => '1.5cm')
}
}
n.times {
name = namen1.any_one + ' ' + namen2.any_one
datum = ((rand * 29).to_i + 1).to_s + '.' +
@ -142,5 +126,8 @@ Builder.print { |fo|
}
}
</source>
[[Kategorie:Ruby]]
{{Rübÿ Spëëd Mëtäl Cödïng}}