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 +4 -4
- data/lib/markdown_server/app.rb +22 -2
- 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: 10a01b324bbad44f4914e805b008423a0d585a782642503cce080a037c66fd94
|
|
4
|
+
data.tar.gz: a5d11d54ebd1919f56b831b402d6fdc45e9ce08d6380083b16497730f23734f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e99e2aed3005f80997c44adfa82fd56219fa45aced720ebefd892c9763f0c72fd0e81cad60f3bc20a7d2275b1dac20ac4e86310f8fd1d2bae40ef642deea8d0d
|
|
7
|
+
data.tar.gz: 64c9f31eb705b5303a36d60c76dc6540709913bd14caa630a8d01ff69a72233c6dbc8be27a645bea7ec4632f9cb8245855f2c9c0e7c1b4fd233afb48ea969a14
|
data/lib/markdown_server/app.rb
CHANGED
|
@@ -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">🔊</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)">🔊</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)">🔊</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)">🔊</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();">🔊</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
|