diff --git a/src/odt/postprocess/mergeParagraphs.ts b/src/odt/postprocess/mergeParagraphs.ts index 001a4e7f..b8c69924 100644 --- a/src/odt/postprocess/mergeParagraphs.ts +++ b/src/odt/postprocess/mergeParagraphs.ts @@ -67,14 +67,14 @@ export function mergeParagraphs(markdownChunks: MarkdownChunks, rewriteRules: Re const findFirstTextAfterPos = (start: number): string | null => { for (let pos = start + 1; pos < markdownChunks.chunks.length; pos++) { const currentChunk = markdownChunks.chunks[pos]; - if ('text' in currentChunk) { + if ('text' in currentChunk && currentChunk.text.trim() !== '') { return currentChunk.text; } } return null; }; - const nextText = findFirstTextAfterPos(nextParaClosing); + const nextText = findFirstTextAfterPos(position); if (nextText === '* ' || nextText?.trim().length === 0) { markdownChunks.chunks.splice(position, 2, { isTag: false, diff --git a/test/odt_md/Issues.test.ts b/test/odt_md/Issues.test.ts index 089fd6f3..c79782d6 100644 --- a/test/odt_md/Issues.test.ts +++ b/test/odt_md/Issues.test.ts @@ -31,13 +31,19 @@ describe('MarkDownTransformTest', () => { }); it('test ./issue-434', async () => { - return; // Should we convert this fake list into real? // https://github.com/mieweb/wikiGDrive/issues/434 const testMarkdown = fs.readFileSync(__dirname + '/issue-434.md').toString(); const markdown = await transformOdt('issue-434'); assert.ok(compareTexts(testMarkdown, markdown, false)); }); + it('test ./issue-434-2', async () => { + // https://github.com/mieweb/wikiGDrive/issues/434 + const testMarkdown = fs.readFileSync(__dirname + '/issue-434-2.md').toString(); + const markdown = await transformOdt('issue-434-2'); + assert.ok(compareTexts(testMarkdown, markdown, false)); + }); + it('test ./issue-435-436', async () => { // https://github.com/mieweb/wikiGDrive/issues/435 // https://github.com/mieweb/wikiGDrive/issues/436 diff --git a/test/odt_md/example-document.md b/test/odt_md/example-document.md index 61dac7af..eca4781c 100644 --- a/test/odt_md/example-document.md +++ b/test/odt_md/example-document.md @@ -54,7 +54,7 @@ After subtable ### Heading 3 - a diagram with links -[Diagram](gdoc:1Du-DYDST4liLykJl0fHSCvuQYIYhtOfwco-ntn38Dy8) +[Diagram](gdoc:1Du-DYDST4liLykJl0fHSCvuQYIYhtOfwco-ntn38Dy8) [Diagram](gdoc:1Du-DYDST4liLykJl0fHSCvuQYIYhtOfwco-ntn38Dy8) ### Heading 3 - with a Table of contents diff --git a/test/odt_md/issue-434-2.md b/test/odt_md/issue-434-2.md new file mode 100644 index 00000000..da8d8e59 --- /dev/null +++ b/test/odt_md/issue-434-2.md @@ -0,0 +1,15 @@ +**This** is a line +**This** is line two + + +* This is a bulleted test +* Second line + + + +hi + + +This is a cool new wikiGDrive! With a change. + +![](1000000000000801000006000FC688CE4398B42C.jpg)![](100000000000080100000600C22E7BC1728488D6.jpg)![](10000000000009C4000007537CA7AEBC30C18882.jpg)![](10000000000009C400000753E2645860B6CEB342.jpg) diff --git a/test/odt_md/issue-434-2.odt b/test/odt_md/issue-434-2.odt new file mode 100644 index 00000000..90242653 Binary files /dev/null and b/test/odt_md/issue-434-2.odt differ diff --git a/test/odt_md/issue-434.md b/test/odt_md/issue-434.md index 4bfbf229..6a87a80b 100644 --- a/test/odt_md/issue-434.md +++ b/test/odt_md/issue-434.md @@ -8,4 +8,4 @@ **LOINC Code:** Logical Observation Identifiers Names and Codes (LOINC) are used primarily for results coming into the system, to match "apples to apples". Enterprise Health's Medical Codify may be used to search for or reference LOINC codes, as well as other online resources. **Layout:** Some orders have specific Exam Order Layouts assigned to them so they display consistently when results are manually entered, typically in the Tests and procedures section of an encounter. **Doc Type:** A specific document type can be assigned to an order code within this editor, so that when these orders are resulted, a separate document is created. -**Appt. Type:** An appointment type can be tied to order codes within this editor so that when an order is on the due list and needs scheduled for an appointment, the system automatically selects the correct appointment type, with the proper amount of time allocated. +**Appt. Type:** An appointment type can be tied to order codes within this editor so that when an order is on the due list and needs scheduled for an appointment, the system automatically selects the correct appointment type, with the proper amount of time allocated.