1 # vim: fileencoding=UTF-8 ft=ruby syn=ruby ts=2 sw=2 ai eol et si
3 # Copyright (c) 2009 Marc Rummel <mailto:Marc.Rummel+Akkordarbeit@GoogleMail.Com>
4 # This code is licensed under the terms of the MIT License (see LICENSE.rdoc)
6 libdir = File.expand_path(File.dirname __FILE__).gsub(/(.*lib).*?/, '\1')
7 $LOAD_PATH.unshift libdir unless $LOAD_PATH.include? libdir
11 def format(parsetree, title = nil)
13 output << '=' * (title.length + 2) << "\n" << ' ' << title << "\n" << '=' * (title.length + 2) << "\n" if title
14 parsetree.each do |section|
15 section.each do |line|
16 chords, lyrics = '', ''
23 chords << ' ' * (lyrics.length - chords.length)
26 output << chords.rstrip << "\n" << lyrics.rstrip << "\n"