bible270 1.6.1 → 1.6.2
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/bible270/comment_formatter.rb +19 -2
- data/lib/bible270/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: 10dd20a51ceee2f549e465ad8826eaa1211c6722c08f2ecf6e81f5ec885eeb90
|
|
4
|
+
data.tar.gz: 598254caeb9eb32a2464663895c64ec0c3eec85cc98705b8da0ed05facb10141
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e587617e2a3d06e1e26cead51a0b96c87a6468b93e53bb03b60ab7a87931cc602f4b3ec5fb72c6b712a0b01a1dffc44a2d15422510e8064b7da881d44d9d31b
|
|
7
|
+
data.tar.gz: b64e61b9682538bf19be6aa6dc428ebc67b8e43808192e29fa6cb04aeac8747e6264ba320c18c6cdc800b6c7a14fafb6eafc1f352fbf7f55b4572248a1699922
|
|
@@ -26,8 +26,11 @@ module Bible270
|
|
|
26
26
|
source = body.to_s
|
|
27
27
|
rendered = format == MARKDOWN ? markdown_html(source) : plain_html(source)
|
|
28
28
|
fragment = fragment_for(sanitize(rendered))
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if format == MARKDOWN
|
|
30
|
+
normalize_lists(fragment)
|
|
31
|
+
hard_wrap(fragment)
|
|
32
|
+
link_urls(fragment)
|
|
33
|
+
end
|
|
31
34
|
decorate_links(fragment)
|
|
32
35
|
link_mentions(fragment, &mention_path) if mention_path
|
|
33
36
|
fragment.to_html
|
|
@@ -82,6 +85,20 @@ module Bible270
|
|
|
82
85
|
end
|
|
83
86
|
private_class_method :fragment_for
|
|
84
87
|
|
|
88
|
+
# Blank lines between Markdown list items make Kramdown wrap each item's
|
|
89
|
+
# content in a paragraph. For a simple item, remove that structural wrapper
|
|
90
|
+
# and its indentation so loose and compact lists render identically.
|
|
91
|
+
def normalize_lists(fragment)
|
|
92
|
+
fragment.xpath('.//li/text()[normalize-space(.) = ""]').remove
|
|
93
|
+
fragment.css('li').each do |item|
|
|
94
|
+
children = item.element_children
|
|
95
|
+
next unless children.one? && children.first.name == 'p'
|
|
96
|
+
|
|
97
|
+
children.first.replace(children.first.children)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
private_class_method :normalize_lists
|
|
101
|
+
|
|
85
102
|
def hard_wrap(fragment)
|
|
86
103
|
fragment.xpath('.//p//text() | .//li//text()').to_a.each do |node|
|
|
87
104
|
next unless node.text.include?("\n")
|
data/lib/bible270/version.rb
CHANGED