diff --git a/lib/resource-1.0/api/examples/Makefile b/lib/resource-1.0/api/examples/Makefile index d04276a13..b786d8954 100644 --- a/lib/resource-1.0/api/examples/Makefile +++ b/lib/resource-1.0/api/examples/Makefile @@ -1,9 +1,14 @@ -Eng: - gf -nocpu ExxEng.gf exxEng.txt -Fin: - gf -nocpu ExxFin.gf exxFin.txt -Swe: - gf -nocpu ExxSwe.gf exxSwe.txt +all: html gfs exx links + +links: + runghc MkLinks gfs: runghc mkgfs.hs + +exx: + gf ExxSwe.gf ExGer.gf ExFre.gf ExFin.gf ExxEng.gf >= (mapM_ mkLink . lines) + +mkLink line = case break (=="--") (words (takeWhile (/='#')line)) of + (fun : ":" : typ, _ : num : ex) -> + appendFile tgt ("\n" ++ takeInit line ++ " " ++ link ex typ num) + _ -> appendFile tgt ("\n" ++ line) + where + takeInit line = init (init (takeWhile (/='.') line)) + link ex typ num = + "" ++ unwords ex ++ "" + example typ num = case reverse typ of + ";":val:_ -> "ex" ++ init num ++ "_" ++ val + val:_ -> "ex" ++ init num ++ "_" ++ val diff --git a/lib/resource-1.0/api/examples/mkgfs.hs b/lib/resource-1.0/api/examples/mkgfs.hs index 06434a360..2c8208030 100644 --- a/lib/resource-1.0/api/examples/mkgfs.hs +++ b/lib/resource-1.0/api/examples/mkgfs.hs @@ -4,6 +4,7 @@ main = mkgfs src = "ExxI.gf" script = "exx.gfs" +linkfile ex = "links/" ++ ex ++ ".txt" mkgfs = do writeFile script "" @@ -11,7 +12,11 @@ mkgfs = do addLin s = case words s of - c@('e':'x':_):_ -> appendFile script ("l " ++ cc ++ "\n") where + c@('e':'x':_):"=":def -> do + appendFile script ("ps \"" ++ unwords (init def) ++ "\\n\\n\" | wf " ++ linkfile c ++ "\n") + appendFile script ("l -multi " ++ cc ++ " | af " ++ linkfile c ++ "\n") + + where cc = case take 2 (reverse c) of "PV" -> "utt " ++ c _ -> c