Skip to content

Instantly share code, notes, and snippets.

@nagisa
Last active December 13, 2015 20:48
Show Gist options
  • Save nagisa/4972837 to your computer and use it in GitHub Desktop.
Save nagisa/4972837 to your computer and use it in GitHub Desktop.
Hyphenation of words in hakyll
import Text.Hyphenation (hyphenate, english_GB)
import Text.Pandoc (bottomUp, Pandoc)
import Text.Pandoc.Definition
------------------------------------------------------------
hyphenatePandoc :: Pandoc -> Pandoc
hyphenatePandoc = bottomUp (hyphInline :: Inline -> Inline)
where hyphW = intercalate "\x00AD" . hyphenate english_GB
hyphWs = unwords . map hyphW . words
hyphInline (Str str) = Str $ hyphWs str
hyphInline a = a
------------------------------------------------------------
-- …
compile $ pandocCompilerWithTransform defaultHakyllReaderOptions
defaultHakyllWriterOptions
hyphenatePandoc
-- …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment