================
 Link Rendering
================

`test link rendering as a multiadapter`

wicked uses browser:page to take care of setting up the multiadapter +
template binding.  Lazy? yes. Future safe? probably better than hand
rolling.

    >>> from zope.component import getMultiAdapter
    >>> from wicked.interfaces import IAmWicked
    >>> try:
    ...     from zope.publisher.interfaces.browser import IDefaultBrowserLayer
    ... except:
    ...     from zope.publisher.interfaces.browser import IBrowserRequest as IDefaultBrowserLayer
    >>> from zope.interface import alsoProvides as mark
    >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
    >>> from wicked.testing.general import dummy
    >>> request = dummy(dict(physicalPathToURL=lambda x, y, z: 'http://url'),
    ...                 iface=IDefaultBrowserLayer, name='request')
    >>> manage_addFiveTraversableFolder(self.folder, 'testfo', title='folder')
    >>> context = self.folder.testfo
    >>> mark(context, IAmWicked)
    >>> from zope.interface import Interface
    >>> renderer = getMultiAdapter((context, request), Interface, 'link_renderer')
    >>> renderer = self.folder.testfo.restrictedTraverse('@@link_renderer')
    >>> link=dict(path='/apath',
    ...           icon='anicon.ico',
    ...           uid='uid')
    >>> renderer.load([link], 'Chunk')
    >>> renderer.section='fieldname'
    >>> from wicked.testing.xml import xstrip
    >>> print  xstrip(renderer())
    <span id="fieldname-uid"><a class="link-wiki" href="http://nohost/apath">...Chunk</a></span>...


    >>> renderer.load([], 'Chunk 2')
    >>> print xstrip(renderer())
    <span class="" id="fieldname-1"><a class="link-wiki-add" title="Click to add a new page" href="http://nohost/test_folder_1_/testfo/@@wickedadd?Title=Chunk%202&amp;section=fieldname">...Chunk 2<sup>[+]</sup></a></span>...

Test counter::

    >>> renderer.load([], 'Chunk 3')
    >>> print xstrip(renderer())
    <span class="" id="fieldname-2"><a class="link-wiki-add" title="Click to add a new page" href="http://nohost/test_folder_1_/testfo/@@wickedadd?Title=Chunk%203&amp;section=fieldname">...Chunk 3<sup>[+]</sup></a></span>...
