% cols = 4 % chords = [] % chords += keytable.tagged(:normal).map{|key| keyboard.find{|chord| % key === chord and chord[0][1].empty?} %} % chords += keytable.find_all{|key| key.has_mod?("Shift")}.map{|key| keyboard.find{|chord| % key === chord and (chord[0][1] == ["RSft"] or chord[0][1] == ["LSft"])} %} % chords += keytable.tagged(:special).map{|key| keyboard.find{|chord| % key === chord and chord[0][1].empty?} %} % chords += keyboard.find_all{|chord| !chord.single?} % chords.compact! % % columns = [] % chords.map! do |chord| % rendered= [ chord.render_action, chord.render_keys] % if rendered[0] =~ /^[a-z]$/ % rendered[0].upcase! % end % rendered %end % chords.each_slice((chords.length / cols.to_f).ceil){|col| columns << col} % act_widths = columns.map{|col| col.map{|line| line[0].length}.max} % key_widths = columns.map{|col| col.map{|line| line[1].length}.max} % columns[0].zip(*columns[1..-1]).each_with_index do |row, index| % row.zip(act_widths, key_widths).each do |chord, aw, kw| % unless chord.nil? <%= chord[0].rjust(aw) %>: <%= chord[1].ljust(kw + 2)%> % end % end % end %mouse.each do |chord| <%= chord.render %> %end