ssmd 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 6818a5bb8c25e44cf95522fe1a5d0852a9114c9d
4
- data.tar.gz: ca1ff40b6e7a5f51900ceea642771b959bcdb41b
3
+ metadata.gz: 6340136ac0c4236cc24f2fd3cb67df638493de66
4
+ data.tar.gz: f68b66dc89d274be391a1d619c3e4009373c6cf8
5
5
  SHA512:
6
- metadata.gz: 9e6ff09b5251da93e455a8731ccf624881abf4e52da4c18369c6bd55d413d059f2e7c77f8aec7070e7d530f1c27cab76a65d73534f70c196d9773070070251f8
7
- data.tar.gz: 4c8e7b110e9e48ac65e3e957cb4b2b30535fa6e5811503f24ff62b3355003001168f969caa33a9288b9f3b6570c24bdace187eea0008c9fd2939342701b614f6
6
+ metadata.gz: 3d141f04d275321f0e8ee7de922d0f2ac2ff17522bd4b5f2ccc08ab474a12e104be9bd4c18508fb2ca3beeda8158fbc324dc251e8c1c19cfbabf5e0734ef9378
7
+ data.tar.gz: 151150b975fac263122225e2a9b73c8006490200f53d23338e643fdcdcbe02679d572d6fe328a651a8f14dd4f52842cf14029b0f7ce42ed7f4ab64d6ed24e0b5
data/README.md CHANGED
@@ -32,9 +32,9 @@ Or install it yourself as:
32
32
  require 'ssmd'
33
33
 
34
34
  ssmd = "hello *SSMD*!"
35
- ssmd = SSMD.to_ssml ssmd
35
+ ssml = SSMD.to_ssml ssmd
36
36
 
37
- puts ssmd
37
+ puts ssml
38
38
  # Output: <speak>hello <emphasis>SSMD</emphasis>!</speak>
39
39
  ```
40
40
 
@@ -8,6 +8,15 @@ module SSMD
8
8
  Converter.new(ssmd).convert
9
9
  end
10
10
 
11
+ ##
12
+ # Returns the given string without any SSMD annotations.
13
+ # For instance for `hello *world*` would return `hello world`.
14
+ #
15
+ # @return [String]
16
+ def strip_ssmd(ssmd)
17
+ Converter.new(ssmd).strip
18
+ end
19
+
11
20
  def root_dir
12
21
  Gem::Specification.find_by_name("ssmd").gem_dir
13
22
  end
@@ -1,4 +1,5 @@
1
1
  require 'ssmd/processors'
2
+ require 'rexml/document'
2
3
 
3
4
  module SSMD
4
5
  class Converter
@@ -16,6 +17,20 @@ module SSMD
16
17
  "<speak>#{result.strip}</speak>"
17
18
  end
18
19
 
20
+ def strip
21
+ doc = ::REXML::Document.new input
22
+
23
+ xml_text doc.root
24
+ end
25
+
26
+ def xml_text(node)
27
+ if node.is_a? REXML::Text
28
+ node.to_s
29
+ else
30
+ node.children.map { |c| xml_text c }.join
31
+ end
32
+ end
33
+
19
34
  def processors
20
35
  p = SSMD::Processors
21
36
 
@@ -1,3 +1,3 @@
1
1
  module SSMD
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Kahl
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-13 00:00:00.000000000 Z
11
+ date: 2017-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler