diff --git a/gloss.js b/gloss.js new file mode 100644 index 0000000..510c1d2 --- /dev/null +++ b/gloss.js @@ -0,0 +1,69 @@ +/* + +gloss.js - simple interlinear gloss noting. +Author : Yoxem +usage: +{% gloss} +I believe You. +Gua2 siong1-sin3 Li2. +{% endgloss} + +*/ + +hexo.extend.filter.register('before_post_render', (data) => { + var css_content = `.css-table1{ + display: table; + border: none; } + + .css-tr1{ + display:table-row; + } + + .css-td1{ + display:table-cell;}` + + var link_js = `` + + data.content += link_js; + return data; +}); + +hexo.extend.tag.register('gloss', function(args, content){ + +var content2dArray = []; +var contentSplitted = content.split("\n"); +var content2dArrayMaxLen = 0; + +for (var i=0; i < contentSplitted.length; i++){ + var SplittedInsideALine = contentSplitted[i].split(/\s+/); + + content2dArray.push(SplittedInsideALine); +} + + +var render_result = ""; + +for (var i=0; i"; + + for (var j=0; j" + content2dArray[i][j] + ""); + } + + line_result += "" + + render_result += line_result; +} + + return "
" + render_result + "
"}, +{ends: true});