prawndown-ext 0.1.5 → 0.1.6
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/parser.rb +17 -2
- data/lib/prawndown/version.rb +1 -1
- 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: add25cd5ac828d350ccf78f66898be73e08697a8cae07ade7eed136477665d1a
|
4
|
+
data.tar.gz: 25dfd70414948ad46abd0436b94b1c5283391a2be26ae9f87a7fdcf1238b97eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8fb1a470a66603332ab42a70b010547775d078497fd79bf060349f232fae89b99fc6f83a841331b79b98d71e0e3054737141b6c71e4c098799bee2dcf854b3c
|
7
|
+
data.tar.gz: e90f324a7f615941a5ed9c066f3e88ebd6f9094ee6cdf20bf0f92b7affa0b77b4cadcf6b3d4aa2ff68e602e8f8a884f8019596106dc99f8111de7e4dfa0938b7
|
data/lib/prawndown/parser.rb
CHANGED
@@ -9,7 +9,10 @@ module PrawndownExt
|
|
9
9
|
"header4_size" => 18,
|
10
10
|
"header5_size" => 16,
|
11
11
|
"header6_size" => 14,
|
12
|
-
"quote_size" => 14
|
12
|
+
"quote_size" => 14,
|
13
|
+
"quote_font_spacing" => nil,
|
14
|
+
"quote_font" => nil,
|
15
|
+
"quote_margin" => 20,
|
13
16
|
}
|
14
17
|
|
15
18
|
MATCHERS = {
|
@@ -30,7 +33,7 @@ module PrawndownExt
|
|
30
33
|
|
31
34
|
# Images
|
32
35
|
/!\[([^\[]+)\]\(([^\)]+)\)/ => '<command_break>{"command":"img", "alt":"\1", "path":"\2"}<command_break>',
|
33
|
-
/^> (.+)/ => '<command_break>{"command":"quote","margin":
|
36
|
+
/^> (.+)/ => '<command_break>{"command":"quote","margin":QUOTE_MARGIN,"text":"<font name=\'QUOTE_FONT\' character_spacing=\'QUOTE_FONT_SPACING\' size=\'QUOTE_SIZE\'>\\1</font>"}<command_break>', # Quote
|
34
37
|
|
35
38
|
# Stuff to process last
|
36
39
|
/\[([^\[]+)\]\(([^\)]+)\)/ => '<link href="\2">\1</link>', # Link
|
@@ -57,6 +60,18 @@ module PrawndownExt
|
|
57
60
|
end
|
58
61
|
|
59
62
|
def replace_options text
|
63
|
+
# remove quote font if it doesnt exist
|
64
|
+
if @options["quote_font"].nil?
|
65
|
+
text = text.gsub("name='QUOTE_FONT' ", "")
|
66
|
+
@options.delete("quote_font")
|
67
|
+
end
|
68
|
+
|
69
|
+
# remove quote spacing if it doesnt exist
|
70
|
+
if @options["quote_font_spacing"].nil?
|
71
|
+
text = text.gsub("character_spacing='QUOTE_FONT_SPACING' ", "")
|
72
|
+
@options.delete("quote_font_spacing")
|
73
|
+
end
|
74
|
+
|
60
75
|
DEFAULT_OPTIONS.keys.each do |replacer|
|
61
76
|
if @options.key?(replacer)
|
62
77
|
text = text.gsub(replacer.upcase, @options[replacer].to_s)
|
data/lib/prawndown/version.rb
CHANGED