mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
MkSynopsis script with non-utf8 source files
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import System
|
import System
|
||||||
import Char
|
import Char
|
||||||
import List
|
import List
|
||||||
|
import qualified Data.ByteString.Char8 as BS
|
||||||
|
|
||||||
type Cats = [(String,String,String)]
|
type Cats = [(String,String,String)]
|
||||||
type Rules = [(String,String,String)]
|
type Rules = [(String,String,String)]
|
||||||
@@ -39,6 +40,8 @@ main = do
|
|||||||
link "Source 2:" structuralAPI
|
link "Source 2:" structuralAPI
|
||||||
space
|
space
|
||||||
rs <- getRules syntaxAPI
|
rs <- getRules syntaxAPI
|
||||||
|
--- putStrLn $ unlines ["p -cat=" ++ last (words t) ++
|
||||||
|
--- " \"" ++ e ++ "\"" | (_,t,e) <- rs, not (null e)] ----
|
||||||
rs2 <- getRules structuralAPI
|
rs2 <- getRules structuralAPI
|
||||||
delimit $ mkSplitTables True isLatex cs $ rs ++ rs2
|
delimit $ mkSplitTables True isLatex cs $ rs ++ rs2
|
||||||
space
|
space
|
||||||
@@ -50,7 +53,7 @@ main = do
|
|||||||
-- delimit rs
|
-- delimit rs
|
||||||
space
|
space
|
||||||
title "Lexical Paradigms"
|
title "Lexical Paradigms"
|
||||||
mapM_ (putParadigms isLatex cs) paradigmFiles
|
---- mapM_ (putParadigms isLatex cs) paradigmFiles
|
||||||
space
|
space
|
||||||
include "synopsis-browse.txt"
|
include "synopsis-browse.txt"
|
||||||
space
|
space
|
||||||
@@ -89,7 +92,7 @@ rulesTable hasEx isLatex cs file = do
|
|||||||
|
|
||||||
getRules :: FilePath -> IO Rules
|
getRules :: FilePath -> IO Rules
|
||||||
getRules file = do
|
getRules file = do
|
||||||
ss <- readFile file >>= return . lines
|
ss <- readFileC file >>= return . lines
|
||||||
return $ getrs [] ss
|
return $ getrs [] ss
|
||||||
where
|
where
|
||||||
getrs rs ss = case ss of
|
getrs rs ss = case ss of
|
||||||
@@ -244,3 +247,9 @@ showTyp cs = unwords . map f . words
|
|||||||
isCat cat = cat `notElem` ["Str","Int"]
|
isCat cat = cat `notElem` ["Str","Int"]
|
||||||
&& all (\c -> isAlphaNum c || c == '\'') cat
|
&& all (\c -> isAlphaNum c || c == '\'') cat
|
||||||
&& isUpper (head cat)
|
&& isUpper (head cat)
|
||||||
|
|
||||||
|
-- to work around GHC 6.12 file input
|
||||||
|
readFileC file = do
|
||||||
|
let tmp = file ++ ".tmp"
|
||||||
|
system $ "iconv -f ISO-8859-1 -t UTF-8 " ++ file ++ " >" ++ tmp
|
||||||
|
readFile tmp
|
||||||
|
|||||||
Reference in New Issue
Block a user