From a59821eb803886e9b29b9aac43ee9eeacdc02b93 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 8 Jun 2016 19:10:23 +0000 Subject: PGF web service: switch to the new SVG rendering of word dependency trees Also added the function outputText in CGIUtils. --- src/server/PGFService.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/server/PGFService.hs') diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs index 5e673ca75..44f0b7e14 100644 --- a/src/server/PGFService.hs +++ b/src/server/PGFService.hs @@ -7,8 +7,9 @@ import PGF (PGF) import qualified PGF import PGF.Lexing import Cache -import CGIUtils(outputJSONP,outputPlain,outputHTML,logError,outputBinary, - outputBinary',handleCGIErrors,throwCGIError,stderrToFile) +import CGIUtils(outputJSONP,outputPlain,outputHTML,outputText, + outputBinary,outputBinary', + logError,handleCGIErrors,throwCGIError,stderrToFile) import CGI(CGI,readInput,getInput,getVarWithDefault, CGIResult,requestAcceptLanguage,handleErrors,setHeader, Accept(..),Language(..),negotiate,liftIO) @@ -777,9 +778,11 @@ parseTree pgf lang opts tree = PGF.graphvizParseTree pgf lang opts tree doDepTree path pgf fmt lang tree = do lbls <- either (const Nothing) Just # liftIO (tryIOError readDepLabels) let vis = PGF.graphvizDependencyTree fmt False lbls Nothing pgf lang tree - if fmt `elem` ["png","gif","svg","gv"] + if fmt `elem` ["png","gif","gv"] then outputGraphviz vis - else outputPlain vis + else if fmt=="svg" + then outputText "image/svg+xml" vis + else outputPlain vis where labelsPath = dropExtension path <.> "labels" readDepLabels = PGF.getDepLabels . lines # readFile labelsPath -- cgit v1.2.3