tiff2png
[redakcja.git] / redakcja / static / js / wiki / xslt.js
index 86c6d36..a0d0d4b 100644 (file)
@@ -58,10 +58,9 @@ function withThemes(code_block, onError)
 }
 
 
 }
 
 
-
 function xml2html(options) {
     withStylesheets(function() {
 function xml2html(options) {
     withStylesheets(function() {
-        var xml = options.xml.replace(/\/\s+/g, '<br />');
+        var xml = options.xml.replace(/\/(\s+)/g, '<br />$1');
         var parser = new DOMParser();
         var serializer = new XMLSerializer();
         var doc = parser.parseFromString(xml, 'text/xml');
         var parser = new DOMParser();
         var serializer = new XMLSerializer();
         var doc = parser.parseFromString(xml, 'text/xml');
@@ -80,7 +79,10 @@ function xml2html(options) {
         }
 
         if (error.length > 0 && options.error) {
         }
 
         if (error.length > 0 && options.error) {
-            options.error(error.text());
+            source = $('sourcetext', doc);
+            source_text = source.text();
+            source.text('');
+            options.error(error.text(), source_text);
         } else {
             options.success(doc.firstChild);
 
         } else {
             options.success(doc.firstChild);
 
@@ -271,7 +273,7 @@ HTMLSerializer.prototype.serialize = function(rootElement, stripOuter)
                                if(xnode === 'wers') {
                                        /* push children */
                                        if(self._verseBefore(token.node))
                                if(xnode === 'wers') {
                                        /* push children */
                                        if(self._verseBefore(token.node))
-                                               self.result += '/\n';
+                                               self.result += '/';
                                        self._pushChildren(token.node);
                                        break;
                                };
                                        self._pushChildren(token.node);
                                        break;
                                };