Add MXP support for anchor tags
This commit is contained in:
parent
0bd7860974
commit
7358758987
6 changed files with 35 additions and 5 deletions
|
|
@ -16,12 +16,14 @@ http://www.gammon.com.au/mushclient/addingservermxp.htm
|
|||
import re
|
||||
|
||||
LINKS_SUB = re.compile(r"\|lc(.*?)\|lt(.*?)\|le", re.DOTALL)
|
||||
URL_SUB = re.compile(r"\|lu(.*?)\|lt(.*?)\|le", re.DOTALL)
|
||||
|
||||
# MXP Telnet option
|
||||
MXP = bytes([91]) # b"\x5b"
|
||||
|
||||
MXP_TEMPSECURE = "\x1B[4z"
|
||||
MXP_SEND = MXP_TEMPSECURE + '<SEND HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</SEND>"
|
||||
MXP_URL = MXP_TEMPSECURE + '<A HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</A>"
|
||||
|
||||
|
||||
def mxp_parse(text):
|
||||
|
|
@ -38,6 +40,7 @@ def mxp_parse(text):
|
|||
text = text.replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
|
||||
text = LINKS_SUB.sub(MXP_SEND, text)
|
||||
text = URL_SUB.sub(MXP_URL, text)
|
||||
return text
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue