1
0
Fork 0
mirror of https://github.com/marty-oehme/scripts.git synced 2024-11-14 13:58:07 +00:00

Issue-27: BugFix: html entities breaking rendering in plantuml. BugFix: part of html was getting saved to file as uml, potential failure

This commit is contained in:
NikhilWanpal 2018-05-02 01:27:20 +05:30
parent 0b123514a7
commit 6c8210bffa

View file

@ -65,6 +65,8 @@ QtObject {
while (match != null) {
var matchedUml = match[1].replace(/\n/gi, "\\n");
var filePath = workDir + "/" + note.id + "_" + (++index);
matchedUml = matchedUml.replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/"/g, "\\\"").replace(/&quot;/g, "\\\"").replace(/&amp;/g, "&");
var params = ["-e", "require('fs').writeFileSync('" + filePath + "', \"" + matchedUml + "\", 'utf8');"];
var result = script.startSynchronousProcess("node", params, html);
@ -108,7 +110,7 @@ QtObject {
* @return {string} the modfied html or an empty string if nothing should be modified
*/
function noteToMarkdownHtmlHook(note, html) {
var plantumlSectionRegex = /<pre><code class=\"language-plantuml\"\>([\s\S]*?)<\/pre>/gmi;
var plantumlSectionRegex = /<pre><code class=\"language-plantuml\"\>([\s\S]*?)(<\/code>)?<\/pre>/gmi;
var plantumlFiles = extractPlantUmlText(html, plantumlSectionRegex, note);