diff --git a/filters/hyphenate.py b/filters/hyphenate.py index e180477..357754a 100644 --- a/filters/hyphenate.py +++ b/filters/hyphenate.py @@ -1,11 +1,15 @@ import re -from pandocfilters import Str, toJSONFilter +from pandocfilters import Para, Str, toJSONFilter, walk from pyphen import Pyphen -dic = Pyphen(lang='en_GB', left=3, right=3) +dic = Pyphen(lang='en_US', left=3, right=3) word_detection_pattern = re.compile(r'\w{7,}', re.UNICODE) +def inpara(key, value, format, meta): + if key == 'Para': + return Para(walk(value, hyphenate, format, meta)) + def hyphenate(key, value, format, meta): if key == 'Str': return Str(word_detection_pattern.sub( @@ -13,4 +17,4 @@ def hyphenate(key, value, format, meta): value)) if __name__ == "__main__": - toJSONFilter(hyphenate) + toJSONFilter(inpara) diff --git a/index.html b/index.html index d6f50f5..e15b8a8 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ - New Intro­duct­ory Lec­tures On Psycho-Ana­lysis + New Introductory Lectures On Psycho-Analysis