sablon 0.0.19.beta1 → 0.0.19.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a08176b5a9b4646da6f24b4aff58ac09dcbc7cd
4
- data.tar.gz: f2549ddf6142a9ffb02dde86b6a13d9eb38cfbbd
3
+ metadata.gz: 8d201139ea7689ee5ece96bdb890b1241714863a
4
+ data.tar.gz: 43073c128829d00d470669b734ecae7430aaaed6
5
5
  SHA512:
6
- metadata.gz: 1f54003471153af06f163732d84eeab5768e7430f744702062d6868a9ca9f1be6847875b141f7e69ed6e5d4c62957d2f8853dc058696d2bf6234beee9b74a6fd
7
- data.tar.gz: 25731c1257863f69c9b68586041a35e0c2ca85b1d85e01bc6c8c14a2ec569920aa57658a40fc0d7f002681181eba59c1b71e4c0e37f17c3b83157b42f8f5512d
6
+ metadata.gz: 822d41137b73c13abd5102b757f9de9814c822fcb0cffde2e57b0bfc07a978791a5f6d2119671e479cc7aa44a4cd9a616ac4df8e1a8f6f76c0bd357ee6968bcb
7
+ data.tar.gz: 48a8398f40eebe6df13967b37a413702bee477d245b9c93a7d4375c4be51c39639d861fc18614453a71d5f8ccc71d081457057bb07a9c3f2d4b9c65cea7edc19
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sablon (0.0.19.beta1)
4
+ sablon (0.0.19.beta2)
5
5
  nokogiri (>= 1.6.0)
6
6
  redcarpet (>= 3.2)
7
7
  rubyzip (>= 1.1)
@@ -85,7 +85,10 @@ module Sablon
85
85
  private
86
86
  def ast_next_paragraph
87
87
  node = @builder.next
88
- if node.name == 'div' || node.name == 'p'
88
+ if node.name == 'div'
89
+ @builder.new_layer
90
+ @builder.emit Paragraph.new('Normal', text(node.children))
91
+ elsif node.name == 'p'
89
92
  @builder.new_layer
90
93
  @builder.emit Paragraph.new('Paragraph', text(node.children))
91
94
  elsif node.name == 'ul'
@@ -1,3 +1,3 @@
1
1
  module Sablon
2
- VERSION = "0.0.19.beta1"
2
+ VERSION = "0.0.19.beta2"
3
3
  end
Binary file
@@ -11,7 +11,7 @@ class HTMLConverterTest < Sablon::TestCase
11
11
  input = '<div>Lorem ipsum dolor sit amet</div>'
12
12
  expected_output = <<-DOCX.strip
13
13
  <w:p>
14
- <w:pPr><w:pStyle w:val="Paragraph" /></w:pPr>
14
+ <w:pPr><w:pStyle w:val="Normal" /></w:pPr>
15
15
  <w:r><w:t xml:space="preserve">Lorem ipsum dolor sit amet</w:t></w:r>
16
16
  </w:p>
17
17
  DOCX
@@ -33,11 +33,11 @@ DOCX
33
33
  input = '<div>Lorem ipsum</div><div>dolor sit amet</div>'
34
34
  expected_output = <<-DOCX.strip
35
35
  <w:p>
36
- <w:pPr><w:pStyle w:val="Paragraph" /></w:pPr>
36
+ <w:pPr><w:pStyle w:val="Normal" /></w:pPr>
37
37
  <w:r><w:t xml:space="preserve">Lorem ipsum</w:t></w:r>
38
38
  </w:p>
39
39
  <w:p>
40
- <w:pPr><w:pStyle w:val="Paragraph" /></w:pPr>
40
+ <w:pPr><w:pStyle w:val="Normal" /></w:pPr>
41
41
  <w:r><w:t xml:space="preserve">dolor sit amet</w:t></w:r>
42
42
  </w:p>
43
43
  DOCX
@@ -48,7 +48,7 @@ DOCX
48
48
  input = '<div>Lorem ipsum<br>dolor sit amet</div>'
49
49
  expected_output = <<-DOCX.strip
50
50
  <w:p>
51
- <w:pPr><w:pStyle w:val="Paragraph" /></w:pPr>
51
+ <w:pPr><w:pStyle w:val="Normal" /></w:pPr>
52
52
  <w:r><w:t xml:space="preserve">Lorem ipsum</w:t></w:r>
53
53
  <w:r><w:br/></w:r>
54
54
  <w:r><w:t xml:space="preserve">dolor sit amet</w:t></w:r>
@@ -61,7 +61,7 @@ DOCX
61
61
  input = '<div>Lorem&nbsp;<strong>ipsum dolor</strong>&nbsp;sit amet</div>'
62
62
  expected_output = <<-DOCX.strip
63
63
  <w:p>
64
- <w:pPr><w:pStyle w:val="Paragraph" /></w:pPr>
64
+ <w:pPr><w:pStyle w:val="Normal" /></w:pPr>
65
65
  <w:r><w:t xml:space="preserve">Lorem </w:t></w:r>
66
66
  <w:r><w:rPr><w:b /></w:rPr><w:t xml:space="preserve">ipsum dolor</w:t></w:r>
67
67
  <w:r><w:t xml:space="preserve"> sit amet</w:t></w:r>
@@ -74,7 +74,7 @@ DOCX
74
74
  input = '<div>Lorem&nbsp;<em>ipsum dolor</em>&nbsp;sit amet</div>'
75
75
  expected_output = <<-DOCX.strip
76
76
  <w:p>
77
- <w:pPr><w:pStyle w:val="Paragraph" /></w:pPr>
77
+ <w:pPr><w:pStyle w:val="Normal" /></w:pPr>
78
78
  <w:r><w:t xml:space="preserve">Lorem </w:t></w:r>
79
79
  <w:r><w:rPr><w:i /></w:rPr><w:t xml:space="preserve">ipsum dolor</w:t></w:r>
80
80
  <w:r><w:t xml:space="preserve"> sit amet</w:t></w:r>
@@ -265,9 +265,15 @@ class HTMLConverterASTTest < Sablon::TestCase
265
265
  input = '<div>Lorem ipsum dolor sit amet</div>'
266
266
  ast = @converter.processed_ast(input).to_a
267
267
  assert_equal [Sablon::HTMLConverter::Paragraph], ast.map(&:class)
268
- assert_equal ['Paragraph'], ast.map(&:style)
268
+ assert_equal ['Normal'], ast.map(&:style)
269
269
  end
270
270
 
271
+ def test_p
272
+ input = '<p>Lorem ipsum dolor sit amet</p>'
273
+ ast = @converter.processed_ast(input).to_a
274
+ assert_equal [Sablon::HTMLConverter::Paragraph], ast.map(&:class)
275
+ assert_equal ['Paragraph'], ast.map(&:style)
276
+ end
271
277
 
272
278
  def test_ul
273
279
  input = '<ul><li>Lorem</li><li>ipsum</li></ul>'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sablon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19.beta1
4
+ version: 0.0.19.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yves Senn