of long words being wrapped on new lines.
The hyphenation is done using `Pyphen <http://pyphen.org/>`_ and is applied to
-whole document contents and article summaries (except for literal and raw
-blocks, of course). All other fields including document title are excluded from
-hyphenation. You can see it in practice in the following convoluted example,
-it's also language-aware:
+whole document contents and fields that are included in the :py:`FORMATTED_FIELDS`.
+All other fields including document title are excluded from hyphenation, the
+same goes for literal and raw blocks. You can see it in practice in the
+following convoluted example, it's also language-aware:
.. code-figure::
isinstance(txtnode.parent, nodes.raw):
continue
- # From fields include only the summary
+ # From fields include only the ones that are in
+ # FORMATTED_FIELDS
if isinstance(txtnode.parent.parent, nodes.field_body):
field_name_index = txtnode.parent.parent.parent.first_child_matching_class(nodes.field_name)
- if txtnode.parent.parent.parent[field_name_index][0] != 'summary':
+ if txtnode.parent.parent.parent[field_name_index][0] not in settings['FORMATTED_FIELDS']:
continue
# Useful for debugging, don't remove ;)
global settings
settings['M_HTMLSANITY_HYPHENATION'] = pelicanobj.settings.get('M_HTMLSANITY_HYPHENATION', False)
settings['M_HTMLSANITY_SMART_QUOTES'] = pelicanobj.settings.get('M_HTMLSANITY_SMART_QUOTES', False)
- for i in 'DEFAULT_LANG', 'DOCUTILS_SETTINGS', 'INTRASITE_LINK_REGEX', 'SITEURL':
+ for i in 'DEFAULT_LANG', 'DOCUTILS_SETTINGS', 'INTRASITE_LINK_REGEX', 'SITEURL', 'FORMATTED_FIELDS':
settings[i] = pelicanobj.settings[i]
def add_reader(readers):