support {underline braces} in glosses

This commit is contained in:
Rhiannon Morris 2021-05-20 22:15:24 +02:00
parent 2b80abe763
commit 22b122285a
4 changed files with 39 additions and 31 deletions

View file

@ -2,7 +2,8 @@ module Glosses (glosses) where
import Lang
import LaantasImage
import Spans
import Spans (abbrs)
import qualified Spans
import Text.Pandoc.Definition
import Text.Pandoc.Builder
@ -39,7 +40,7 @@ glossTable = \case
make l p s g t = do
let n = length $ splitInlines s
let colspecs = replicate n (AlignDefault, ColWidthDefault)
let l' = cell1 n l; p' = cell1 n <$> p
let l' = cell1 n $ underlines l; p' = cell1 n <$> p
let ss = cells s; gs = cells g; t' = cell1 n t
img <- case ?lang of
Just Lántas ->
@ -74,3 +75,8 @@ splitInlines is = filter (not . null) $ go is where
go is =
let (is1, is') = break (== Space) is in
fromList is1 : splitInlines (dropWhile (== Space) is')
underlines :: [Inline] -> [Inline]
underlines = concatMap \case
Str txt -> Spans.underlines txt
i -> [i]