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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4810bebbf882744a15ecd5efd2a62c7041a4e82333090ff48a436263b8a7d72c
4
- data.tar.gz: 4539d9a60c57059548e5a83ce48bd4a2308c786994a600cbc826c1ce966ac91d
3
+ metadata.gz: c1bd3ffb960e7f2e3750d7f70fe188c551d1fcf764a6517f65a4c45fee4634e4
4
+ data.tar.gz: 49a2c9f9a777fc280bc9bd98a38fb135873e9e2392edbe4d2ada07cd2d20e8b2
5
5
  SHA512:
6
- metadata.gz: 826f2424b808693da846ec0f8683440b811977c8901e3afe1a170941731c7e654905d6359a5bf58965d268d4c487f7a1b911254a5461f4bde1667fd13d46bd11
7
- data.tar.gz: 58aaacd2425f0a229fefca93e0f6e0b30b062bde8ae0a25dc4e43f1c76ae8a849c44fc003516afc43f8dd09fdac3e70ba8364d8bf9adb5e5ee6dc093327d06f4
6
+ metadata.gz: dc4bc27debd2a2093965e2bc46ce94364e18db6970659091ebe94febab5e37cefb1ddb0fcc64810006eeb1db1b72faef32543e3b186595c85619a85303b9b4bf
7
+ data.tar.gz: 54b2fbd599cdae2d6e582cdf73d8adb6363244ff9ecda175c9627bf9b1619f5ae510884f053f8d5d585551b539708db684de8a00ea51adce62e48c0946b93d8f
@@ -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)">&#128266;</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) })
@@ -1,3 +1,3 @@
1
1
  module MarkdownServer
2
- VERSION = "0.6.8"
2
+ VERSION = "0.6.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdownr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dunn