forked from GitHub/gf-core
PGF Service, command=grammar: include the last modified time of the grammar in the output
This commit is contained in:
@@ -12,9 +12,10 @@ import URLEncoding
|
|||||||
|
|
||||||
#if C_RUNTIME
|
#if C_RUNTIME
|
||||||
import qualified PGF2 as C
|
import qualified PGF2 as C
|
||||||
--import Data.Time.Clock(UTCTime,getCurrentTime,diffUTCTime)
|
--import Data.Time.Clock(getCurrentTime,diffUTCTime)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
import Data.Time.Clock(UTCTime)
|
||||||
import Data.Time.Format(formatTime)
|
import Data.Time.Format(formatTime)
|
||||||
import System.Locale(defaultTimeLocale,rfc822DateFormat)
|
import System.Locale(defaultTimeLocale,rfc822DateFormat)
|
||||||
import Network.CGI
|
import Network.CGI
|
||||||
@@ -115,6 +116,7 @@ cpgfMain command (t,(pgf,pc)) =
|
|||||||
|
|
||||||
grammar = showJSON $ makeObj
|
grammar = showJSON $ makeObj
|
||||||
["name".=C.abstractName pgf,
|
["name".=C.abstractName pgf,
|
||||||
|
"lastmodified".=show t,
|
||||||
"startcat".=C.startCat pgf,
|
"startcat".=C.startCat pgf,
|
||||||
"languages".=languages]
|
"languages".=languages]
|
||||||
where
|
where
|
||||||
@@ -311,7 +313,7 @@ pgfMain command (t,pgf) =
|
|||||||
"translate" -> o =<< doTranslate pgf # input % cat % to % limit %trie
|
"translate" -> o =<< doTranslate pgf # input % cat % to % limit %trie
|
||||||
"translategroup" -> o =<< doTranslateGroup pgf # input % cat % to % limit
|
"translategroup" -> o =<< doTranslateGroup pgf # input % cat % to % limit
|
||||||
"lookupmorpho" -> o =<< doLookupMorpho pgf # from1 % textInput
|
"lookupmorpho" -> o =<< doLookupMorpho pgf # from1 % textInput
|
||||||
"grammar" -> o =<< doGrammar pgf # requestAcceptLanguage
|
"grammar" -> o =<< doGrammar t pgf # requestAcceptLanguage
|
||||||
"abstrtree" -> outputGraphviz =<< abstrTree pgf # graphvizOptions % tree
|
"abstrtree" -> outputGraphviz =<< abstrTree pgf # graphvizOptions % tree
|
||||||
"alignment" -> outputGraphviz =<< alignment pgf # tree % to
|
"alignment" -> outputGraphviz =<< alignment pgf # tree % to
|
||||||
"parsetree" -> outputGraphviz =<< parseTree pgf # from1 % graphvizOptions % tree
|
"parsetree" -> outputGraphviz =<< parseTree pgf # from1 % graphvizOptions % tree
|
||||||
@@ -620,9 +622,10 @@ doGenerate pgf mcat mdepth mlimit (tos,unlex) =
|
|||||||
limit = take (fromMaybe 1 mlimit)
|
limit = take (fromMaybe 1 mlimit)
|
||||||
depth = fromMaybe 4 mdepth
|
depth = fromMaybe 4 mdepth
|
||||||
|
|
||||||
doGrammar :: PGF -> Maybe (Accept Language) -> JSValue
|
doGrammar :: UTCTime -> PGF -> Maybe (Accept Language) -> JSValue
|
||||||
doGrammar pgf macc = showJSON $ makeObj
|
doGrammar t pgf macc = showJSON $ makeObj
|
||||||
["name".=PGF.abstractName pgf,
|
["name".=PGF.abstractName pgf,
|
||||||
|
"lastmodified".=show t,
|
||||||
"userLanguage".=selectLanguage pgf macc,
|
"userLanguage".=selectLanguage pgf macc,
|
||||||
"startcat".=PGF.showType [] (PGF.startCat pgf),
|
"startcat".=PGF.showType [] (PGF.startCat pgf),
|
||||||
"categories".=categories,
|
"categories".=categories,
|
||||||
|
|||||||
Reference in New Issue
Block a user