ssmd 0.2.2 → 0.2.3
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/SPECIFICATION.md +2 -2
- data/lib/ssmd.rb +1 -1
- data/lib/ssmd/converter.rb +6 -18
- data/lib/ssmd/processors/annotation_processor.rb +2 -2
- data/lib/ssmd/processors/emphasis_processor.rb +0 -2
- data/lib/ssmd/processors/mark_processor.rb +0 -2
- data/lib/ssmd/processors/processor.rb +10 -0
- data/lib/ssmd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 221fb4fbe3144a2331545c9ac3ab79a0dc4933b4
|
4
|
+
data.tar.gz: 508c4b8101fad140db26dc76350e45dc0d324d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511a816ea8a953420f4a7bb7433fed1618c4c68f872add28efc73c38ff2045718fddedd134c5629682e1071d24085e0e484084368db36a1db2d16339ef534725
|
7
|
+
data.tar.gz: 23d2381df4964f49dfb0bf3f377fd2d0a827b6ebcb580a82be145cdf9034008e7a896d3765cf1dc844bef1599e7988c607aa3b98ec4087bb15bcde125a9bd4a9
|
data/SPECIFICATION.md
CHANGED
data/lib/ssmd.rb
CHANGED
data/lib/ssmd/converter.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'ssmd/processors'
|
2
|
-
require 'rexml/document'
|
3
2
|
|
4
3
|
module SSMD
|
5
4
|
class Converter
|
@@ -10,7 +9,7 @@ module SSMD
|
|
10
9
|
end
|
11
10
|
|
12
11
|
def convert
|
13
|
-
result = processors.inject(input) do |text, processor|
|
12
|
+
result = processors.inject(input.encode(xml: :text)) do |text, processor|
|
14
13
|
process processor.new, text
|
15
14
|
end
|
16
15
|
|
@@ -18,20 +17,8 @@ module SSMD
|
|
18
17
|
end
|
19
18
|
|
20
19
|
def strip
|
21
|
-
|
22
|
-
|
23
|
-
if doc.root
|
24
|
-
xml_text doc.root
|
25
|
-
else
|
26
|
-
input # no XML so we assume it is already stripped
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def xml_text(node)
|
31
|
-
if node.is_a? REXML::Text
|
32
|
-
node.to_s
|
33
|
-
else
|
34
|
-
node.children.map { |c| xml_text c }.join
|
20
|
+
processors.inject(input) do |text, processor|
|
21
|
+
process processor.new, text, strip: true
|
35
22
|
end
|
36
23
|
end
|
37
24
|
|
@@ -43,9 +30,10 @@ module SSMD
|
|
43
30
|
]
|
44
31
|
end
|
45
32
|
|
46
|
-
def process(processor, input)
|
33
|
+
def process(processor, input, strip: false)
|
47
34
|
if processor.matches? input
|
48
|
-
|
35
|
+
result = strip ? processor.strip_ssmd(input) : processor.substitute(input)
|
36
|
+
process processor, result, strip: strip
|
49
37
|
else
|
50
38
|
input
|
51
39
|
end
|
@@ -4,10 +4,10 @@ require 'ssmd/annotations'
|
|
4
4
|
|
5
5
|
module SSMD::Processors
|
6
6
|
class AnnotationProcessor < Processor
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :annotations
|
8
8
|
|
9
9
|
def result
|
10
|
-
|
10
|
+
_, annotations_text = match.captures
|
11
11
|
|
12
12
|
if annotations_text
|
13
13
|
@annotations = combine_annotations parse_annotations(annotations_text)
|
data/lib/ssmd/version.rb
CHANGED