pass other classes/id thru with gloss
This commit is contained in:
parent
7a205bc6bd
commit
0adea5d063
1 changed files with 6 additions and 2 deletions
|
@ -9,16 +9,20 @@ import Text.Pandoc.Builder
|
||||||
import Text.Pandoc.Walk
|
import Text.Pandoc.Walk
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
import qualified Data.Text as Text
|
||||||
|
|
||||||
|
|
||||||
glosses :: Vars => Block -> IO [Block]
|
glosses :: Vars => Block -> IO [Block]
|
||||||
glosses = \case
|
glosses = \case
|
||||||
Div (_, cs, _) blocks | "glosses" `elem` cs -> do
|
Div (i, cs, _) blocks | "glosses" `elem` cs -> do
|
||||||
tables <- traverse glossTable blocks
|
tables <- traverse glossTable blocks
|
||||||
pure $
|
pure $
|
||||||
[RawBlock (Format "html") "<figure class=glosses>"] ++
|
[RawBlock (Format "html") $ "<figure" <> id <> classes <> ">"] ++
|
||||||
catMaybes tables ++
|
catMaybes tables ++
|
||||||
[RawBlock (Format "html") "</figure>"]
|
[RawBlock (Format "html") "</figure>"]
|
||||||
|
where
|
||||||
|
id = if i == "" then "" else " id=\"" <> i <> "\""
|
||||||
|
classes = " class=\"" <> Text.unwords cs <> "\""
|
||||||
b -> pure [b]
|
b -> pure [b]
|
||||||
|
|
||||||
pattern Gloss l g w t = BulletList [[Plain l], [Plain g], [Plain w], [Plain t]]
|
pattern Gloss l g w t = BulletList [[Plain l], [Plain g], [Plain w], [Plain t]]
|
||||||
|
|
Loading…
Reference in a new issue