|
Lines 789-795
Link Here
|
| 789 |
|
789 |
|
| 790 |
def doc_literal( |
790 |
def doc_literal( |
| 791 |
self, s, |
791 |
self, s, |
| 792 |
expr = re.compile(r"(\W+|^)'([%s%s%s\s]+)'([%s]+|$)" % (letters, digits, literal_punc, phrase_delimiters)).search,): |
792 |
expr = re.compile(r"(\W+|^)'((?:\w|[%s%s\s])+)'([%s]+|$)" % (digits, literal_punc, phrase_delimiters), re.U).search,): |
| 793 |
|
793 |
|
| 794 |
# old expr... failed to cross newlines. |
794 |
# old expr... failed to cross newlines. |
| 795 |
# expr=re.compile( |
795 |
# expr=re.compile( |
|
Lines 807-813
Link Here
|
| 807 |
|
807 |
|
| 808 |
def doc_emphasize( |
808 |
def doc_emphasize( |
| 809 |
self, s, |
809 |
self, s, |
| 810 |
expr = re.compile(r'\*([%s%s%s\s]+?)\*' % (letters, digits, strongem_punc)).search |
810 |
# i18nal variant |
|
|
811 |
expr = re.compile(r'\*((?:\w|[%s\s])+?)\*' % (strongem_punc), re.U).search |
| 812 |
#expr = re.compile(r'\*([%s%s%s\s]+?)\*' % (letters, digits, strongem_punc)).search |
| 811 |
#expr = re.compile(r'\s*\*([ \n\r%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search # old expr, inconsistent punctuation |
813 |
#expr = re.compile(r'\s*\*([ \n\r%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search # old expr, inconsistent punctuation |
| 812 |
): |
814 |
): |
| 813 |
|
815 |
|
|
Lines 853-859
Link Here
|
| 853 |
|
855 |
|
| 854 |
def doc_underline(self, |
856 |
def doc_underline(self, |
| 855 |
s, |
857 |
s, |
| 856 |
expr=re.compile(r'_([%s%s%s\s]+)_([\s%s]|$)' % (letters, digits, under_punc,phrase_delimiters)).search): |
858 |
expr=re.compile(r'_((?:\w|[%s\s])+)_([\s%s]|$)' % (under_punc,phrase_delimiters), re.U).search): |
| 857 |
|
859 |
|
| 858 |
result = expr(s) |
860 |
result = expr(s) |
| 859 |
if result: |
861 |
if result: |
|
Lines 867-873
Link Here
|
| 867 |
|
869 |
|
| 868 |
def doc_strong(self, |
870 |
def doc_strong(self, |
| 869 |
s, |
871 |
s, |
| 870 |
expr = re.compile(r'\*\*([%s%s%s\s]+?)\*\*' % (letters, digits, strongem_punc)).search |
872 |
expr = re.compile(r'\*\*((?:\w|[%s%s\s])+?)\*\*' % (digits, strongem_punc), re.U).search |
| 871 |
#expr = re.compile(r'\s*\*\*([ \n\r%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*\*(?!\*|-)' % letters).search, # old expr, inconsistent punc, failed to cross newlines. |
873 |
#expr = re.compile(r'\s*\*\*([ \n\r%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*\*(?!\*|-)' % letters).search, # old expr, inconsistent punc, failed to cross newlines. |
| 872 |
): |
874 |
): |
| 873 |
|
875 |
|
|
Lines 879-885
Link Here
|
| 879 |
return None |
881 |
return None |
| 880 |
|
882 |
|
| 881 |
## Some constants to make the doc_href() regex easier to read. |
883 |
## Some constants to make the doc_href() regex easier to read. |
| 882 |
_DQUOTEDTEXT = r'("[ %s0-9\n\r%s]+")' % (letters,dbl_quoted_punc) ## double quoted text |
884 |
_DQUOTEDTEXT = r'("[^"]+")' |
| 883 |
_ABSOLUTE_URL=r'((http|https|ftp|mailto|file|about)[:/]+?[%s0-9_\@\.\,\?\!\/\:\;\-\#\~\=\&\%%\+]+)' % letters |
885 |
_ABSOLUTE_URL=r'((http|https|ftp|mailto|file|about)[:/]+?[%s0-9_\@\.\,\?\!\/\:\;\-\#\~\=\&\%%\+]+)' % letters |
| 884 |
_ABS_AND_RELATIVE_URL=r'([%s0-9_\@\.\,\?\!\/\:\;\-\#\~\=\&\%%\+]+)' % letters |
886 |
_ABS_AND_RELATIVE_URL=r'([%s0-9_\@\.\,\?\!\/\:\;\-\#\~\=\&\%%\+]+)' % letters |
| 885 |
|
887 |
|
|
Lines 887-898
Link Here
|
| 887 |
|
889 |
|
| 888 |
|
890 |
|
| 889 |
def doc_href1(self, s, |
891 |
def doc_href1(self, s, |
| 890 |
expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search |
892 |
expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES, re.U).search |
| 891 |
): |
893 |
): |
| 892 |
return self.doc_href(s, expr) |
894 |
return self.doc_href(s, expr) |
| 893 |
|
895 |
|
| 894 |
def doc_href2(self, s, |
896 |
def doc_href2(self, s, |
| 895 |
expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search |
897 |
expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES, re.U).search |
| 896 |
): |
898 |
): |
| 897 |
return self.doc_href(s, expr) |
899 |
return self.doc_href(s, expr) |
| 898 |
|
900 |
|