X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/75b7209eaa096a8d3bff42fa83eec838791b6f3a..32cad0f6194605b4a8e881397665769e90173732:/platforma/static/js/xslt.js?ds=sidebyside diff --git a/platforma/static/js/xslt.js b/platforma/static/js/xslt.js index 71a68598..c3f13d6a 100644 --- a/platforma/static/js/xslt.js +++ b/platforma/static/js/xslt.js @@ -34,8 +34,9 @@ var MARGIN = { MARGIN['rdf:RDF'] = 3; MARGIN['rdf:Description'] = 2; +var blockTags = ['akap', 'akap_cd', 'akap_dialog', 'strofa', 'didaskalia', 'wers', 'wers_cd', 'wers_akap', 'wers_wciety', 'autor_utworu', 'nazwa_utworu', 'dzielo_nadrzedne', 'podpis']; function elementType(element) { - if ($.inArray(element.tagName, ['akap', 'akap_cd', 'akap_dialog', 'strofa', 'didaskalia', 'wers', 'wers_cd', 'wers_akap', 'wers_wciety', 'autor_utworu', 'nazwa_utworu', 'dzielo_nadrzedne', 'podpis'])) { + if (blockTags.indexOf(element.tagName) != -1) { return 'inline'; } else { return 'block'; @@ -49,11 +50,7 @@ function serialize(element, mode) { } if (element.nodeType == 3) { // tekst - if (mode == 'block') { - return [$.trim(element.nodeValue)]; - } else { - return [element.nodeValue]; - } + return [element.nodeValue]; } else if (element.nodeType != 1) { // pomijamy węzły nie będące elementami XML ani tekstem return []; } @@ -61,6 +58,8 @@ function serialize(element, mode) { var result = []; var hasContent = false; + + if (MARGIN[element.tagName]) { for (var i=0; i < MARGIN[element.tagName]; i++) { result.push('\n');