},
format: function (html) {
- var blockTags = ['ul', 'ol', 'li'];
+ var blockTags = ['ul', 'ol', 'li', 'table', 'tbody', 'thead', 'tr', 'td', 'th'];
this.block.tags.forEach(function(tag) {
blockTags.push(tag);
});
// block tags that are recognized as block tags, but both
// newline and indentation matches inline elements
- var blocksAsInline = ['p', 'li'];
+ var blocksAsInline = ['p', 'li', 'td', 'th'];
var patternTagAttributes = '[^\'">]*(?:(?:"[^"]*"|\'[^\']*\')[^\'">]*)*';
return '\n<' + tag + attributes + '>' + (blocksAsInline.indexOf(tag) === -1 ? '\n' : '');
});
+ // Remove empty lines between two adjacent block elements.
+ html = html.replace(new RegExp('(<(?:' + blockTags + ')(?:' + patternTagAttributes + ')>\n)\n+(?=<(?:' + blockTags + ')(?:' + patternTagAttributes + ')>)', 'g'), '$1');
+
// avoid empty newline at quote start
html = html.replace(/<woltlab-quote([^>]*)>\n\t*\n(\t*)<p/, '<woltlab-quote$1>\n$2<p');