X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/6b0f855c770066db9b5b3fa11a9af64c4b8c60bd..0dd00c51dfdbda93e1b9c4612477cd05109d4517:/src/redakcja/static/js/wiki/xslt.js?ds=sidebyside diff --git a/src/redakcja/static/js/wiki/xslt.js b/src/redakcja/static/js/wiki/xslt.js index 1c693521..19804462 100644 --- a/src/redakcja/static/js/wiki/xslt.js +++ b/src/redakcja/static/js/wiki/xslt.js @@ -17,21 +17,20 @@ function withStylesheets(code_block, onError) if (!xml2htmlStylesheet) { $.blockUI({message: 'Ładowanie arkuszy stylów...'}); $.ajax({ - url: STATIC_URL + 'xsl/wl2html_client.xsl?2019121801', - dataType: 'xml', - timeout: 10000, - success: function(data) { + url: '/wlxml/wl2html.xsl', + dataType: 'xml', + timeout: 10000, + success: function(data) { xml2htmlStylesheet = createXSLT(data); $.unblockUI(); - code_block(); - + code_block(); }, - error: onError + error: onError }) } - else { - code_block(); - } + else { + code_block(); + } } @@ -61,6 +60,20 @@ function xml2html(options) { source.text(''); options.error(error.text(), source_text); } else { + let galleryUrl = new URL( + options.base, + window.location.href + ); + $("img", $(doc.childNodes)).each(function() { + $(this).attr( + 'src', + new URL( + $(this).attr('src'), + galleryUrl + ) + ); + }) + options.success(doc.childNodes); $.themes.withCanon(function(canonThemes) { @@ -339,7 +352,7 @@ HTMLSerializer.prototype._serializeElement = function(node) { }; self.result += ' ' + self._join(nsData.prefix, node.getAttribute('x-attr-name-'+this)); - self.result += '="'+node.getAttribute('x-attr-value-'+this) +'"'; + self.result += '="' + node.getAttribute('x-attr-value-'+this).replace(/&/g, '&').replace(/"/g, '"') + '"'; }); /* print new namespace declarations */