diff --git a/langfilter/langfilter.hs b/langfilter/langfilter.hs index 07cf42d..3fade8e 100644 --- a/langfilter/langfilter.hs +++ b/langfilter/langfilter.hs @@ -1,4 +1,3 @@ -{-# OPTIONS_GHC -fdefer-typed-holes #-} import Text.Pandoc.Definition import Text.Pandoc.JSON import Text.Pandoc.Builder @@ -9,11 +8,10 @@ import Data.Text (Text) import qualified Data.Text as Text main :: IO () -main = toJSONFilter filter where - filter :: Pandoc -> Pandoc +main = toJSONFilter (filter :: Pandoc -> Pandoc) where filter = - walk spans . walk (concatMap makeFigures) . + walk spans . walk (concatMap glosses) spans :: Inline -> Inline @@ -29,12 +27,20 @@ spans = \case ipaB, ipaN, lang, abbr :: Text -> Inline ipaB = Span (cls ["ipa", "ipa-broad"]) . text' ipaN = Span (cls ["ipa", "ipa-narrow"]) . text' -lang = Span (cls ["lang"]) . text' +lang = Span (cls ["lang"]) . lang' abbr = Span (cls ["abbr"]) . text' . endash text' :: Text -> [Inline] text' = toList . text +lang' :: Text -> [Inline] +lang' txt = case Text.uncons txt of + Nothing -> [] + Just ('{', txt') -> RawInline "html" "" : lang' txt' + Just ('}', txt') -> RawInline "html" "" : lang' txt' + _ -> Str a : lang' b + where (a, b) = Text.span (\c -> c /= '{' && c /= '}') txt + cls :: [Text] -> Attr cls cs = ("", cs, []) diff --git a/style/page.css b/style/page.css index 5a3d59a..02b5ae1 100644 --- a/style/page.css +++ b/style/page.css @@ -180,6 +180,10 @@ dd { break-before: avoid; } +u u { + text-decoration: double underline; +} + .twocol { columns: 2; }