markdownr 0.6.12 → 0.6.13

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: 79718389ccea06559febaf6ef49db92e6a4db4684c2d0e2756ebadc897d33f1d
4
- data.tar.gz: 3fcb1ad51d5e3d27e6400a07e1377aab1a987fb945b373fc42fd1f61ffabbfe1
3
+ metadata.gz: 10a01b324bbad44f4914e805b008423a0d585a782642503cce080a037c66fd94
4
+ data.tar.gz: a5d11d54ebd1919f56b831b402d6fdc45e9ce08d6380083b16497730f23734f6
5
5
  SHA512:
6
- metadata.gz: 12b52f326922bffdc772e8ab74bc7fad88e595bb6774544d3e9211d3e694f6b917567fbbf02be35e741a605ff784717c225bd1954835aef358161d09c9cc632a
7
- data.tar.gz: 813cc2e33f478c14e70755eb09caa068dc0a6cd8d9fae495c461d26be0f7e76b452240e75e0f579904fa6ff758e58f6f7aca637021d4b12a7ea7e84184bfb232
6
+ metadata.gz: e99e2aed3005f80997c44adfa82fd56219fa45aced720ebefd892c9763f0c72fd0e81cad60f3bc20a7d2275b1dac20ac4e86310f8fd1d2bae40ef642deea8d0d
7
+ data.tar.gz: 64c9f31eb705b5303a36d60c76dc6540709913bd14caa630a8d01ff69a72233c6dbc8be27a645bea7ec4632f9cb8245855f2c9c0e7c1b4fd233afb48ea969a14
@@ -730,11 +730,21 @@ module MarkdownServer
730
730
  audio_btn = if data_pronunc.length > 10
731
731
  au = "#{base}/lang/lexicon/lexPronouncePlayer.cfm?skin=#{data_pronunc}"
732
732
  %(<button onclick="var a=this._a||(this._a=new Audio('#{h(au)}'));a.currentTime=0;a.play();" ) +
733
- %(style="background:none;border:none;cursor:pointer;padding:0 0 0 4px;font-size:1.1em;vertical-align:middle;" title="Play pronunciation">&#128266;</button>)
733
+ %(style="background:none;border:none;cursor:pointer;padding:0 0 0 4px;font-size:1.1em;vertical-align:middle;" title="Play pronunciation (Blue Letter Bible)">&#128266;</button>)
734
734
  else
735
735
  ""
736
736
  end
737
737
 
738
+ # StudyLight pronunciation button — extract Strong's number from URL
739
+ sl_match = url.to_s.match(%r{/lexicon/([hg])(\d+)/}i)
740
+ if sl_match
741
+ sl_lang = sl_match[1].downcase == "h" ? "hebrew" : "greek"
742
+ sl_num = sl_match[2]
743
+ sl_url = "https://www.studylight.org/multi-media/audio/lexicons/eng/#{sl_lang}.html?n=#{sl_num}"
744
+ audio_btn += %(<button onclick="var a=this._a||(this._a=new Audio('#{h(sl_url)}'));a.currentTime=0;a.play();" ) +
745
+ %(style="background:none;border:none;cursor:pointer;padding:0 0 0 4px;font-size:1.1em;vertical-align:middle;" title="Play pronunciation (StudyLight)">&#128266;</button>)
746
+ end
747
+
738
748
  # ── Part of speech ────────────────────────────────────────────────────
739
749
  pos = html[/<div[^>]+id="lexPart".*?small-text-right"[^>]*>(.*?)<\/div>/im, 1]
740
750
  &.gsub(/<[^>]+>/, "")&.strip || ""
@@ -942,13 +952,23 @@ module MarkdownServer
942
952
  return html unless strongs.match?(/\A[GH]\d+\z/i) && %w[hebrew greek].include?(lang)
943
953
 
944
954
  icon = %(<button class="pronunciation-btn" data-strongs="#{h(strongs.upcase)}" ) +
945
- %(title="Play pronunciation" ) +
955
+ %(title="Play pronunciation (Blue Letter Bible)" ) +
946
956
  %(style="background:none;border:none;cursor:pointer;padding:0 0 0 6px;font-size:1.1em;vertical-align:middle;line-height:1;color:#888;" ) +
947
957
  %(onclick="(function(btn){if(btn._loading)return;var a=btn._audio;if(a){a.currentTime=0;a.play();return;}btn._loading=true;btn.style.opacity='0.4';\
948
958
  fetch('/pronunciation?strongs='+btn.dataset.strongs).then(function(r){return r.json()}).then(function(d){\
949
959
  if(d.audio){a=new Audio(d.audio);btn._audio=a;a.play();}btn._loading=false;btn.style.opacity='1';}).catch(function(){\
950
960
  btn._loading=false;btn.style.opacity='1';});})(this)">&#128266;</button>)
951
961
 
962
+ sl_lang = lang == "hebrew" ? "hebrew" : "greek"
963
+ sl_num = strongs.upcase.sub(/\A[HG]/, "")
964
+ sl_url = "https://www.studylight.org/multi-media/audio/lexicons/eng/#{sl_lang}.html?n=#{sl_num}"
965
+ icon2 = %(<button class="pronunciation-btn" ) +
966
+ %(title="Play pronunciation (StudyLight)" ) +
967
+ %(style="background:none;border:none;cursor:pointer;padding:0 0 0 4px;font-size:1.1em;vertical-align:middle;line-height:1;color:#888;" ) +
968
+ %(onclick="var a=this._a||(this._a=new Audio('#{h(sl_url)}'));a.currentTime=0;a.play();">&#128266;</button>)
969
+
970
+ icon = icon + icon2
971
+
952
972
  # Insert before the closing tag of the first <h2>
953
973
  html.sub(%r{</h2>}) { " #{icon}</h2>" }
954
974
  end
@@ -1,3 +1,3 @@
1
1
  module MarkdownServer
2
- VERSION = "0.6.12"
2
+ VERSION = "0.6.13"
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.12
4
+ version: 0.6.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dunn