mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #1411 from barrysteyn/typogrify-ignore-list
Allow Typogrify to ignore user specified tags. Refs #1407
This commit is contained in:
commit
b8c9d61f20
6 changed files with 79 additions and 3 deletions
|
|
@ -460,11 +460,20 @@ class Readers(FileStampDataCacher):
|
|||
# eventually filter the content with typogrify if asked so
|
||||
if self.settings['TYPOGRIFY']:
|
||||
from typogrify.filters import typogrify
|
||||
|
||||
def typogrify_wrapper(text):
|
||||
"""Ensures ignore_tags feature is backward compatible"""
|
||||
try:
|
||||
return typogrify(text, self.settings['TYPOGRIFY_IGNORE_TAGS'])
|
||||
except TypeError:
|
||||
return typogrify(text)
|
||||
|
||||
if content:
|
||||
content = typogrify(content)
|
||||
metadata['title'] = typogrify(metadata['title'])
|
||||
content = typogrify_wrapper(content)
|
||||
metadata['title'] = typogrify_wrapper(metadata['title'])
|
||||
|
||||
if 'summary' in metadata:
|
||||
metadata['summary'] = typogrify(metadata['summary'])
|
||||
metadata['summary'] = typogrify_wrapper(metadata['summary'])
|
||||
|
||||
if context_signal:
|
||||
logger.debug('Signal %s.send(%s, <metadata>)',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue