From b4be40a3a7ef55d2181acfa6da3b0d19b36e0631 Mon Sep 17 00:00:00 2001 From: Skia Date: Sat, 10 Jun 2017 21:39:56 +0200 Subject: [PATCH] Change the Markdown super and sub texts not to break the Ragots Signed-off-by: Skia --- core/markdown.py | 14 +++++--------- core/templates/core/base.jinja | 8 ++++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/core/markdown.py b/core/markdown.py index 1bcb6ff3..cd631d01 100644 --- a/core/markdown.py +++ b/core/markdown.py @@ -38,7 +38,7 @@ class SithRenderer(Renderer): return """%s""" % text def underline(self, text): - return """%s""" % text + return """%s""" % text def image(self, original_src, title, text): """Rendering a image with title and text. @@ -87,15 +87,11 @@ class SithInlineGrammar(InlineGrammar): underline = re.compile( r'^_{2}([\s\S]+?)_{2}(?!_)' # __word__ ) - exposant = re.compile( # FIXME Does not work for now - r'^\^([\s\S]+?)\^' # ^text^ - # r'|' # FIXME doesn't properly works like this - # r'^\^(\S+)' # ^word + exposant = re.compile( + r'^([\s\S]+?)' # text ) indice = re.compile( - r'^_([\s\S]+?)_' # _text_ (^` hack, because no other solution were found :/ this sadly prevent code in indices) - # r'|' # FIXME doesn't properly works like this - # r'^_(\S+)' # _word + r'^([\s\S]+?)' # text ) class SithInlineLexer(InlineLexer): @@ -103,7 +99,7 @@ class SithInlineLexer(InlineLexer): default_rules = [ 'escape', - 'inline_html', + # 'inline_html', 'autolink', 'url', 'footnote', diff --git a/core/templates/core/base.jinja b/core/templates/core/base.jinja index 0de6e1f1..9e0b0845 100644 --- a/core/templates/core/base.jinja +++ b/core/templates/core/base.jinja @@ -219,12 +219,12 @@ function add_syntax(e, choice) { ta.selectionEnd = end + 2; break; case "sub": - ta.value = before + "_" + between + "_" + after; - ta.selectionEnd = end + 1; + ta.value = before + "" + between + "" + after; + ta.selectionEnd = end + 5; break; case "sup": - ta.value = before + "^" + between + "^" + after; - ta.selectionEnd = end + 1; + ta.value = before + "" + between + "" + after; + ta.selectionEnd = end + 5; break; case "link": if (between === "") {