Commit b4be40a3 authored by Skia's avatar Skia 🤘
Browse files

Change the Markdown super and sub texts not to break the Ragots


Signed-off-by: Skia's avatarSkia <skia@libskia.so>
parent 58beb551
Pipeline #1052 passed with stage
in 4 minutes and 43 seconds
...@@ -38,7 +38,7 @@ class SithRenderer(Renderer): ...@@ -38,7 +38,7 @@ class SithRenderer(Renderer):
return """<sub>%s</sub>""" % text return """<sub>%s</sub>""" % text
def underline(self, text): def underline(self, text):
return """<span class="underline">%s</span>""" % text return """<u>%s</u>""" % text
def image(self, original_src, title, text): def image(self, original_src, title, text):
"""Rendering a image with title and text. """Rendering a image with title and text.
...@@ -87,15 +87,11 @@ class SithInlineGrammar(InlineGrammar): ...@@ -87,15 +87,11 @@ class SithInlineGrammar(InlineGrammar):
underline = re.compile( underline = re.compile(
r'^_{2}([\s\S]+?)_{2}(?!_)' # __word__ r'^_{2}([\s\S]+?)_{2}(?!_)' # __word__
) )
exposant = re.compile( # FIXME Does not work for now exposant = re.compile(
r'^\^([\s\S]+?)\^' # ^text^ r'^<sup>([\s\S]+?)</sup>' # <sup>text</sup>
# r'|' # FIXME doesn't properly works like this
# r'^\^(\S+)' # ^word
) )
indice = re.compile( indice = re.compile(
r'^_([\s\S]+?)_' # _text_ (^` hack, because no other solution were found :/ this sadly prevent code in indices) r'^<sub>([\s\S]+?)</sub>' # <sub>text</sub>
# r'|' # FIXME doesn't properly works like this
# r'^_(\S+)' # _word
) )
class SithInlineLexer(InlineLexer): class SithInlineLexer(InlineLexer):
...@@ -103,7 +99,7 @@ class SithInlineLexer(InlineLexer): ...@@ -103,7 +99,7 @@ class SithInlineLexer(InlineLexer):
default_rules = [ default_rules = [
'escape', 'escape',
'inline_html', # 'inline_html',
'autolink', 'autolink',
'url', 'url',
'footnote', 'footnote',
......
...@@ -219,12 +219,12 @@ function add_syntax(e, choice) { ...@@ -219,12 +219,12 @@ function add_syntax(e, choice) {
ta.selectionEnd = end + 2; ta.selectionEnd = end + 2;
break; break;
case "sub": case "sub":
ta.value = before + "_" + between + "_" + after; ta.value = before + "<sub>" + between + "</sub>" + after;
ta.selectionEnd = end + 1; ta.selectionEnd = end + 5;
break; break;
case "sup": case "sup":
ta.value = before + "^" + between + "^" + after; ta.value = before + "<sup>" + between + "</sup>" + after;
ta.selectionEnd = end + 1; ta.selectionEnd = end + 5;
break; break;
case "link": case "link":
if (between === "") { if (between === "") {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment