Skip to content

Commit b35a8ee

Browse files
committed
Update server to take starmath as writer name.
1 parent 4d2fd13 commit b35a8ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/Main.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ data Params = Params
3535
} deriving (Show)
3636

3737
data Format =
38-
TeX | MathML | Eqn | OMML | Typst
38+
TeX | MathML | Eqn | OMML | Typst | StarMath
3939
deriving (Show, Ord, Eq)
4040

4141
instance FromJSON Format where
@@ -46,6 +46,7 @@ instance FromJSON Format where
4646
"eqn" -> pure Eqn
4747
"typst" -> pure Typst
4848
"omml" -> pure OMML
49+
"starmath" -> pure StarMath
4950
_ -> fail $ "Unknown format " <> T.unpack s
5051
parseJSON _ = fail "Expecting string format"
5152

@@ -60,6 +61,7 @@ instance FromHttpApiData Format where
6061
"eqn" -> pure Eqn
6162
"typst" -> pure Typst
6263
"omml" -> pure OMML
64+
"starmath" -> pure StarMath
6365
_ -> Left $ "Unknown format " <> t
6466

6567
-- Automatically derive code to convert to/from JSON.
@@ -132,12 +134,14 @@ server = convert
132134
MathML -> readMathML
133135
Eqn -> \_ -> Left "eqn reader not implemented"
134136
Typst -> \_ -> Left "typst reader not implemented"
137+
StarMath -> \_ -> Left "StarMath reader not implemented"
135138
writer = case to params of
136139
Eqn -> writeEqn dt
137140
Typst -> writeTypst dt
138141
OMML -> T.pack . ppElement . writeOMML dt
139142
TeX -> writeTeX
140143
MathML -> T.pack . ppElement . writeMathML dt
144+
StarMath -> writeStarMath dt
141145
in handleErr $ writer <$> reader txt
142146

143147
handleErr (Right t) = return t

0 commit comments

Comments
 (0)