1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-01 21:24:45 +02:00

Making monospace merging permanent

This commit is contained in:
petrz12 2018-04-21 13:55:18 +02:00
parent 69ddcc6e30
commit c8c9f80cc5

View File

@ -463,11 +463,7 @@ function attributeToLowerCase(node) {
return output; return output;
} }
function enexXmlToMdArray(stream, resources, importOptions = null) { function enexXmlToMdArray(stream, resources) {
// TODO: Receive importOptions from upstream
if (!importOptions) importOptions = {};
if (!('mergeMonospaceSections' in importOptions)) importOptions.mergeMonospaceSections = true;
let remainingResources = resources.slice(); let remainingResources = resources.slice();
const removeRemainingResource = (id) => { const removeRemainingResource = (id) => {
@ -702,7 +698,7 @@ function enexXmlToMdArray(stream, resources, importOptions = null) {
} else if (n == "span" || n == "font") { } else if (n == "span" || n == "font") {
// Check for monospace font. It can come from being specified in either from // Check for monospace font. It can come from being specified in either from
// <span style="..."> or <font face="...">. // <span style="..."> or <font face="...">.
if (importOptions.mergeMonospaceSections && nodeAttributes) { if (nodeAttributes) {
let style = null; let style = null;
if (nodeAttributes.style) { if (nodeAttributes.style) {
@ -740,7 +736,7 @@ function enexXmlToMdArray(stream, resources, importOptions = null) {
if (section && section.parent) section = section.parent; if (section && section.parent) section = section.parent;
} else if (n == "span" || n == "font") { } else if (n == "span" || n == "font") {
if (importOptions.mergeMonospaceSections && state.inMonospaceFont) { if (state.inMonospaceFont) {
state.inMonospaceFont = false; state.inMonospaceFont = false;
section.lines.push(MONOSPACE_CLOSE); section.lines.push(MONOSPACE_CLOSE);
} }