From 4377be08e54f03443cf69d44784d334c6529b2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Bo=C3=ABs?= Date: Fri, 17 Aug 2018 00:04:26 +0200 Subject: [PATCH 1/3] Add Exapunk AXIOM syntax highlighter See http://www.zachtronics.com/exapunks/ --- CHANGELOG.md | 2 +- docs/markdown.md | 2 +- lib/helpers/marky-mark.js | 6 +++--- test/marky-mark.js | 7 ++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6171860..0aec5088 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ For detailed information check [Blogophon's releases on Github](https://github.c * :gift: Add favicons to feeds * :gift: Add new properties to `manifest.json` * :gift: Add [abc music notation](http://abcnotation.com/wiki/abc:standard:v2.1) syntax highlighter -* :gift: Add [Exapunk AXIOM](http://www.zachtronics.com/exapunks/) syntax highlighter +* :gift: Add [EXAPUNK's AXIOM](http://www.zachtronics.com/exapunks/) syntax highlighter 1.5.0 ----- diff --git a/docs/markdown.md b/docs/markdown.md index be9dabb4..8bbb565b 100644 --- a/docs/markdown.md +++ b/docs/markdown.md @@ -263,7 +263,7 @@ The following identifiers are supported: * `abc` to output [abc music notation](http://abcnotation.com/wiki/abc:standard:v2.1) examples * `apacheconf` -* `axiom` for [Exapunk AXIOM](http://www.zachtronics.com/exapunks/) +* `axiom` for [EXAPUNK's AXIOM](http://www.zachtronics.com/exapunks/) * `css` * `html` * `ini` diff --git a/lib/helpers/marky-mark.js b/lib/helpers/marky-mark.js index 2deb5531..ff5db44a 100644 --- a/lib/helpers/marky-mark.js +++ b/lib/helpers/marky-mark.js @@ -460,7 +460,7 @@ const markyMark = function(string, rules) { return string .split(/\n/) .map((line) => { - return line.replace(/(^\s*)([A-Z]+)(\s(.+))?\s*$/, (all, start, cmd, args, argsInner) => { + return line.replace(/(^\s*)(@?[A-Z]+)(\s(.+))?\s*$/, (all, start, cmd, args, argsInner) => { args = args || ''; argsInner = argsInner || ''; switch (cmd) { @@ -478,8 +478,8 @@ const markyMark = function(string, rules) { } else if (a.match(/^-?\d+$/)) { return '' + a + ''; // Integers } else if (a.match(/^#/)) { - return '' + a + ''; // Intefaces - } else if (a.match(/[XFTM]/)) { + return '' + a + ''; // Interfaces + } else if (a.match(/([XFTM]|@\{.+\})/)) { return '' + a + ''; // Registers } return a; diff --git a/test/marky-mark.js b/test/marky-mark.js index c1810914..b7751120 100644 --- a/test/marky-mark.js +++ b/test/marky-mark.js @@ -556,9 +556,14 @@ LINK -1 DROP NOTE DONE + +@REP 3 + TEST X = @{0,5} + TJMP CASE@{0,1} +@END `, hasComments: true, - expected: 124 + expected: 124 + 16 } ]; From 6e8754cdcacf7339c35a46f6905b64df1268056b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Bo=C3=ABs?= Date: Fri, 17 Aug 2018 19:48:32 +0200 Subject: [PATCH 2/3] Add Exapunk AXIOM syntax highlighter See http://www.zachtronics.com/exapunks/ --- .gitignore | 1 + CHANGELOG.md | 2 +- docs/markdown.md | 2 +- lib/helpers/marky-mark.js | 25 ++++++++++++++++--------- test/marky-mark.js | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index a1485e0b..fbf2dc60 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /.sublime* /yarn* /.yarn* +/.vscode diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aec5088..55fa5947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ For detailed information check [Blogophon's releases on Github](https://github.c * :gift: Add favicons to feeds * :gift: Add new properties to `manifest.json` * :gift: Add [abc music notation](http://abcnotation.com/wiki/abc:standard:v2.1) syntax highlighter -* :gift: Add [EXAPUNK's AXIOM](http://www.zachtronics.com/exapunks/) syntax highlighter +* :gift: Add [Exapunks' AXIOM](http://www.zachtronics.com/exapunks/) syntax highlighter 1.5.0 ----- diff --git a/docs/markdown.md b/docs/markdown.md index 8bbb565b..cd570c93 100644 --- a/docs/markdown.md +++ b/docs/markdown.md @@ -263,7 +263,7 @@ The following identifiers are supported: * `abc` to output [abc music notation](http://abcnotation.com/wiki/abc:standard:v2.1) examples * `apacheconf` -* `axiom` for [EXAPUNK's AXIOM](http://www.zachtronics.com/exapunks/) +* `axiom` for [Exapunks' AXIOM](http://www.zachtronics.com/exapunks/) * `css` * `html` * `ini` diff --git a/lib/helpers/marky-mark.js b/lib/helpers/marky-mark.js index ff5db44a..90d8402d 100644 --- a/lib/helpers/marky-mark.js +++ b/lib/helpers/marky-mark.js @@ -451,14 +451,13 @@ const markyMark = function(string, rules) { }; /** - * Convert Axiom text node + * Convert Exapunks' Axiom text node * @see http://www.zachtronics.com/exapunks/ * @param {String} string [description] * @return {String} [description] */ internal.convertAxiom = (string) => { - return string - .split(/\n/) + return string.split(/\n/) .map((line) => { return line.replace(/(^\s*)(@?[A-Z]+)(\s(.+))?\s*$/, (all, start, cmd, args, argsInner) => { args = args || ''; @@ -466,21 +465,29 @@ const markyMark = function(string, rules) { switch (cmd) { case 'NOTE': return start + '' + cmd + args + ''; + case '@REP': + case '@END': + return start + '' + cmd + args + ''; case 'MARK': case 'JUMP': case 'TJMP': case 'FJMP': - return start + '' + cmd + ' ' + argsInner + ''; + argsInner = argsInner.replace(/(@\{.+\})/, '$1'); + argsInner = '' + argsInner + ''; + argsInner = argsInner.replace(/<\/b>/g, ''); + return start + '' + cmd + ' ' + argsInner; default: argsInner = argsInner.split(/ /).map((a) => { if (cmd === 'TEST' && a.match(/^(EOF|MRD)$/)) { - return '' + a + ''; // Special test cases + return '' + a + ''; // Special test cases } else if (a.match(/^-?\d+$/)) { - return '' + a + ''; // Integers + return '' + a + ''; // Integers } else if (a.match(/^#/)) { - return '' + a + ''; // Interfaces - } else if (a.match(/([XFTM]|@\{.+\})/)) { - return '' + a + ''; // Registers + return '' + a + ''; // Interfaces + } else if (a.match(/^@/)) { + return '' + a + ''; // Repetitions + } else if (a.match(/[XFTM]/)) { + return '' + a + ''; // Registers } return a; }).join(' '); diff --git a/test/marky-mark.js b/test/marky-mark.js index b7751120..a14c92e3 100644 --- a/test/marky-mark.js +++ b/test/marky-mark.js @@ -522,7 +522,7 @@ DEF [r:and this is a remark with a | or so] FED:|] }, // ----------------------------------------------------------------------- { - language: 'Axiom for Exapunk', + language: 'Axiom for Exapunks', snippet: `
GRAB 200
 SEEK 9999
 SEEK -2

From 1f9d4743af970f29947a15018fd8f87e81b516fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Frank=20Bo=C3=ABs?= 
Date: Fri, 17 Aug 2018 19:49:12 +0200
Subject: [PATCH 3/3] Update NPM package `marked@0.5.0`

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 48373d67..8655e58a 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,7 @@
     "inquirer": "^6.0.0",
     "inquirer-datepicker-prompt": "^0.4.2",
     "js-yaml": "^3.11.0",
-    "marked": "^0.4.0",
+    "marked": "^0.5.0",
     "remove-markdown": "^0.3.0",
     "shelljs": "^0.8.2"
   },