Ejemplo n.º 1
0
 def test_format_markdown(self):
     from fanboi2.helpers.formatters import format_markdown
     from markupsafe import Markup
     request = self._makeRequest()
     tests = [
         ('**Hello, world!**', '<p><strong>Hello, world!</strong></p>\n'),
         ('<b>Foobar</b>', '<p><b>Foobar</b></p>\n'),
         ('Split\n\nParagraph', '<p>Split</p>\n\n<p>Paragraph</p>\n'),
         ('Split\nlines', '<p>Split\nlines</p>\n'),
     ]
     for source, target in tests:
         self.assertEqual(format_markdown(None, request, source),
                          Markup(target))
Ejemplo n.º 2
0
def global_appendix(context, request, cache_region=cache_region_):
    """Returns a HTML of global appendix content. This appendix content is the
    content of ``internal:global/appendix`` page.

    :param context: A :class:`mako.runtime.Context` object.
    :param request: A :class:`pyramid.request.Request` object.
    :param cache_region: Optional cache region to cache this partial.

    :type context: mako.runtime.Context or None
    :type request: pyramid.request.Request
    :type cache_region: dogpile.cache.region.CacheRegion
    :rtype: Markup or None
    """
    page = _get_internal_page('global/appendix', cache_region)
    if page:
        return format_markdown(context, request, page)
Ejemplo n.º 3
0
def global_appendix(context, request, cache_region=cache_region_):
    """Returns a HTML of global appendix content. This appendix content is the
    content of ``internal:global/appendix`` page.

    :param context: A :class:`mako.runtime.Context` object.
    :param request: A :class:`pyramid.request.Request` object.
    :param cache_region: Optional cache region to cache this partial.

    :type context: mako.runtime.Context or None
    :type request: pyramid.request.Request
    :type cache_region: dogpile.cache.region.CacheRegion
    :rtype: Markup or None
    """
    page = _get_internal_page('global/appendix', cache_region)
    if page:
        return format_markdown(context, request, page)
Ejemplo n.º 4
0
 def test_format_markdown_empty(self):
     from fanboi2.helpers.formatters import format_markdown
     request = self._makeRequest()
     self.assertIsNone(format_markdown(None, request, None))