Did I find the right examples for you? yes no

All Samples(6)  |  Call(6)  |  Derive(0)  |  Import(0)

        def htransform(content, transform):
    # Attempt to fetch it from cache
    digest = hashlib.sha1(content).hexdigest()
    if os.path.exists(os.path.join('cache', digest)):
        with open(os.path.join('cache', digest), 'r') as infh:
            return infh.read()

    # Choose a htransform function 
    render_function = htransform_mapper.get(transform, markdown)
    output_buf = render_function(content)

    # Write to cache before returning
    with open(os.path.join('cache', digest), 'w') as outfh:
        outfh.write(output_buf)
        return output_buf
        


src/r/e/rejourn-HEAD/core.py   rejourn(Download)
        if markup is None:
            markup = context.get('htransform', 'markdown')
        context['html_content'] = util.htransform(self.content, markup)
        try:
            return template.render(**context)
                snip = header.get('snip', '')
                if not len(snip) and (not 'snips' in self.config or self.config['snips'] == True):
                    snip = util.htransform(content, self.config.get('htransform', None))[:50] + ' ...'
                if not self.rss:
                    html_content = util.htransform(content, self.config.get('htransform', None))
                else:
                    rss_content = saxutils.escape(util.htransform(content, self.config.get('htransform', None)))

src/r/e/rejourn-HEAD/tests.py   rejourn(Download)
    def test_markdown_lib(self):
        assert util.htransform("*strong* hammer", 'markdown') == "<p><em>strong</em> hammer</p>"
 
    def test_asciidoc_lib(self):
        assert util.htransform("`strong` `{hammer}`", 'asciidoc') == """<div class="paragraph"><p><tt>strong</tt> <tt>{hammer}</tt></p></div>\r\n"""