From d51ea90e1838ffde0481137b708f2538c4ff3eb8 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 11 Nov 2016 15:49:28 -0800 Subject: [PATCH 1/2] Code fix to allow adding markmin translations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Playing with this file made me realize that the quotes defining the strings themselves are added to the regex searches, and that my previous addition caused invalid syntax. So, I decided to fix this by placing the first quote before the markmin decorator. (Triple quotes won’t work, however…) --- gluon/languages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/languages.py b/gluon/languages.py index afc5b3324..ff9ff4cf6 100644 --- a/gluon/languages.py +++ b/gluon/languages.py @@ -962,7 +962,7 @@ def findT(path, language=DEFAULT_LANGUAGE): + listdir(vp, '^.+\.html$', 0) + listdir(mop, '^.+\.py$', 0): data = to_native(read_locked(filename)) items = regex_translate.findall(data) - items += ["@markmin\x01%s" %x for x in regex_translate_m.findall(data)] + for x in regex_translate_m.findall(data): items.append("%s@markmin\x01%s" %(x[0], x[1:])) for item in items: try: message = safe_eval(item) From 90ee6f3754c324709073bf858b3c5c1234255b5e Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 11 Nov 2016 15:51:01 -0800 Subject: [PATCH 2/2] Add three-quote support on markmin --- gluon/languages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gluon/languages.py b/gluon/languages.py index ff9ff4cf6..0faedf33e 100644 --- a/gluon/languages.py +++ b/gluon/languages.py @@ -962,7 +962,9 @@ def findT(path, language=DEFAULT_LANGUAGE): + listdir(vp, '^.+\.html$', 0) + listdir(mop, '^.+\.py$', 0): data = to_native(read_locked(filename)) items = regex_translate.findall(data) - for x in regex_translate_m.findall(data): items.append("%s@markmin\x01%s" %(x[0], x[1:])) + for x in regex_translate_m.findall(data): + if x[0:3] in ["'''", '"""']: items.append("%s@markmin\x01%s" %(x[0:3], x[3:])) + else: items.append("%s@markmin\x01%s" %(x[0], x[1:])) for item in items: try: message = safe_eval(item)