diff --git a/CliClient/tests/HtmlToMd.js b/CliClient/tests/HtmlToMd.js index 810c4d921..678885a48 100644 --- a/CliClient/tests/HtmlToMd.js +++ b/CliClient/tests/HtmlToMd.js @@ -34,7 +34,7 @@ describe('HtmlToMd', function() { const htmlPath = basePath + '/' + htmlFilename; const mdPath = basePath + '/' + filename(htmlFilename) + '.md'; - // if (htmlFilename !== 'list4.html') continue; + // if (htmlFilename !== 'code2.html') continue; const html = await shim.fsDriver().readFile(htmlPath); const expectedMd = await shim.fsDriver().readFile(mdPath); diff --git a/CliClient/tests/html_to_md/code2.html b/CliClient/tests/html_to_md/code2.html new file mode 100644 index 000000000..a4f5e0a1b --- /dev/null +++ b/CliClient/tests/html_to_md/code2.html @@ -0,0 +1,7 @@ +

Subshell:

+
(
+    set -e
+    false
+    echo Unreachable
+) && echo Great success
+
\ No newline at end of file diff --git a/CliClient/tests/html_to_md/code2.md b/CliClient/tests/html_to_md/code2.md new file mode 100644 index 000000000..f5efdb266 --- /dev/null +++ b/CliClient/tests/html_to_md/code2.md @@ -0,0 +1,7 @@ +Subshell: + + ( + set -e + false + echo Unreachable + ) && echo Great success \ No newline at end of file diff --git a/CliClient/tests/html_to_md/text2.html b/CliClient/tests/html_to_md/text2.html new file mode 100644 index 000000000..dd608a905 --- /dev/null +++ b/CliClient/tests/html_to_md/text2.html @@ -0,0 +1,4 @@ +One line +Two lines + +allattached \ No newline at end of file diff --git a/CliClient/tests/html_to_md/text2.md b/CliClient/tests/html_to_md/text2.md new file mode 100644 index 000000000..8b9c96ac8 --- /dev/null +++ b/CliClient/tests/html_to_md/text2.md @@ -0,0 +1,4 @@ +One line +Two lines + +allattached \ No newline at end of file diff --git a/ReactNativeClient/lib/import-enex-md-gen.js b/ReactNativeClient/lib/import-enex-md-gen.js index 76e2f7b6d..61972e419 100644 --- a/ReactNativeClient/lib/import-enex-md-gen.js +++ b/ReactNativeClient/lib/import-enex-md-gen.js @@ -910,6 +910,7 @@ function enexXmlToMdArray(stream, resources, options = {}) { } else if (isCodeTag(n, nodeAttributes)) { section.lines.push(BLOCK_OPEN); state.inCode = true; + if (n === 'pre') state.inPre = true; } else if (n == "br") { section.lines.push(NEWLINE); } else if (n == "en-media") { @@ -1062,7 +1063,7 @@ function enexXmlToMdArray(stream, resources, options = {}) { for (let i = section.lines.length - 1; i >= 0; i--) { const line = section.lines[i]; if ([BLOCK_OPEN, BLOCK_CLOSE, NEWLINE, NEWLINE_MERGED, SPACE].indexOf(line) >= 0 || !line) { - section.lines.splice(i, 1); + section.lines[i] = ' '; } else if (line === '- ') { break; }