Belgrade Model EU 2015 Documents
on Model EU, Linux, Ruby
Dear participants of the Model European Union simulation 20beum15, I totally support the aim of the simulation organisers to print less paper during the conference.
So I will provide, as I did last time, the legal texts in various eBook formats! The texts used for the conference are shortened! The original sources are probably these ones:
- Regulation:
- http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=uriserv:OJ.L_.2015.169.01.0001.01.ENG
- Directive:
- http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=OJ:JOL_2015_068_R_0001
Regulation
Source: https://gallery.mailchimp.com/a9ddb05b2c9bf890d75b042ac/files/BEUM2015_Regulation.docx
In English:
Directive
Source: https://gallery.mailchimp.com/a9ddb05b2c9bf890d75b042ac/files/BEUM2015_Directive.docx
In English:
How it is done
Save the following ruby script in an executable file called formatter.rb
.
#!/usr/bin/env ruby
if ARGV.first == "--help" or ARGV.size == 0
puts <<-EOF
usage: formatter.rb SOURCE_FILE
Creates ebooks in various formats and if there is a pdf with same name in
same folder, it creates a booklet ready for duplex printing (long-edge).
Source file has to be supported by libreoffice. Requires libreoffice (soffice),
pdfjam (pdfbook), and calibre (ebook-convert)
Copyright 2014 Robert Riemann - licensed under GPL v2 or higher.
EOF
exit
end
source = File.expand_path ARGV.first
abort("ERROR: File #{source} doesn't exist.") unless File.exists? source
basename = File.basename source, '.*'
puts "source #{source}"
# prepare for input filter of ebook-convert
# %x[soffice --headless --convert-to docx #{source}]
docxfile = basename + '.docx'
# convert to ebook
%x[ebook-convert #{docxfile} #{basename}.mobi] # kindle old
%x[ebook-convert #{docxfile} #{basename}.azw3] # kindle new
%x[ebook-convert #{docxfile} #{basename}.epub] # default, legacy
# is there a pdf ?
# pdffile = "#{File.dirname(source)}/#{basename}.pdf"
# puts "pdf #{pdffile}"
# if File.exists? pdffile
# %x[pdfbook --booklet false --signature '32' --suffix 'booklet' #{pdffile}]
# end