Use <em> instead of <span> for alternian text.
This commit is contained in:
parent
595252a3d3
commit
0cd1b1ace7
2 changed files with 26 additions and 8 deletions
|
@ -40,7 +40,8 @@ _oocre = re.compile(r"([\[(\{])\1.*([\])\}])\2")
|
||||||
# _format_end = re.compile(r"(?i)</([ibu])>")
|
# _format_end = re.compile(r"(?i)</([ibu])>")
|
||||||
_honk = re.compile(r"(?i)\bhonk\b")
|
_honk = re.compile(r"(?i)\bhonk\b")
|
||||||
_groupre = re.compile(r"\\([0-9]+)")
|
_groupre = re.compile(r"\\([0-9]+)")
|
||||||
_alternian = re.compile(r"<alt>.*?</alt>") # Matches get set to alternian font
|
_alternian_begin = re.compile(r"<alt>") # Matches get set to alternian font
|
||||||
|
_alternian_end = re.compile(r"</alt>")
|
||||||
|
|
||||||
quirkloader = ScriptQuirks()
|
quirkloader = ScriptQuirks()
|
||||||
_functionre = None
|
_functionre = None
|
||||||
|
@ -170,9 +171,9 @@ class hyperlink(lexercon.Chunk):
|
||||||
|
|
||||||
def convert(self, format):
|
def convert(self, format):
|
||||||
if format == "html":
|
if format == "html":
|
||||||
return "<a href='{}'>{}</a>".format(self.string, self.string)
|
return f"<a href='{self.string}'>{self.string}</a>"
|
||||||
elif format == "bbcode":
|
elif format == "bbcode":
|
||||||
return "[url]%s[/url]" % (self.string)
|
return f"[url]{self.string}[/url]"
|
||||||
else:
|
else:
|
||||||
return self.string
|
return self.string
|
||||||
|
|
||||||
|
@ -185,13 +186,27 @@ class hyperlink_lazy(hyperlink):
|
||||||
self.string = "http://" + string
|
self.string = "http://" + string
|
||||||
|
|
||||||
|
|
||||||
class alternianTag(lexercon.Chunk):
|
class alternianTagBegin(lexercon.Chunk):
|
||||||
def __init__(self, string):
|
def __init__(self, string):
|
||||||
self.string = string
|
self.string = string
|
||||||
|
|
||||||
def convert(self, format):
|
def convert(self, format):
|
||||||
if format == "html":
|
if format == "html":
|
||||||
return f"<span style=\"font-family: 'AllisDaedric'\">{self.string}</span>"
|
return "<em style=\"font-family:'AllisDaedric'\">"
|
||||||
|
elif format == "text":
|
||||||
|
return ""
|
||||||
|
return self.string
|
||||||
|
|
||||||
|
|
||||||
|
class alternianTagEnd(lexercon.Chunk):
|
||||||
|
def __init__(self, string):
|
||||||
|
self.string = string
|
||||||
|
|
||||||
|
def convert(self, format):
|
||||||
|
if format == "html":
|
||||||
|
return "</em>"
|
||||||
|
elif format == "text":
|
||||||
|
return ""
|
||||||
return self.string
|
return self.string
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,7 +311,8 @@ def kxlexMsg(msg: str):
|
||||||
def lexMessage(string: str):
|
def lexMessage(string: str):
|
||||||
lexlist = [
|
lexlist = [
|
||||||
(mecmd, _mecmdre),
|
(mecmd, _mecmdre),
|
||||||
(alternianTag, _alternian),
|
(alternianTagBegin, _alternian_begin),
|
||||||
|
(alternianTagEnd, _alternian_end),
|
||||||
(colorBegin, _ctag_begin),
|
(colorBegin, _ctag_begin),
|
||||||
# (colorBegin, _gtag_begin),
|
# (colorBegin, _gtag_begin),
|
||||||
(colorEnd, _ctag_end),
|
(colorEnd, _ctag_end),
|
||||||
|
|
|
@ -56,7 +56,8 @@ def rainbow(text):
|
||||||
re.finditer(_smilere, text),
|
re.finditer(_smilere, text),
|
||||||
re.finditer(_memore, text),
|
re.finditer(_memore, text),
|
||||||
re.finditer(_handlere, text),
|
re.finditer(_handlere, text),
|
||||||
re.finditer(_alternian_tags, text),
|
re.finditer(_alternian_begin, text),
|
||||||
|
re.finditer(_alternian_end, text),
|
||||||
)
|
)
|
||||||
for match in match_chain:
|
for match in match_chain:
|
||||||
for color_and_position in colors_and_positions:
|
for color_and_position in colors_and_positions:
|
||||||
|
@ -162,4 +163,5 @@ _smilere = re.compile("|".join(list(smiledict.keys())))
|
||||||
_urlre = re.compile(r"(?i)(?:^|(?<=\s))(?:(?:https?|ftp)://|magnet:)[^\s]+")
|
_urlre = re.compile(r"(?i)(?:^|(?<=\s))(?:(?:https?|ftp)://|magnet:)[^\s]+")
|
||||||
_memore = re.compile(r"(\s|^)(#[A-Za-z0-9_]+)")
|
_memore = re.compile(r"(\s|^)(#[A-Za-z0-9_]+)")
|
||||||
_handlere = re.compile(r"(\s|^)(@[A-Za-z0-9_]+)")
|
_handlere = re.compile(r"(\s|^)(@[A-Za-z0-9_]+)")
|
||||||
_alternian_tags = re.compile(r"<alt>|</alt>")
|
_alternian_begin = re.compile(r"<alt>") # Matches get set to alternian font
|
||||||
|
_alternian_end = re.compile(r"</alt>")
|
||||||
|
|
Loading…
Reference in a new issue