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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db1ad5b209ae3e6a5226f9358390542805b662e6
4
- data.tar.gz: 0bc93c3b04997461dd39fea952808b1151dae903
3
+ metadata.gz: fe8fd91a3de8937deab6a585f38d76743898aa4f
4
+ data.tar.gz: 27a1aeaa6bcc3dfb5e229afc445eb5e76ad958c9
5
5
  SHA512:
6
- metadata.gz: 73822b4d67bf11d24c064b8703722b58ff99bca1ce7a7324afdd5c38cefe8273f630db60677bdf5d60d645583ffda0e753e9de96e761463cbf910cfa94926c1d
7
- data.tar.gz: 3aa6cf7073e3e26294306f09e337298a3d015dd5b9bda65bed2c6d82c59250ced21077f00024db83f3b333284b2a0aef8fae19a31093b73503f9a5dc5bb93ee5
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>"
@@ -1,3 +1,3 @@
1
1
  module DoctorNinja
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.1
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-15 00:00:00.000000000 Z
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