mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add Typogrify dash config
This commit is contained in:
parent
24d6efa9fd
commit
fe3fe0126b
3 changed files with 17 additions and 0 deletions
|
|
@ -264,6 +264,16 @@ Basic settings
|
|||
``pre`` and ``code`` tags. This requires that Typogrify version 2.0.4 or
|
||||
later is installed
|
||||
|
||||
.. data:: TYPOGRIFY_DASHES = 'default'
|
||||
|
||||
How should Typogrify set up the smartypants filter to interpret multiple
|
||||
hyphen-minus characters? A single ASCII hyphen-minus characters is always
|
||||
rendered as a hyphen. By ``default`` only em-dashes would be generated, by
|
||||
typing double hyphens. The ``oldschool``-style would cause both en-dashes
|
||||
and em-dashes to be rendered, by typing 2 and 3 hyphen-minus characters,
|
||||
respectively. The ``oldschool_inverted`` setting causes them to be
|
||||
interpreted the other way around.
|
||||
|
||||
.. data:: SUMMARY_MAX_LENGTH = 50
|
||||
|
||||
When creating a short summary of an article, this will be the default length
|
||||
|
|
|
|||
|
|
@ -604,6 +604,12 @@ class Readers(FileStampDataCacher):
|
|||
from typogrify.filters import typogrify
|
||||
import smartypants
|
||||
|
||||
typogrify_dashes = self.settings['TYPOGRIFY_DASHES']
|
||||
if typogrify_dashes == 'oldschool':
|
||||
smartypants.Attr.default = smartypants.Attr.set2
|
||||
elif typogrify_dashes == 'oldschool_inverted':
|
||||
smartypants.Attr.default = smartypants.Attr.set3
|
||||
|
||||
# Tell `smartypants` to also replace " HTML entities with
|
||||
# smart quotes. This is necessary because Docutils has already
|
||||
# replaced double quotes with said entities by the time we run
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ DEFAULT_CONFIG = {
|
|||
'ARTICLE_PERMALINK_STRUCTURE': '',
|
||||
'TYPOGRIFY': False,
|
||||
'TYPOGRIFY_IGNORE_TAGS': [],
|
||||
'TYPOGRIFY_DASHES': 'default',
|
||||
'SUMMARY_MAX_LENGTH': 50,
|
||||
'PLUGIN_PATHS': [],
|
||||
'PLUGINS': [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue