Skip to content

Commit

Permalink
new markdown support
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Dec 12, 2017
1 parent 28733ea commit f059aa5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/appier_extras/parts/prismic/partials/_prismic.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

import appier

from appier_extras import utils

class Prismic(object):
"""
Partial (mixin) that adds the Prismic CMS proxy functionality
Expand Down Expand Up @@ -146,6 +148,36 @@ def prismic_value(
prismic_cache.set_item(cache_key, value, expires = time.time() + timeout)
return value

def prismic_markdown(
self,
key,
include = 10,
default = None,
verify = False,
encoding = "utf-8",
options = dict(
anchors = False,
blank = False
),
*args,
**kwargs
):
value = self.prismic_value(
key,
include = include,
default = default,
verify = verify,
*args,
**kwargs
)
if not value: return value
html_b = utils.MarkdownHTML.process_str(
value,
options = options
)
html_s = html_b.decode(encoding)
return html_s

@property
def prismic_api(self):
import prismic
Expand Down

0 comments on commit f059aa5

Please sign in to comment.