Comments maybe contain an empty text tag

This commit is contained in:
Hugues Malphettes 2014-01-18 16:29:51 +08:00
parent 80a843ca3b
commit 36f7080a68
2 changed files with 6 additions and 2 deletions

View File

@ -499,7 +499,9 @@ function parseComments(data) {
if(x === "" || x.trim() === "") return;
var y = parsexmltag(x.match(/<comment[^>]*>/)[0]);
var comment = { author: y.authorId && authors[y.authorId] ? authors[y.authorId] : undefined, ref: y.ref, guid: y.guid, texts:[] };
x.match(/<text>([^\u2603]*)<\/text>/m)[1].split('</r>').forEach(function(r) {
var textMatch = x.match(/<text>([^\u2603]*)<\/text>/m);
if (!textMatch || !textMatch[1]) return; // a comment may contain an empty text tag.
textMatch[1].split('</r>').forEach(function(r) {
if(r === "" || r.trim() === "") return;
/* 18.4.12 t ST_Xstring */
var ct = r.match(matchtag('t'));

View File

@ -1079,7 +1079,9 @@ function parseComments(data) {
if(x === "" || x.trim() === "") return;
var y = parsexmltag(x.match(/<comment[^>]*>/)[0]);
var comment = { author: y.authorId && authors[y.authorId] ? authors[y.authorId] : undefined, ref: y.ref, guid: y.guid, texts:[] };
x.match(/<text>([^\u2603]*)<\/text>/m)[1].split('</r>').forEach(function(r) {
var textMatch = x.match(/<text>([^\u2603]*)<\/text>/m);
if (!textMatch || !textMatch[1]) return; // a comment may contain an empty text tag.
textMatch[1].split('</r>').forEach(function(r) {
if(r === "" || r.trim() === "") return;
/* 18.4.12 t ST_Xstring */
var ct = r.match(matchtag('t'));