u"""Match Latex-like syntax for unicode characters base on the name of the character. This does ``\\GREEK SMALL LETTER ETA`` -> ``η`` Works only on valid python 3 identifier, or on combining characters that will combine to form a valid identifier. Used on
(self, text)
| 1672 | return [leading + k + suf for k in matches] |
| 1673 | |
| 1674 | def unicode_name_matches(self, text): |
| 1675 | u"""Match Latex-like syntax for unicode characters base |
| 1676 | on the name of the character. |
| 1677 | |
| 1678 | This does ``\\GREEK SMALL LETTER ETA`` -> ``η`` |
| 1679 | |
| 1680 | Works only on valid python 3 identifier, or on combining characters that |
| 1681 | will combine to form a valid identifier. |
| 1682 | |
| 1683 | Used on Python 3 only. |
| 1684 | """ |
| 1685 | slashpos = text.rfind('\\') |
| 1686 | if slashpos > -1: |
| 1687 | s = text[slashpos+1:] |
| 1688 | try : |
| 1689 | unic = unicodedata.lookup(s) |
| 1690 | # allow combining chars |
| 1691 | if ('a'+unic).isidentifier(): |
| 1692 | return '\\'+s,[unic] |
| 1693 | except KeyError: |
| 1694 | pass |
| 1695 | return u'', [] |
| 1696 | |
| 1697 | |
| 1698 | def latex_matches(self, text): |