prawn-markup 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/prawn/markup/builders/nestable_builder.rb +1 -1
- data/lib/prawn/markup/builders/table_builder.rb +1 -1
- data/lib/prawn/markup/processor/blocks.rb +9 -5
- data/lib/prawn/markup/processor/tables.rb +4 -0
- data/lib/prawn/markup/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d7d7fba33e7e87da6a9b6828a8dfdd0ea40be83eaf4564744f4b20e766a85b2
|
4
|
+
data.tar.gz: 2e7fdf53d140797d993f651320728ff42755371294c5fd501f2716f52111b443
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9f6ec2986e5e6fda0ad851689cdf6fa34d24a1b0a11656778613bd57e0937cab3dc082bd8bdc4c0e9f3713f5197010f84d5aa9ce6654cbfa6e5d7425d6c46cf
|
7
|
+
data.tar.gz: 76ae5a9dd1f544ab2164e4e4e56d805c71114b4772585dae07c532edbff92493c54e41a0a48fedc033112027e80516ba7322e2fe0e9e2a9182e3d015abf546cc
|
data/README.md
CHANGED
@@ -69,7 +69,7 @@ doc.markup('<p>Hello World</p><hr/><p>KTHXBYE</p>', text: { align: :center })
|
|
69
69
|
|
70
70
|
Options may be set for `text`, `heading[1-6]`, `table` (subkeys `cell` and `header`) and `list` (subkeys `content` and `bullet`).
|
71
71
|
|
72
|
-
Text and heading options include all keys from Prawns [#text](
|
72
|
+
Text and heading options include all keys from Prawns [#text](https://prawnpdf.org/docs/prawn/2.5.0/Prawn/Text.html#text-instance_method) method: `font`, `size`, `color`, `style`, `align`, `valign`, `leading`,`direction`, `character_spacing`, `indent_paragraphs`, `kerning`, `mode`.
|
73
73
|
|
74
74
|
Tables and lists are rendered with [prawn-table](https://github.com/prawnpdf/prawn-table) and have the following additional options: `padding`, `borders`, `border_width`, `border_color`, `background_color`, `border_lines`, `rotate`, `overflow`, `min_font_size`. Options from `text` may be overridden.
|
75
75
|
|
@@ -78,6 +78,7 @@ Beside these options handled by Prawn / prawn-table, the following values may be
|
|
78
78
|
- `:text`
|
79
79
|
- `:preprocessor`: A proc/callable that is called each time before a chunk of text is rendered.
|
80
80
|
- `:margin_bottom`: Margin after each `<p>`, `<ol>`, `<ul>` or `<table>`. Defaults to about half a line.
|
81
|
+
- `:treat_empty_paragraph_as_new_line`: Boolean flag to set a new line if paragraph is empty.
|
81
82
|
- `:heading1-6`
|
82
83
|
- `:margin_top`: Margin before a heading. Default is 0.
|
83
84
|
- `:margin_bottom`: Margin after a heading. Default is 0.
|
@@ -63,11 +63,11 @@ module Prawn
|
|
63
63
|
def add_paragraph
|
64
64
|
text = dump_text
|
65
65
|
text.gsub!(/[^\n]/, '') if text.strip.empty?
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
return if text.empty? && !treat_empty_paragraph_as_new_line?
|
67
|
+
|
68
|
+
add_bottom_margin
|
69
|
+
add_formatted_text(text.empty? ? "\n" : text, text_options)
|
70
|
+
put_bottom_margin(text_margin_bottom)
|
71
71
|
end
|
72
72
|
|
73
73
|
def add_current_text(options = text_options)
|
@@ -151,6 +151,10 @@ module Prawn
|
|
151
151
|
inline_format: true
|
152
152
|
}
|
153
153
|
end
|
154
|
+
|
155
|
+
def treat_empty_paragraph_as_new_line?
|
156
|
+
text_options[:treat_empty_paragraph_as_new_line] || false
|
157
|
+
end
|
154
158
|
end
|
155
159
|
end
|
156
160
|
end
|
@@ -86,6 +86,10 @@ module Prawn
|
|
86
86
|
def add_cell_text_node(cell, options = {})
|
87
87
|
return unless buffered_text?
|
88
88
|
|
89
|
+
# only allow on supported options of prawn-table; See https://github.com/prawnpdf/prawn-table/blob/master/manual/table/cell_text.rb
|
90
|
+
options = options.slice(*%i[font font_style inline_format kerning leading min_font_size size
|
91
|
+
overflow rotate rotate_around single_line text_color valign])
|
92
|
+
|
89
93
|
cell.nodes << options.merge(content: dump_text.strip)
|
90
94
|
end
|
91
95
|
|
data/lib/prawn/markup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pascal Zumkehr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
- !ruby/object:Gem::Version
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
|
-
rubygems_version: 3.
|
219
|
+
rubygems_version: 3.4.10
|
220
220
|
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: Parse simple HTML markup to include in Prawn PDFs
|