prawndown-ext 0.1.13 → 0.1.14
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/prawndown/version.rb +1 -1
- data/lib/prawndown-ext.rb +18 -19
- 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: e81c1189fb2fec119b406c1f56d8fbc18470b77eab3fbe6457fa97bcea2f187d
|
|
4
|
+
data.tar.gz: 8334d33e581d317302353c26b15d1bd58bdf8d955acb9713584e763264de27ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04e7eafb5f0ef9d0c0b01053a7c89a9a1a5ec899d8c8cecc8ba4a450494d0818ee7a474d17f264b84cd5c3190f2850e599143ec8d2bd4f10b28664ee1a4bfb2a
|
|
7
|
+
data.tar.gz: f97af900e4fc8e2b464b9c3edafa7c41bcd270d0fdf72676d584b38842cfe67acd624f1324371c21f5aacc2070e96e58a4762d60490d0219985cdc24805e12aa
|
data/lib/prawndown/version.rb
CHANGED
data/lib/prawndown-ext.rb
CHANGED
|
@@ -136,30 +136,30 @@ module PrawndownExt
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
end
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
def unescape_text text
|
|
141
141
|
text = text.gsub('\\"', '"')
|
|
142
142
|
end
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
143
|
+
|
|
144
|
+
# Renders Markdown in the current document
|
|
145
|
+
#
|
|
146
|
+
# It supports header 1-6, bold text, italic text, strikethrough and links
|
|
147
|
+
# It supports the same options as +Prawn::Document#text+
|
|
148
|
+
#
|
|
149
|
+
# Prawn::Document.generate('markdown.pdf') do
|
|
150
|
+
# markdown '# Welcome to Prawndown!'
|
|
151
|
+
# markdown '**Important:** We _hope_ you enjoy your stay!'
|
|
152
|
+
# end
|
|
153
|
+
def markdown(string, options: {})
|
|
154
|
+
|
|
155
155
|
if !options.key?("default_line_spacing")
|
|
156
156
|
options["default_line_spacing"] = 0
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
processed = PrawndownExt::Parser.new(string, options).to_prawn
|
|
160
160
|
|
|
161
161
|
processed.each do |output|
|
|
162
|
-
|
|
162
|
+
|
|
163
163
|
begin
|
|
164
164
|
object = JSON.parse(output.strip)
|
|
165
165
|
|
|
@@ -167,10 +167,9 @@ module PrawndownExt
|
|
|
167
167
|
rescue
|
|
168
168
|
text unescape_text(output), inline_format: true, leading: options["default_line_spacing"].to_f
|
|
169
169
|
end
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
|
|
171
|
+
end
|
|
172
|
+
end
|
|
174
173
|
end
|
|
175
174
|
end
|
|
176
175
|
|