Exemple #1
0
def test_singlegroups(s: str):
    assert unwind(parse(Registry(NoopBlock, Bold), '*' + s + '*',
                        NoopBlock)) == ['div', ['strong', {}, s]]
    assert unwind(parse(Registry(NoopBlock, Italic), '_' + s + '_',
                        NoopBlock)) == ['div', ['em', {}, s]]
    assert unwind(
        parse(Registry(NoopBlock, Monospace), '`' + s + '`',
              NoopBlock)) == ['div', ['code', {}, s]]
Exemple #2
0
def test_tooltip():
    assert unwind(
        parse(Registry(NoopBlock, Tooltip), 'T[text](tooltip)',
              NoopBlock)) == [
                  'div',
                  ['span.tooltip', 'text', ['div.tooltip-text', 'tooltip']]
              ]
Exemple #3
0
def test_header(s: str, n: int):
    assert unwind(
        parse(Registry(Paragraphs, Header), '#' * n + ' ' + s,
              Paragraphs)) == [
                  'div', ['h' + str(n), ['a.anchor', {
                      'id': s.lower()
                  }, s]]
              ]
Exemple #4
0
def test_standard_registry():
    t1 = """
# Placeholder

* bold *

new paragraph
  """
    assert unwind(parse(Standard, t1)) == [
        'div', ['h1', ['a.anchor', {
            'id': 'placeholder'
        }, 'Placeholder']], ['p', ['strong', {}, ' bold ']],
        ['p', 'new paragraph']
    ]
Exemple #5
0
def test_criticsub():
    assert unwind(
        parse(Registry(Paragraphs, CriticSub), '{~~a~>b~~}',
              Paragraphs)) == ['div', ['p', [['del', 'a'], ['ins', 'b']]]]