chords 0.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,7 +49,7 @@ module Chords
|
|
49
49
|
@tuning = Chords::Fretboard::TUNINGS[t.to_sym]
|
50
50
|
end
|
51
51
|
|
52
|
-
@opts.on("--pdf", "Output to pdf. Requires Prawn") do
|
52
|
+
@opts.on("--pdf", "Output to pdf. Requires Prawn.") do
|
53
53
|
begin
|
54
54
|
require 'chords/pdf_formatter'
|
55
55
|
rescue LoadError => e
|
@@ -59,7 +59,7 @@ module Chords
|
|
59
59
|
@formatter = Chords::PDFFormatter
|
60
60
|
end
|
61
61
|
|
62
|
-
@opts.on("--html", "Output to html. Requires RMagick") do
|
62
|
+
@opts.on("--html", "Output to html. Requires RMagick.") do
|
63
63
|
begin
|
64
64
|
require 'chords/html_formatter'
|
65
65
|
rescue LoadError => e
|
@@ -25,11 +25,14 @@ module Chords
|
|
25
25
|
html += get_element(fingering)
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
if opts[:inline]
|
29
|
+
html
|
30
|
+
else
|
31
|
+
File.open('chords.html', 'w') do |file|
|
32
|
+
file.write html
|
33
|
+
end
|
34
|
+
puts "Wrote chords.html"
|
30
35
|
end
|
31
|
-
|
32
|
-
puts "Wrote chords.html"
|
33
36
|
end
|
34
37
|
|
35
38
|
private
|
data/lib/chords/pdf_formatter.rb
CHANGED
@@ -17,16 +17,24 @@ module Chords
|
|
17
17
|
end
|
18
18
|
|
19
19
|
idx = 0
|
20
|
+
output = ''
|
21
|
+
|
20
22
|
while rows.first.length > idx
|
21
23
|
parts = []
|
22
24
|
rows.each_with_index do |row, i|
|
23
25
|
parts << "#{@fretboard.open_notes[i].title.rjust(2, ' ')}: " + row[idx...(idx+75)]
|
24
26
|
end
|
25
|
-
|
27
|
+
output += "\n" + (parts.reverse.join("\n")) + "\n\n"
|
26
28
|
idx += 75
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
output += "Total #{fingerings.size} fingerings."
|
32
|
+
|
33
|
+
if opts[:inline]
|
34
|
+
output
|
35
|
+
else
|
36
|
+
puts output
|
37
|
+
end
|
30
38
|
end
|
31
39
|
|
32
40
|
end
|
metadata
CHANGED