@@ -65,6 +65,7 @@ defaultConfiguration =
6565 plantumlPreamble = mempty ,
6666 sagemathPreamble = mempty ,
6767 d2Preamble = mempty ,
68+ asyPreamble = mempty ,
6869 -- Executables
6970 matplotlibExe = python,
7071 matlabExe = " matlab" ,
@@ -80,6 +81,7 @@ defaultConfiguration =
8081 plantumlExe = " java" ,
8182 sagemathExe = " sage" ,
8283 d2Exe = " d2" ,
84+ asyExe = " asy" ,
8385 -- Command line arguments
8486 matplotlibCmdArgs = mempty ,
8587 matlabCmdArgs = mempty ,
@@ -95,6 +97,7 @@ defaultConfiguration =
9597 plantumlCmdArgs = " -jar plantuml.jar" ,
9698 sagemathCmdArgs = mempty ,
9799 d2CmdArgs = mempty ,
100+ asyCmdArgs = mempty ,
98101 -- Extras
99102 matplotlibTightBBox = False ,
100103 matplotlibTransparent = False
@@ -155,7 +158,8 @@ data ConfigPrecursor = ConfigPrecursor
155158 _plotsjlPrec :: ! PlotsjlPrecursor ,
156159 _plantumlPrec :: ! PlantUMLPrecursor ,
157160 _sagemathPrec :: ! SageMathPrecursor ,
158- _d2Prec :: ! D2Precursor
161+ _d2Prec :: ! D2Precursor ,
162+ _asyPrec :: ! AsyPrecursor
159163 }
160164
161165defaultConfigPrecursor :: ConfigPrecursor
@@ -183,7 +187,8 @@ defaultConfigPrecursor =
183187 _plotsjlPrec = PlotsjlPrecursor Nothing (plotsjlExe defaultConfiguration) (plotsjlCmdArgs defaultConfiguration),
184188 _plantumlPrec = PlantUMLPrecursor Nothing (plantumlExe defaultConfiguration) (plantumlCmdArgs defaultConfiguration),
185189 _sagemathPrec = SageMathPrecursor Nothing (sagemathExe defaultConfiguration) (sagemathCmdArgs defaultConfiguration),
186- _d2Prec = D2Precursor Nothing (d2Exe defaultConfiguration) (d2CmdArgs defaultConfiguration)
190+ _d2Prec = D2Precursor Nothing (d2Exe defaultConfiguration) (d2CmdArgs defaultConfiguration),
191+ _asyPrec = AsyPrecursor Nothing (asyExe defaultConfiguration) (asyCmdArgs defaultConfiguration)
187192 }
188193
189194data LoggingPrecursor = LoggingPrecursor
@@ -226,6 +231,8 @@ data SageMathPrecursor = SageMathPrecursor {_sagemathPreamble :: !(Maybe FilePat
226231
227232data D2Precursor = D2Precursor { _d2Preamble :: ! (Maybe FilePath ), _d2Exe :: ! FilePath , _d2CmdArgs :: ! Text }
228233
234+ data AsyPrecursor = AsyPrecursor { _asyPreamble :: ! (Maybe FilePath ), _asyExe :: ! FilePath , _asyCmdArgs :: ! Text }
235+
229236instance FromJSON LoggingPrecursor where
230237 parseJSON (Object v) =
231238 LoggingPrecursor
@@ -298,6 +305,10 @@ instance FromJSON D2Precursor where
298305 parseJSON (Object v) = D2Precursor <$> v .:? asKey PreambleK <*> v .:? asKey ExecutableK .!= d2Exe defaultConfiguration <*> v .:? asKey CommandLineArgsK .!= d2CmdArgs defaultConfiguration
299306 parseJSON _ = fail $ mconcat [" Could not parse " , show SageMath , " configuration." ]
300307
308+ instance FromJSON AsyPrecursor where
309+ parseJSON (Object v) = AsyPrecursor <$> v .:? asKey PreambleK <*> v .:? asKey ExecutableK .!= asyExe defaultConfiguration <*> v .:? asKey CommandLineArgsK .!= asyCmdArgs defaultConfiguration
310+ parseJSON _ = fail $ mconcat [" Could not parse " , show Asymptote , " configuration." ]
311+
301312toolkitAsKey :: Toolkit -> Key
302313toolkitAsKey = fromString . unpack . cls
303314
@@ -328,6 +339,7 @@ instance FromJSON ConfigPrecursor where
328339 _plantumlPrec <- v .:? toolkitAsKey PlantUML .!= _plantumlPrec defaultConfigPrecursor
329340 _sagemathPrec <- v .:? toolkitAsKey SageMath .!= _sagemathPrec defaultConfigPrecursor
330341 _d2Prec <- v .:? toolkitAsKey D2 .!= _d2Prec defaultConfigPrecursor
342+ _asyPrec <- v .:? toolkitAsKey Asymptote .!= _asyPrec defaultConfigPrecursor
331343
332344 return $ ConfigPrecursor {.. }
333345 parseJSON _ = fail " Could not parse configuration."
@@ -363,6 +375,7 @@ renderConfig ConfigPrecursor {..} = do
363375 plantumlExe = _plantumlExe _plantumlPrec
364376 sagemathExe = _sagemathExe _sagemathPrec
365377 d2Exe = _d2Exe _d2Prec
378+ asyExe = _asyExe _asyPrec
366379
367380 matplotlibCmdArgs = _matplotlibCmdArgs _matplotlibPrec
368381 matlabCmdArgs = _matlabCmdArgs _matlabPrec
@@ -378,6 +391,7 @@ renderConfig ConfigPrecursor {..} = do
378391 plantumlCmdArgs = _plantumlCmdArgs _plantumlPrec
379392 sagemathCmdArgs = _sagemathCmdArgs _sagemathPrec
380393 d2CmdArgs = _d2CmdArgs _d2Prec
394+ asyCmdArgs = _asyCmdArgs _asyPrec
381395
382396 matplotlibPreamble <- readPreamble (_matplotlibPreamble _matplotlibPrec)
383397 matlabPreamble <- readPreamble (_matlabPreamble _matlabPrec)
@@ -393,6 +407,7 @@ renderConfig ConfigPrecursor {..} = do
393407 plantumlPreamble <- readPreamble (_plantumlPreamble _plantumlPrec)
394408 sagemathPreamble <- readPreamble (_sagemathPreamble _sagemathPrec)
395409 d2Preamble <- readPreamble (_d2Preamble _d2Prec)
410+ asyPreamble <- readPreamble (_asyPreamble _asyPrec)
396411
397412 return Configuration {.. }
398413 where
0 commit comments