doctor_ninja 0.1.1 → 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 +4 -4
- data/lib/doctor_ninja/parsers/list.rb +14 -1
- data/lib/doctor_ninja/version.rb +1 -1
- data/test/fixtures/ordered_list.docx +0 -0
- data/test/fixtures/ordered_list_types.docx +0 -0
- data/test/lists_test.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe8fd91a3de8937deab6a585f38d76743898aa4f
|
4
|
+
data.tar.gz: 27a1aeaa6bcc3dfb5e229afc445eb5e76ad958c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b655b1e2c22c566245f9d48c790b3269f721213dc280c927516ba9e6211ba259511173764863781f798588fcdf81d7b10e84d151d8d765851b7576f7db2e8d93
|
7
|
+
data.tar.gz: 67adfd6175c4d8492397ac2658bca650c3083359147307b6a92dde97a1b5e94a00994776dd261755909b89919d0bc972ffe77910b7341fef673e495841d589b1
|
@@ -10,6 +10,19 @@ class DoctorNinja::Parsers::List < DoctorNinja::Parsers::Base
|
|
10
10
|
lvl = get_pr "w:ilvl", @node
|
11
11
|
style = @document.numbering.style(lvl, num_id)
|
12
12
|
tag = style == "bullet" ? "ul" : "ol"
|
13
|
+
type = case style
|
14
|
+
when "lowerRoman"
|
15
|
+
"i"
|
16
|
+
when "upperRoman"
|
17
|
+
"I"
|
18
|
+
when "lowerLetter"
|
19
|
+
"a"
|
20
|
+
when "upperLetter"
|
21
|
+
"A"
|
22
|
+
else
|
23
|
+
""
|
24
|
+
end
|
25
|
+
typeAttr = type == "" ? "" : "type='#{type}'"
|
13
26
|
|
14
27
|
num_id_query = ".//w:numId/@w:val=\"#{num_id}\""
|
15
28
|
|
@@ -19,7 +32,7 @@ class DoctorNinja::Parsers::List < DoctorNinja::Parsers::Base
|
|
19
32
|
prefix = ""
|
20
33
|
# Add <ul> if is start of new list
|
21
34
|
if previous.length == 0 || get_pr("w:ilvl", previous) < lvl
|
22
|
-
prefix += "<#{tag}>"
|
35
|
+
prefix += "<#{tag}#{typeAttr}>"
|
23
36
|
end
|
24
37
|
|
25
38
|
prefix += "<li>"
|
data/lib/doctor_ninja/version.rb
CHANGED
Binary file
|
Binary file
|
data/test/lists_test.rb
CHANGED
@@ -33,4 +33,14 @@ class ListsTest < MiniTest::Test
|
|
33
33
|
HTML
|
34
34
|
assert_includes strip_spaces(result), strip_spaces(bullet2)
|
35
35
|
end
|
36
|
+
|
37
|
+
def test_ordered_list_types
|
38
|
+
result = parse_file "test/fixtures/ordered_list_types.docx"
|
39
|
+
result = strip_spaces(result)
|
40
|
+
assert_includes result, "<ol><li>Decimal</li></ol>"
|
41
|
+
assert_includes result, "<oltype='i'><li>LowerRoman</li></ol>"
|
42
|
+
assert_includes result, "<oltype='I'><li>UpperRoman</li></ol>"
|
43
|
+
assert_includes result, "<oltype='a'><li>LowerAlpha</li></ol>"
|
44
|
+
assert_includes result, "<oltype='A'><li>UpperAlpha</li></ol>"
|
45
|
+
end
|
36
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doctor_ninja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernardo Amorim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- test/fixtures/invalid_file.docx
|
182
182
|
- test/fixtures/limites.docx
|
183
183
|
- test/fixtures/ordered_list.docx
|
184
|
+
- test/fixtures/ordered_list_types.docx
|
184
185
|
- test/fixtures/unordered_list.docx
|
185
186
|
- test/images_test.rb
|
186
187
|
- test/integration_test.rb
|
@@ -222,6 +223,7 @@ test_files:
|
|
222
223
|
- test/fixtures/invalid_file.docx
|
223
224
|
- test/fixtures/limites.docx
|
224
225
|
- test/fixtures/ordered_list.docx
|
226
|
+
- test/fixtures/ordered_list_types.docx
|
225
227
|
- test/fixtures/unordered_list.docx
|
226
228
|
- test/images_test.rb
|
227
229
|
- test/integration_test.rb
|