// drop trailing line breaks
data = data.replace(/\n*$/, '');
+ // line-breaks within list items must be a <br> instead of <p></p>
+ var $listItems = [ ];
+ data = data.replace(/(<li>[\s\S]*?<\/li>)/g, function(match) {
+ match = $.trim(match).replace(/\n/, '<br>');
+
+ var $key = WCF.getUUID();
+ $listItems.push({
+ key: $key,
+ content: match
+ });
+
+ return $key;
+ });
+
// convert line breaks into <p></p> or empty lines to <p><br></p>
var $tmp = data.split("\n");
}
}
+ // insert list items
+ if ($listItems.length) {
+ for (var $i = $listItems.length - 1; $i >= 0; $i--) {
+ data = data.replace($listItems[$i].key, $listItems[$i].content);
+ }
+ }
+
// insert quotes
if ($cachedQuotes.length) {
// [quote]