Skip to content
Permalink
Browse files

Fix the smartquotes API change on entry.title

  • Loading branch information
fluffy-critter committed Dec 31, 2019
1 parent 0e14b53 commit 004fb47a3c53830081579e6ae5c1133f1ca2581e
Showing with 7 additions and 6 deletions.
  1. +4 −3 publ/entry.py
  2. +2 −2 publ/markdown.py
  3. +1 −1 tests/templates/entity-titles/index.html
@@ -249,11 +249,12 @@ def title(self) -> typing.Callable[..., str]:
always_show -- always show the title even if the current user is not
authorized to see the entry
"""
def _title(markup=True, no_smartquotes=False, markdown_extensions=None,
always_show=False) -> str:
def _title(markup=True, markdown_extensions=None,
always_show=False, **kwargs) -> str:
if not always_show and not self.authorized:
return ''
return markdown.render_title(self._record.title, markup, no_smartquotes,
smartquotes = kwargs.get('smartquotes', not kwargs.get('no_smartquotes', False))
return markdown.render_title(self._record.title, markup, smartquotes,
markdown_extensions)
return CallableProxy(_title)

@@ -284,7 +284,7 @@ def header(content, level):
return content


def render_title(text, markup=True, no_smartquotes=False, markdown_extensions=None):
def render_title(text, markup=True, smartquotes=True, markdown_extensions=None):
""" Convert a Markdown title to HTML """

# If the title starts with something that looks like a list, save it for
@@ -298,7 +298,7 @@ def render_title(text, markup=True, no_smartquotes=False, markdown_extensions=No
if not markup:
text = html_entry.strip_html(text)

if not no_smartquotes:
if smartquotes:
text = misaka.smartypants(text)

return flask.Markup(text)
@@ -2,5 +2,5 @@

{% block entry %}
{{super()}}
{{image('button.png').get_img_tag(title=entry.title(markup=False),alt_text=entry.title,width=16,link=entry.link)}}
{{image('button.png').get_img_tag(title=entry.title(markup=False),alt_text=entry.title|forceescape,width=16,link=entry.link)}}
{% endblock %}

0 comments on commit 004fb47

Please sign in to comment.
You can’t perform that action at this time.