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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7926744caec7f509bb70754bda4dfb77ffa68dcd72566de3489162d9fd215ea
4
- data.tar.gz: 8899b2137302c1e95862a0db9bae954bc7e055b1f45ef65c384984b82da5cfb2
3
+ metadata.gz: 994be76991ee4ae983a808d051d872c455a2264f3bf2b6d921283aca2d35e579
4
+ data.tar.gz: 3aece95c07d6bf27ffbef7f71f3e1e1cc1ef086a4e3ee5d0c5a4d2cd7a0c1a4c
5
5
  SHA512:
6
- metadata.gz: 946d6c7f401224daafb65c57b1a9e33ba9a7b2c887a7149e02228d19c38a8d9c8f2bc511ec56a49f536e6ab1fb02338a45493ccfc2279ab710cbe11f30b7c4cb
7
- data.tar.gz: ffcea2097a1e359d0ab8715059309dcd86775ce553211862bd95e0ef2d94f75bd4dcf389c3889c5e1f39ee02e569b7be78f395039c9a28a57bee0654bf5489d4
6
+ metadata.gz: 8754d732547c5e5ca22e85e8d9f3160849ead6f4e939c5e91a0ce54ebfa84258ea1bb27f8e26b7b153f0ce18dada2c08830a06f1ae2a9d4d6d51ab8fb6b7d293
7
+ data.tar.gz: 233c7229e06286a0e3f6a4766be8a1449bd2b56e38cd786c3ef1ef8a85f0deff09473a0890e160b960727d99b31a08d8769e6a4707fd2a51d3d500d05c1a616f
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.6.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- song_pro (0.1.1)
4
+ song_pro (0.1.2)
5
5
  markaby
6
6
 
7
7
  GEM
@@ -54,4 +54,4 @@ DEPENDENCIES
54
54
  song_pro!
55
55
 
56
56
  BUNDLED WITH
57
- 1.16.4
57
+ 1.17.2
data/README.md CHANGED
@@ -1,10 +1,8 @@
1
- # SongPro [![Build Status](https://travis-ci.org/spilth/song_pro.svg?branch=master)](https://travis-ci.org/spilth/song_pro)
1
+ # SongPro for Ruby [![Build Status](https://travis-ci.org/spilth/song_pro.svg?branch=master)](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 that can then be converted into various output formats such as text or HTML.
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/spilth/song_pro>.
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
@@ -11,10 +11,16 @@ class Song
11
11
  :year,
12
12
  :album,
13
13
  :tuning,
14
- :sections
14
+ :sections,
15
+ :custom
15
16
 
16
17
  def initialize
17
18
  @sections = []
19
+ @custom = {}
20
+ end
21
+
22
+ def set_custom(key, value)
23
+ @custom[key.to_sym] = value
18
24
  end
19
25
 
20
26
  def to_html
@@ -1,3 +1,3 @@
1
1
  module SongPro
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
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.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: 2018-09-30 00:00:00.000000000 Z
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
- rubyforge_project:
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