1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Fixed MdToHtml regression

This commit is contained in:
Laurent Cozic 2022-04-26 12:52:48 +01:00
parent 790c98ca40
commit 8abdbfe2bd
2 changed files with 22 additions and 12 deletions

View File

@ -60,16 +60,20 @@ describe('MdToHtml', function() {
actualHtml = actualHtml.replace(/\r?\n/g, '\n');
if (actualHtml !== expectedHtml) {
console.info('');
console.info(`Error converting file: ${mdFilename}`);
console.info('--------------------------------- Got:');
console.info(actualHtml);
console.info('--------------------------------- Raw:');
console.info(actualHtml.split('\n'));
console.info('--------------------------------- Expected:');
console.info(expectedHtml.split('\n'));
console.info('--------------------------------------------');
console.info('');
const msg: string[] = [
'',
`Error converting file: ${mdFilename}`,
'--------------------------------- Got:',
actualHtml,
'--------------------------------- Raw:',
actualHtml.split('\n'),
'--------------------------------- Expected:',
expectedHtml.split('\n'),
'--------------------------------------------',
'',
];
console.info(msg.join('\n'));
expect(false).toBe(true);
// return;

View File

@ -180,7 +180,10 @@ class HtmlUtils {
onopentag: (name: string, attrs: any) => {
tagStack.push(name.toLowerCase());
if (disallowedTags.includes(currentTag())) disallowedTagDepth++;
if (disallowedTags.includes(currentTag())) {
disallowedTagDepth++;
return;
}
if (disallowedTagDepth) return;
@ -242,7 +245,10 @@ class HtmlUtils {
if (current === name.toLowerCase()) tagStack.pop();
if (disallowedTags.includes(current)) disallowedTagDepth--;
if (disallowedTags.includes(current)) {
disallowedTagDepth--;
return;
}
if (disallowedTagDepth) return;