prawndown-ext 0.1.16 → 0.1.17
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/new-parser.rb +3 -3
- data/lib/prawndown/version.rb +1 -1
- data/lib/prawndown-ext.rb +5 -4
- 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: 1b73e73fd9fa41b215e4fe94af0266d8ee3e9ef84aecd68d7f72cdf5a40fb48f
|
|
4
|
+
data.tar.gz: 2dda038ce2cecf742a7c8a9e4b7ab8eaef60a9784e70aabfc529a65d68d37103
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a0362fc84ea6e60961b5940e3cd16c1529d2677c7eb92a7a27fcaecb97c8c4759815541c43b3a75135acbc3bc34cba2ef7b753ba731bf2562f3f08f5d1570dc
|
|
7
|
+
data.tar.gz: e9ab7626b05106b2656ee75b400a44bc2b55e839286fd65b09caaaed26f8828279fd5edf2d4b41822229993c4681046aa0160c4a3070755652f4adec9fe10b11
|
data/lib/prawndown/new-parser.rb
CHANGED
|
@@ -61,11 +61,11 @@ module PrawndownExt
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
def block_quote(quote)
|
|
64
|
-
%(<command_break>{"command":"quote","margin":QUOTE_MARGIN,"text":"<font name=\'QUOTE_FONT\' character_spacing=\'QUOTE_FONT_SPACING\' size=\'QUOTE_SIZE\'>#{quote}</font>"}<command_break>)
|
|
64
|
+
%(<command_break>{"command":"quote","margin":QUOTE_MARGIN,"text":"<font name=\'QUOTE_FONT\' character_spacing=\'QUOTE_FONT_SPACING\' size=\'QUOTE_SIZE\'>#{quote.strip.gsub("\"","\\\"").gsub("\n","\\n")}</font>"}<command_break>)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def block_code(code)
|
|
68
|
-
%(<command_break>{"command":"code","margin":CODE_MARGIN,"text":"<font name=\'CODE_FONT\' character_spacing=\'CODE_FONT_SPACING\' size=\'CODE_SIZE\'>#{code}</font>"}<command_break>)
|
|
68
|
+
%(<command_break>{"command":"code","margin":CODE_MARGIN,"text":"<font name=\'CODE_FONT\' character_spacing=\'CODE_FONT_SPACING\' size=\'CODE_SIZE\'>#{code.strip.gsub("\"","\\\"")}</font>"}<command_break>)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def block_code(code)
|
|
@@ -73,7 +73,7 @@ module PrawndownExt
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def footnote_def(content, number)
|
|
76
|
-
%(
|
|
76
|
+
%(#{number}. #{content})
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def footnote_ref(text)
|
data/lib/prawndown/version.rb
CHANGED
data/lib/prawndown-ext.rb
CHANGED
|
@@ -32,11 +32,11 @@ module PrawndownExt
|
|
|
32
32
|
if !options.key?(args["command"] + "_line_spacing")
|
|
33
33
|
options[args["command"] + "_line_spacing"] = 0
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
if !options.key?(args["command"] + "_horizontal_margin")
|
|
37
37
|
options[args["command"] + "_horizontal_margin"] = 0
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
if !options.key?(args["command"] + "_vertical_margin")
|
|
41
41
|
options[args["command"] + "_vertical_margin"] = 0
|
|
42
42
|
end
|
|
@@ -128,7 +128,7 @@ module PrawndownExt
|
|
|
128
128
|
def exec args, pdf, options
|
|
129
129
|
if args.key?("command")
|
|
130
130
|
if COMMAND.include?(args["command"])
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
COMMAND[args["command"]].call(args, pdf, options)
|
|
133
133
|
|
|
134
134
|
end
|
|
@@ -184,10 +184,11 @@ module PrawndownExt
|
|
|
184
184
|
processed.each do |output|
|
|
185
185
|
|
|
186
186
|
begin
|
|
187
|
+
|
|
187
188
|
object = JSON.parse(output.strip)
|
|
188
189
|
|
|
189
190
|
CommandInterface.new.exec object, self, options
|
|
190
|
-
rescue
|
|
191
|
+
rescue => error
|
|
191
192
|
text unescape_text(output), inline_format: true, leading: options["default_line_spacing"].to_f
|
|
192
193
|
end
|
|
193
194
|
|