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