From 10558fce596ed7ad9f44b2dab32d633382dac6e9 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 26 Nov 2014 21:14:40 -0500 Subject: [PATCH] src: nitunit and docdown use the fence-tag to skip non-nit code Signed-off-by: Jean Privat --- src/docdown.nit | 7 +++++++ src/testing/testing_doc.nit | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/docdown.nit b/src/docdown.nit index 42c48c3..08a776e 100644 --- a/src/docdown.nit +++ b/src/docdown.nit @@ -235,6 +235,13 @@ private class Doc2Mdwn fun process_code(n: HTMLTag, text: String, tag: nullable String) do + # Do not try to highlight non-nit code. + if tag != null and tag != "" and tag != "nit" and tag != "nitish" then + n.append text + n.add_class("rawcode") + return + end + # Try to parse it var ast = toolcontext.parse_something(text) diff --git a/src/testing/testing_doc.nit b/src/testing/testing_doc.nit index 86466bf..501ccfd 100644 --- a/src/testing/testing_doc.nit +++ b/src/testing/testing_doc.nit @@ -39,6 +39,11 @@ class NitUnitExecutor # Skip non-blocks if n.tag != "pre" then return + # Skip strict non-nit + if tag != null and tag != "nit" and tag != "" then + return + end + # Try to parse it var ast = toolcontext.parse_something(text) -- 1.7.9.5