def test_simple_render():
    tiddler = Tiddler('bar')
    tiddler.text = '<html><h1>Hello</h1></html>'
    tiddler.bag = 'zoo'

    html = render(tiddler, {})
    assert html == ''

    html = render(tiddler, {'tiddlyweb.config': {'wikklytext.safe_mode': True}})
    assert html == ''

    html = render(tiddler, {'tiddlyweb.config': {'wikklytext.safe_mode': False}})
    assert html == '<h1>Hello</h1>'
def test_simple_render():
    tiddler = Tiddler('bar')
    tiddler.text = 'Hello [[monkey]]!'
    tiddler.bag = 'zoo'

    html = render(tiddler, {})
    assert 'href="/bags/zoo/tiddlers/monkey"' in html

    tiddler.recipe = 'city'
    html = render(tiddler, {})
    assert 'href="/recipes/city/tiddlers/monkey"' in html

    html = render(tiddler, {'tiddlyweb.config': {'server_prefix': '/wiki'}})
    assert 'href="/wiki/recipes/city/tiddlers/monkey"' in html
예제 #3
0
def test_simple_render():
    tiddler = Tiddler('bar')
    tiddler.text = """
|hello|goodbye|h
|foo|bar|
"""
    tiddler.bag = 'zoo'

    html = render(tiddler, {})
    assert 'WikError' in html
예제 #4
0
def test_view_link():
    config['wikklytext.safe_mode'] = False
    wikklytextplugins.init(config)
    link_context = {
            '$BASE_URL': '/test/bags/foo/tiddlers',
            '$REFLOW': 0
    }
    
    out = macros.view(WikiContext(test_tiddler,{},link_context), WikiArgument("title"),WikiArgument("link"))
    assert 'Test Tiddler' in out
    assert '</a>' in out
    assert 'href="/test/bags/foo/tiddlers/Test%20Tiddler"' in out
    test_tiddler.fields['bar'] = "80 days"
    test_tiddler.text = "<<view bar linkexternal withlotsargument: 'wondering how this might show' inparams: becauseihavenoidea foo:bar prefix:'around the world in/'>>"
    text = wikklytextrender.render(test_tiddler,{'tiddlyweb.config':config})
    assert 'around the world in/80%20days' in text
def test_fancy_link():
    tiddler = Tiddler('jrbl', 'bug')
    tiddler.text = ulink

    html = render(tiddler, {})
    print html