lots of langfilter stuff, mostly lántas script
This commit is contained in:
parent
4a177d7828
commit
ba5522187c
8 changed files with 348 additions and 132 deletions
19
langfilter/Lang.hs
Normal file
19
langfilter/Lang.hs
Normal file
|
@ -0,0 +1,19 @@
|
|||
module Lang where
|
||||
|
||||
import Text.Pandoc.Definition
|
||||
import Data.Char (toLower)
|
||||
import qualified Data.Text as Text
|
||||
import System.IO
|
||||
|
||||
data Lang = Lántas deriving (Eq, Show)
|
||||
|
||||
type Vars = (?lang :: Maybe Lang)
|
||||
|
||||
toLang :: Maybe MetaValue -> IO (Maybe Lang)
|
||||
toLang (Just (MetaInlines [Str s])) = toLang (Just (MetaString s)) -- ugh
|
||||
toLang (Just (MetaString (Text.map toLower -> s)))
|
||||
| s == "lántas" || s == "laantas" = pure $ Just Lántas
|
||||
toLang Nothing = pure Nothing
|
||||
toLang (Just ℓ) = do
|
||||
hPutStrLn stderr $ "[WARN] unknown language: " <> show ℓ
|
||||
pure Nothing
|
Loading…
Add table
Add a link
Reference in a new issue