notare 0.0.7 → 0.0.8
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/notare/builder.rb +4 -2
- data/lib/notare/nodes/paragraph.rb +4 -2
- data/lib/notare/version.rb +1 -1
- data/lib/notare/xml/document_xml.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 640591198560d1f8af9347efe9811d599bf549be9806dd3674545b594e115875
|
|
4
|
+
data.tar.gz: d7132a12a0f4969bd75ad5fff6b90bbd3e6fec6b159d8705a2a010b58717f25d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5457001b7bc515ab41397628d00dce5fc44fe61d9996f7654ea8531f8f17549d43046c24dfcbcc3c9e875141a5e323aaec6ec968da8cfb4da119c58760ada6c6
|
|
7
|
+
data.tar.gz: fc4741d123f29a8e8122673c447f2d883502ca2ac1cfb44bc1a75ed7bc1c7f8e92ff41024524e29e35500f7fe33b055b6b2512cd945425bc04f676367bbfe17f
|
data/lib/notare/builder.rb
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Notare
|
|
4
4
|
module Builder
|
|
5
|
-
def p(text = nil, style: nil, &block)
|
|
6
|
-
para = Nodes::Paragraph.new(style: resolve_style(style)
|
|
5
|
+
def p(text = nil, style: nil, spacing_before: nil, spacing_after: nil, &block)
|
|
6
|
+
para = Nodes::Paragraph.new(style: resolve_style(style),
|
|
7
|
+
spacing_before: spacing_before,
|
|
8
|
+
spacing_after: spacing_after)
|
|
7
9
|
if block
|
|
8
10
|
with_target(para, &block)
|
|
9
11
|
elsif text
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
module Notare
|
|
4
4
|
module Nodes
|
|
5
5
|
class Paragraph < Base
|
|
6
|
-
attr_reader :runs, :style
|
|
6
|
+
attr_reader :runs, :style, :spacing_before, :spacing_after
|
|
7
7
|
|
|
8
|
-
def initialize(runs = [], style: nil)
|
|
8
|
+
def initialize(runs = [], style: nil, spacing_before: nil, spacing_after: nil)
|
|
9
9
|
super()
|
|
10
10
|
@runs = runs
|
|
11
11
|
@style = style
|
|
12
|
+
@spacing_before = spacing_before
|
|
13
|
+
@spacing_after = spacing_after
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
def add_run(run)
|
data/lib/notare/version.rb
CHANGED
|
@@ -52,9 +52,18 @@ module Notare
|
|
|
52
52
|
|
|
53
53
|
def render_paragraph(xml, para)
|
|
54
54
|
xml["w"].p do
|
|
55
|
-
|
|
55
|
+
has_style = para.style
|
|
56
|
+
has_spacing = para.spacing_before || para.spacing_after
|
|
57
|
+
|
|
58
|
+
if has_style || has_spacing
|
|
56
59
|
xml["w"].pPr do
|
|
57
|
-
xml["w"].pStyle("w:val" => para.style.style_id)
|
|
60
|
+
xml["w"].pStyle("w:val" => para.style.style_id) if has_style
|
|
61
|
+
if has_spacing
|
|
62
|
+
spacing_attrs = {}
|
|
63
|
+
spacing_attrs["w:before"] = para.spacing_before.to_s if para.spacing_before
|
|
64
|
+
spacing_attrs["w:after"] = para.spacing_after.to_s if para.spacing_after
|
|
65
|
+
xml["w"].spacing(spacing_attrs)
|
|
66
|
+
end
|
|
58
67
|
end
|
|
59
68
|
end
|
|
60
69
|
para.runs.each { |run| render_run(xml, run) }
|