markdownr 0.6.8 → 0.6.9
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/markdown_server/app.rb +16 -0
- data/lib/markdown_server/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: c1bd3ffb960e7f2e3750d7f70fe188c551d1fcf764a6517f65a4c45fee4634e4
|
|
4
|
+
data.tar.gz: 49a2c9f9a777fc280bc9bd98a38fb135873e9e2392edbe4d2ada07cd2d20e8b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc4bc27debd2a2093965e2bc46ce94364e18db6970659091ebe94febab5e37cefb1ddb0fcc64810006eeb1db1b72faef32543e3b186595c85619a85303b9b4bf
|
|
7
|
+
data.tar.gz: 54b2fbd599cdae2d6e582cdf73d8adb6363244ff9ecda175c9627bf9b1619f5ae510884f053f8d5d585551b539708db684de8a00ea51adce62e48c0946b93d8f
|
data/lib/markdown_server/app.rb
CHANGED
|
@@ -607,6 +607,19 @@ module MarkdownServer
|
|
|
607
607
|
out.length > 10_000 ? out[0, 10_000] : out
|
|
608
608
|
end
|
|
609
609
|
|
|
610
|
+
def markdownr_html(html)
|
|
611
|
+
# Extract .md-content from a trusted markdownr page, preserving HTML as-is
|
|
612
|
+
content = html[/<div[^>]+class="md-content"[^>]*>([\s\S]*?)<\/div>\s*(?:<div\s+class="frontmatter"|<\/div>\s*<\/div>|\z)/im, 1]
|
|
613
|
+
return page_html(html) unless content && content.length > 10
|
|
614
|
+
|
|
615
|
+
# Also extract frontmatter if present
|
|
616
|
+
fm = html[/<div\s+class="frontmatter">([\s\S]*?)<\/div>\s*<\/div>/im, 0] || ""
|
|
617
|
+
|
|
618
|
+
result = content.strip
|
|
619
|
+
result += "\n#{fm}" unless fm.empty?
|
|
620
|
+
result.length > 15_000 ? result[0, 15_000] : result
|
|
621
|
+
end
|
|
622
|
+
|
|
610
623
|
def blueletterbible_html(html, url)
|
|
611
624
|
base = "https://www.blueletterbible.org"
|
|
612
625
|
|
|
@@ -1172,6 +1185,9 @@ btn._loading=false;btn.style.opacity='1';});})(this)">🔊</button>)
|
|
|
1172
1185
|
title = raw.match(/^([GH]\d+ - \w+)/i)&.[](1)&.sub(" - ", " – ") ||
|
|
1173
1186
|
raw.sub(/ [-–] .*/, "").strip
|
|
1174
1187
|
JSON.dump({ title: title, html: blueletterbible_html(html, url) })
|
|
1188
|
+
elsif url.match?(%r{/definitions/[^/]+\.md(\?|#|\z)}i)
|
|
1189
|
+
title = page_title(html).sub(/ [-–] .*/, "").strip
|
|
1190
|
+
JSON.dump({ title: title, html: markdownr_html(html) })
|
|
1175
1191
|
elsif url.match?(/scrip\.risensavior\.com/i)
|
|
1176
1192
|
title = page_title(html).sub(/ [-–] .*/, "").strip
|
|
1177
1193
|
JSON.dump({ title: title, html: scrip_html(html) })
|