mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-14 05:32:51 -06:00
PGF web service: switch to the new SVG rendering of word dependency trees
Also added the function outputText in CGIUtils.
This commit is contained in:
@@ -4,7 +4,7 @@ module CGIUtils (throwCGIError, handleCGIErrors,
|
||||
stderrToFile,logError,
|
||||
outputJSONP,outputEncodedJSONP,
|
||||
outputPNG,outputBinary,outputBinary',
|
||||
outputHTML,outputPlain) where
|
||||
outputHTML,outputPlain,outputText) where
|
||||
|
||||
import Control.Exception(Exception(..),SomeException(..),throw)
|
||||
import Data.Dynamic(Typeable,cast)
|
||||
@@ -73,7 +73,7 @@ outputEncodedJSONP json =
|
||||
Nothing -> ("json",json)
|
||||
Just c -> ("javascript",c ++ "(" ++ json ++ ")")
|
||||
ct = "application/"++ty++"; charset=utf-8"
|
||||
outputStrict ct $ UTF8.encodeString str
|
||||
outputText ct str
|
||||
|
||||
outputPNG :: BS.ByteString -> CGI CGIResult
|
||||
outputPNG = outputBinary' "image/png"
|
||||
@@ -88,10 +88,12 @@ outputBinary' ct x = do
|
||||
outputFPS x
|
||||
|
||||
outputHTML :: String -> CGI CGIResult
|
||||
outputHTML = outputStrict "text/html; charset=utf-8" . UTF8.encodeString
|
||||
outputHTML = outputText "text/html; charset=utf-8"
|
||||
|
||||
outputPlain :: String -> CGI CGIResult
|
||||
outputPlain = outputStrict "text/plain; charset=utf-8" . UTF8.encodeString
|
||||
outputPlain = outputText "text/plain; charset=utf-8"
|
||||
|
||||
outputText ct = outputStrict ct . UTF8.encodeString
|
||||
|
||||
outputStrict :: String -> String -> CGI CGIResult
|
||||
outputStrict ct x | x == x = do setHeader "Content-Type" ct
|
||||
|
||||
Reference in New Issue
Block a user