song_pro 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +5 -41
- data/lib/song_pro/song.rb +7 -1
- data/lib/song_pro/version.rb +1 -1
- data/lib/song_pro.rb +12 -0
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 994be76991ee4ae983a808d051d872c455a2264f3bf2b6d921283aca2d35e579
|
|
4
|
+
data.tar.gz: 3aece95c07d6bf27ffbef7f71f3e1e1cc1ef086a4e3ee5d0c5a4d2cd7a0c1a4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8754d732547c5e5ca22e85e8d9f3160849ead6f4e939c5e91a0ce54ebfa84258ea1bb27f8e26b7b153f0ce18dada2c08830a06f1ae2a9d4d6d51ab8fb6b7d293
|
|
7
|
+
data.tar.gz: 233c7229e06286a0e3f6a4766be8a1449bd2b56e38cd786c3ef1ef8a85f0deff09473a0890e160b960727d99b31a08d8769e6a4707fd2a51d3d500d05c1a616f
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.6.1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
# SongPro [](https://travis-ci.org/spilth/song_pro)
|
|
1
|
+
# SongPro for Ruby [](https://travis-ci.org/spilth/song_pro)
|
|
2
2
|
|
|
3
|
-
SongPro is a text format for transcribing songs.
|
|
3
|
+
[SongPro](https://songpro.org) is a text format for transcribing songs.
|
|
4
4
|
|
|
5
|
-
This project is a Ruby Gem that converts the song into a data model
|
|
6
|
-
|
|
7
|
-
It is heavily inspired by [ChordPro](https://www.chordpro.org/).
|
|
5
|
+
This project is a Ruby Gem that converts the song into a Song data model which can then be converted into various output formats such as text or HTML.
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
@@ -60,40 +58,6 @@ puts song.sections[1].title
|
|
|
60
58
|
# Verse 1
|
|
61
59
|
|
|
62
60
|
```
|
|
63
|
-
## SongPro Format
|
|
64
|
-
|
|
65
|
-
- Attributes are declared using: `@key=value`
|
|
66
|
-
- Sections are declared using: `# Section Name`
|
|
67
|
-
- Chords are declared using: `[Xy#]`
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
@title=Bad Moon Rising
|
|
71
|
-
@artist=Cleedence Clearwater Revival
|
|
72
|
-
|
|
73
|
-
# Intro
|
|
74
|
-
|
|
75
|
-
[D][A][G][D]
|
|
76
|
-
|
|
77
|
-
# Verse 1
|
|
78
|
-
|
|
79
|
-
[D]I see a [A]bad [G]moon a-[D]rising
|
|
80
|
-
[D]I see [A]trouble [G]on the [D]way
|
|
81
|
-
[D]I see [A]earth-[G]quakes and [D]lightnin'
|
|
82
|
-
[D]I see [A]bad [G]times to-[D]day
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Song Object
|
|
86
|
-
|
|
87
|
-
- a **Song** can have a Title
|
|
88
|
-
- a **Song** can have an Artist
|
|
89
|
-
- a **Song** has zero or more **Sections**
|
|
90
|
-
- a **Section** has zero or more **Lines**
|
|
91
|
-
- a **Line** has one or more **Parts**
|
|
92
|
-
- a **Part** has a **Chord** and **Lyric**
|
|
93
|
-
- a **Chord** is the textual representation of a single chord
|
|
94
|
-
- this may be empty
|
|
95
|
-
- a **Lyric** is the textual representation of lyrics
|
|
96
|
-
- this may be empty
|
|
97
61
|
|
|
98
62
|
## Development
|
|
99
63
|
|
|
@@ -103,8 +67,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
103
67
|
|
|
104
68
|
## Contributing
|
|
105
69
|
|
|
106
|
-
Bug reports and pull requests are welcome on GitHub at <https://github.com/
|
|
70
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/SongProOrg/songpro-ruby>.
|
|
107
71
|
|
|
108
72
|
## License
|
|
109
73
|
|
|
110
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
74
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/song_pro/song.rb
CHANGED
data/lib/song_pro/version.rb
CHANGED
data/lib/song_pro.rb
CHANGED
|
@@ -9,6 +9,7 @@ require 'song_pro/part'
|
|
|
9
9
|
module SongPro
|
|
10
10
|
SECTION_REGEX = /#\s*([^$]*)/
|
|
11
11
|
ATTRIBUTE_REGEX = /@(\w*)=([^%]*)/
|
|
12
|
+
CUSTOM_ATTRIBUTE_REGEX = /!(\w*)=([^%]*)/
|
|
12
13
|
CHORDS_AND_LYRICS_REGEX = /(\[[\w#b\/]+\])?([\w\s',.!\(\)_\-"]*)/i
|
|
13
14
|
|
|
14
15
|
def self.parse(lines)
|
|
@@ -18,6 +19,8 @@ module SongPro
|
|
|
18
19
|
lines.split("\n").each do |text|
|
|
19
20
|
if text.start_with?('@')
|
|
20
21
|
process_attribute(song, text)
|
|
22
|
+
elsif text.start_with?('!')
|
|
23
|
+
process_custom_attribute(song, text)
|
|
21
24
|
elsif text.start_with?('#')
|
|
22
25
|
current_section = process_section(song, text)
|
|
23
26
|
else
|
|
@@ -49,6 +52,15 @@ module SongPro
|
|
|
49
52
|
end
|
|
50
53
|
end
|
|
51
54
|
|
|
55
|
+
def self.process_custom_attribute(song, text)
|
|
56
|
+
matches = CUSTOM_ATTRIBUTE_REGEX.match(text)
|
|
57
|
+
key = matches[1]
|
|
58
|
+
value = matches[2].strip
|
|
59
|
+
|
|
60
|
+
song.set_custom(key, value)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
|
|
52
64
|
def self.process_lyrics_and_chords(song, current_section, text)
|
|
53
65
|
return if text == ''
|
|
54
66
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: song_pro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Kelly
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-02-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: markaby
|
|
@@ -125,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
126
|
version: '0'
|
|
127
127
|
requirements: []
|
|
128
|
-
|
|
129
|
-
rubygems_version: 2.7.6
|
|
128
|
+
rubygems_version: 3.0.1
|
|
130
129
|
signing_key:
|
|
131
130
|
specification_version: 4
|
|
132
131
|
summary: Converts SongPro files to HTML
|