From ac5a0dc485c898e85548a64254764542cc717f00 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Thu, 26 Apr 2018 07:59:21 +0200 Subject: [PATCH] did some character escaping --- selected-markdown-to-jira/info.json | 2 +- selected-markdown-to-jira/selected-markdown-to-jira.qml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/selected-markdown-to-jira/info.json b/selected-markdown-to-jira/info.json index e24460e..1e5b959 100644 --- a/selected-markdown-to-jira/info.json +++ b/selected-markdown-to-jira/info.json @@ -3,7 +3,7 @@ "identifier": "selected-markdown-to-jira", "script": "selected-markdown-to-jira.qml", "authors": ["@pbek"], - "version": "0.0.5", + "version": "1.0.0", "minAppVersion": "17.05.7", "description" : "With this script you can right click the selected text and convert it to Jira Code in the clipboard.\n\nDependencies\nNode.js\njira2md (installed via npm)\n\nInstallation\nAfter you have installed Node.js you can install jira2md by typing:\nsudo npm install -g jira2md\n\nYou might also need to set your NODE_PATH to the path where the module did get installed with for example:\nexport NODE_PATH=/usr/local/lib/node_modules" } diff --git a/selected-markdown-to-jira/selected-markdown-to-jira.qml b/selected-markdown-to-jira/selected-markdown-to-jira.qml index 3be73d0..8b8d545 100644 --- a/selected-markdown-to-jira/selected-markdown-to-jira.qml +++ b/selected-markdown-to-jira/selected-markdown-to-jira.qml @@ -50,6 +50,9 @@ QtObject { text = text.replace(/^-/gm, "*"); text = text.replace(/\t-/gm, "\t*"); + // some character escaping + text = text.replace(/\{/gm, "\\{").replace(/\}/gm, "\\}"); + // you need NodeJs and jira2md (https://github.com/kylefarris/J2M) to convert Markdown to Jira var params = ["-e", "console.log(require('jira2md').to_jira(require('fs').readFileSync('/dev/stdin').toString()))"]; var result = script.startSynchronousProcess(nodejsExecutablePath, params, text);