some marginally better errors

This commit is contained in:
Rhiannon Morris 2024-11-28 00:18:50 +01:00
parent 3911f5052b
commit b36e72adf5

View file

@ -11,6 +11,7 @@ import Text.Pandoc.Walk
import Data.Maybe
import Data.Text (Text)
import qualified Data.Text as Text
import Data.Data (toConstr)
glosses :: Vars => Block -> IO [Block]
@ -38,7 +39,10 @@ glossTable = \case
PGloss l p s g t -> Just <$> make l (Just p) Nothing s g t
PNGloss l b n s g t -> Just <$> make l (Just b) (Just n) s g t
HorizontalRule -> pure Nothing
b -> error $ "found " ++ show b ++ " in gloss section"
BulletList xs | let = length xs, < 4 || > 6 ->
fail $ "found list of length " ++ show ++
" in gloss section (missing `---`?)"
b -> fail $ "found unexpected " ++ show (toConstr b) ++ " in gloss section"
where
make l b n s g t = do
let = length $ splitInlines s