correctly escape 'a_ ' text, which is not a reference unlike 'a_b '

This commit is contained in:
Axel Kohlmeyer
2018-01-12 12:26:50 -05:00
parent 75d259f5ee
commit 5863f115dd

View File

@ -67,7 +67,8 @@ class RSTMarkup(Markup):
text = text.replace('*', '\\*') text = text.replace('*', '\\*')
text = text.replace('^', '\\^') text = text.replace('^', '\\^')
text = text.replace('|', '\\|') text = text.replace('|', '\\|')
text = re.sub(r'([^"])_', r'\1\\_', text) text = re.sub(r'([^"])_([ \t\n\r\f])', r'\1\\\\_\2', text)
text = re.sub(r'([^"])_([^ \t\n\r\f])', r'\1\\_\2', text)
return text return text
def unescape_rst_chars(self, text): def unescape_rst_chars(self, text):