Changeset 103ea45 in sasmodels for doc/_extensions


Ignore:
Timestamp:
Feb 24, 2016 4:57:20 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
431caae
Parents:
b7529e2
Message:

more flexible handling of inline latex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/_extensions/dollarmath.py

    r19dcb933 r103ea45  
    1212import re 
    1313 
    14 _dollar = re.compile(r"(?:^|(?<=\s))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[.,;\\]))") 
     14_dollar = re.compile(r"(?:^|(?<=\s|[(]))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[.,;)\\]))") 
    1515_notdollar = re.compile(r"\\[$]") 
    1616 
     
    5151    assert replace_dollar(u"dollar\$ escape")==u"dollar$ escape" 
    5252    assert replace_dollar(u"dollar \$escape\$ too")==u"dollar $escape$ too" 
     53    assert replace_dollar(u"spaces $in the$ math")==u"spaces :math:`in the` math" 
    5354    assert replace_dollar(u"emb\ $ed$\ ed")==u"emb\ :math:`ed`\ ed" 
    5455    assert replace_dollar(u"$first$a")==u"$first$a" 
    5556    assert replace_dollar(u"a$last$")==u"a$last$" 
     57    assert replace_dollar(u"$37")==u"$37" 
     58    assert replace_dollar(u"($37)")==u"($37)" 
     59    assert replace_dollar(u"$37 - $43")==u"$37 - $43" 
     60    assert replace_dollar(u"($37, $38)")==u"($37, $38)" 
    5661    assert replace_dollar(u"a $mid$dle a")==u"a $mid$dle a" 
     62    assert replace_dollar(u"a ($in parens$) a")==u"a (:math:`in parens`) a" 
     63    assert replace_dollar(u"a (again $in parens$) a")==u"a (again :math:`in parens`) a" 
    5764 
    5865if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.