-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from mgajda/michal/asymptote-support
Support Asymptote diagrams
- Loading branch information
Showing
14 changed files
with
213 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ test-show-details: streaming | |
|
||
jobs: $ncpus | ||
|
||
allow-newer: haddock-library:base, | ||
allow-newer: haddock-library:base, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
-- | | ||
-- Module : $header$ | ||
-- Copyright : (c) Laurent P René de Cotret, 2019 - present | ||
-- License : GNU GPL, version 2 or above | ||
-- Maintainer : [email protected] | ||
-- Stability : internal | ||
-- Portability : portable | ||
-- | ||
-- Rendering Asymptote plots code blocks | ||
module Text.Pandoc.Filter.Plot.Renderers.Asymptote | ||
( asymptote, | ||
asymptoteSupportedSaveFormats, | ||
) | ||
where | ||
|
||
import Text.Pandoc.Filter.Plot.Renderers.Prelude | ||
import Data.Char(toLower) | ||
|
||
asymptote :: PlotM Renderer | ||
asymptote = do | ||
cmdargs <- asksConfig asyCmdArgs | ||
return | ||
$ Renderer | ||
{ rendererToolkit = Asymptote, | ||
rendererCapture = asymptoteCapture, | ||
rendererCommand = asymptoteCommand cmdargs, | ||
rendererAvailability = CommandSuccess $ \exe -> [st|#{pathToExe exe} -environment|], | ||
rendererSupportedSaveFormats = asymptoteSupportedSaveFormats, | ||
rendererChecks = mempty, | ||
rendererLanguage = "asy", | ||
rendererComment = mappend "// ", | ||
rendererScriptExtension = ".asy" | ||
} | ||
|
||
asymptoteSupportedSaveFormats :: [SaveFormat] | ||
asymptoteSupportedSaveFormats = [PDF, EPS, PNG] | ||
|
||
asymptoteCommand :: Text -> OutputSpec -> Text | ||
asymptoteCommand cmdArgs OutputSpec {..} = | ||
[st|#{pathToExe oExecutable} #{cmdArgs} -f #{toLower <$> show (saveFormat oFigureSpec)} -o "#{oFigurePath}" "#{oScriptPath}"|] | ||
|
||
-- Asymptote export is entirely based on command-line arguments | ||
-- so there is no need to modify the script itself. | ||
asymptoteCapture :: FigureSpec -> FilePath -> Script | ||
asymptoteCapture FigureSpec {..} _ = script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.