# dollarmath.py by Akihiro Uchida *public domain* # the original one is written by Paul Kienzle # and published as public domain in [sphinx-dev]: $math$ extension r""" Allow $math$ markup in text and docstrings, ignoring \$. The $math$ markup should be separated from the surrounding text by spaces. To embed markup within a word, place backslash-space before and after. For convenience, the final $ can be followed by punctuation (period, comma or semicolon). """ import re dollar_pat = r"(?:^|(?<=\s))[$]([^\n]*?)(?