marked-abc 0.2.0 → 0.2.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.
package/lib/index.umd.js CHANGED
@@ -198,12 +198,12 @@ X:`),i=a.length;return i===0&&(i=1),i};var e=wt.TuneBook=function(n){var a=_2(n)
198
198
  `)+1).match(/^(\s+)/);if(n){let a=n[1];return e.replace(/\n/g,`
199
199
  ${a}`)}return e}var T5,Ih,zh=Yr(()=>{T5=Dh({}),Ih=T5});var Rh={};Kh(Rh,{default:()=>B5});function E5(e){return e.replace(/[\x26\x0A\<>'"]/g,t=>"&#"+t.charCodeAt(0)+";")}function A5(e){return new Promise(t=>{let r=document.querySelector(e);if(r)return t(r);let n=new MutationObserver(a=>{let i=document.querySelector(e);i&&(n.disconnect(),t(i))});n.observe(document.body,{childList:!0,subtree:!0})})}function M5(e,t){return e.split(`
200
200
  `).map(r=>t+r).join(`
201
- `)}function B5(e={}){let t=[];function r(){for(let a of t){let i=document.querySelector(`#${a.id}`);i&&Cn.renderAbc(i,a.score,e.abcOptions)}}return{extension:{extensions:[{name:"abcScore",level:"block",start(a){return Hh.exec(a)?.index},tokenizer(a){if(!Oh.exec(a))return;let i=Fh.exec(a);if(i===null)return;let s=i.index+i[0].length,o=a.slice(0,s),c=o.replace(Oh,"").replace(Fh,"").trim().split(`
202
- `).map(h=>h.trim()).join(`
203
- `);return console.log(c),{type:"abcScore",raw:o,abc:c}},renderer(a){let i=`abc-score-${++_5}`,s=e.sanitizer??E5;return t.push({id:i,score:a.abc}),"document"in globalThis&&A5(`#${i}`).then(o=>{Cn.renderAbc(o,a.abc,e.abcOptions)}),Ih`<div class="abc-score" id="${i}">
204
- ${M5(s(a.abc)," ")}
201
+ `)}function B5(e={}){function t(){for(let n of document.querySelectorAll(".abc-score"))Cn.renderAbc(n,n.textContent,e.abcOptions)}return{extension:{extensions:[{name:"abcScore",level:"block",start(n){return Hh.exec(n)?.index},tokenizer(n){if(!Oh.exec(n))return;let a=Fh.exec(n);if(a===null)return;let i=a.index+a[0].length,s=n.slice(0,i),o=s.replace(Oh,"").replace(Fh,"").trim().split(`
202
+ `).map(c=>c.trim()).join(`
203
+ `);return{type:"abcScore",raw:s,abc:o}},renderer(n){let a=`abc-score-${++_5}`,i=e.sanitizer??E5;return"document"in globalThis&&A5(`#${a}`).then(s=>{Cn.renderAbc(s,n.abc,e.abcOptions)}),Ih`<div class="abc-score" id="${a}">
204
+ ${M5(i(n.abc)," ")}
205
205
  </div>
206
- `}}]},forceRenderAll:r}}var Cn,_5,Hh,Oh,Fh,Gh=Yr(()=>{"use strict";Wn();Cn=Qh(Ph(),1);zh();_5=0;Hh=/<score\s+lang="(ABC|abc)"\s*>/,Oh=new RegExp("^"+Hh.source),Fh=/<\/score>/});module.exports=(Gh(),Zh(Rh)).default;
206
+ `}}]},forceRenderAll:t}}var Cn,_5,Hh,Oh,Fh,Gh=Yr(()=>{"use strict";Wn();Cn=Qh(Ph(),1);zh();_5=0;Hh=/<score\s+lang="(ABC|abc)"\s*>/,Oh=new RegExp("^"+Hh.source),Fh=/<\/score>/});module.exports=(Gh(),Zh(Rh)).default;
207
207
 
208
208
  if(__exports != exports)module.exports = exports;return module.exports}));
209
209
  //# sourceMappingURL=index.umd.js.map