in xml2text, change & < to entities
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Mon, 17 Dec 2012 14:01:53 +0000 (15:01 +0100)
committerLibrary Admin <librarian@szo.nowoczesnapolska.org.pl>
Mon, 17 Dec 2012 14:01:53 +0000 (15:01 +0100)
redakcja/static/js/wiki/xslt.js

index 618dcd0..a97322a 100644 (file)
@@ -366,7 +366,9 @@ 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) +'"';
+                var value = node.getAttribute('x-attr-value-'+this);
+                value = value.replace(/&/g, '&amp;').replace(/</g, '&lt;');
+               self.result += '="'+ value +'"';
        });
 
        /* print new namespace declarations */