diff --git a/core/modules/parsers/parseutils.js b/core/modules/parsers/parseutils.js index b11300bfe..fcc96b2de 100644 --- a/core/modules/parsers/parseutils.js +++ b/core/modules/parsers/parseutils.js @@ -386,33 +386,31 @@ exports.parseAttribute = function(source,pos) { }; /* -Given a parsed attribute node, serialize it back into its source string representation. +Serialize a parsed attribute node */ exports.serializeAttribute = function(node) { - if(!node || typeof node !== 'object' || !node.name || !node.type) { - return null; + if(!node || typeof node !== "object" || !node.name || !node.type) { + return null; } - var attributeString = node.name; - - if(node.type === 'string') { - if(node.value === 'true') { - return attributeString; - } - attributeString += '="' + node.value + '"'; - } else if(node.type === 'filtered') { - attributeString += '={{{' + node.filter + '}}}'; - } else if(node.type === 'indirect') { - attributeString += '={{' + node.textReference + '}}'; - } else if(node.type === 'substituted') { - attributeString += '=`' + node.rawValue + '`'; - } else if(node.type === 'macro') { - // Assuming macro serialization is complex and handled elsewhere - attributeString += '=' + node.value.serialize(); + if(node.type === "string") { + if(node.value === "true") { + return attributeString; + } + attributeString += '="' + node.value + '"'; + } else if(node.type === "filtered") { + attributeString += "={{{" + node.filter + "}}}"; + } else if(node.type === "indirect") { + attributeString += "={{" + node.textReference + "}}"; + } else if(node.type === "substituted") { + attributeString += "=`" + node.rawValue + "`"; + } else if(node.type === "macro") { + // Assuming macro serialization is complex and handled elsewhere + attributeString += "=" + node.value.serialize(); } else { - return null; // Unsupported type + // Unsupported type + return null; } - return attributeString; }; diff --git a/core/modules/parsers/wikiparser/wikiparser.js b/core/modules/parsers/wikiparser/wikiparser.js index 10acf91ec..57f4983f9 100644 --- a/core/modules/parsers/wikiparser/wikiparser.js +++ b/core/modules/parsers/wikiparser/wikiparser.js @@ -259,7 +259,7 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) { var start = this.pos; var children = this.parseInlineRun(terminatorRegExp); var end = this.pos; - return [{type: "element", tag: "p", children: children, start: start, end: end, rule: 'parseBlock' }]; + return [{type: "element", tag: "p", children: children, start: start, end: end, rule: "parseBlock" }]; }; /*