diff --git a/doc/synopsis/Makefile b/doc/synopsis/Makefile index 61f9f271c..f7892898f 100644 --- a/doc/synopsis/Makefile +++ b/doc/synopsis/Makefile @@ -11,7 +11,7 @@ S=$(ROOT)/src CONFIG=$(ROOT)/languages.csv # List of languages extracted from languages.csv, with 'Synopsis' column == y -LANGS=$(shell cat $(CONFIG) | cut -d',' -f1,10 | grep ',y' | cut -d',' -f1) +LANGS=$(shell cat $(CONFIG) | cut -d',' -f1,11 | grep ',y' | cut -d',' -f1) # This list was constructed by observing what files MkSynopsis.hs reads SRC_FILES=$(S)/abstract/Common.gf $(S)/abstract/Cat.gf $(S)/api/Constructors.gf $(S)/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) diff --git a/doc/synopsis/MkSynopsis.hs b/doc/synopsis/MkSynopsis.hs index e20a6ebb0..4b2c9a29a 100644 --- a/doc/synopsis/MkSynopsis.hs +++ b/doc/synopsis/MkSynopsis.hs @@ -1,6 +1,5 @@ import MkExxTable import System.Process(system) -import System.Environment(getArgs) import System.FilePath((),(<.>)) import Data.Char import Data.List @@ -24,19 +23,10 @@ configFile = ".." ".." Config.configFile revealedLang :: String revealedLang = "Eng" --- all languages shown (a copy of this list appears in Makefile) -apiExxFiles :: IO [FilePath] -apiExxFiles = do - langs <- loadLangsFrom configFile - return $ - [ "api-examples-" ++ (langCode lang) ++ ".txt" - | lang <- langs - , langSynopsis lang - ] - -- | This function puts together a txt2tags file which is then converted to HTML by the Makefile main :: IO () main = do + langs <- loadLangsFrom configFile >>= return . filter langSynopsis cs1 <- getCats commonAPI cs2 <- getCats catAPI let cs = sortCats (cs1 ++ cs2) @@ -50,8 +40,10 @@ main = do append "%!postproc(html): '#EUL' ''" append "%!postproc(html): '#LI' '
  • '" append "%!postproc(html): '#LParadigms' ''" + append ("%!postproc(html): '#LANGUAGE_COUNT' '" ++ show (length langs) ++ "'") + append ("%!postproc(html): '#LANGUAGES' '" ++ intercalate ", " (map langName langs) ++ ".'") delimit $ addToolTips cs - include "intro.txt" -- TODO dynamic language list + include "intro.txt" space title "Categories" space @@ -72,7 +64,7 @@ main = do space link "Source 2:" structuralAPI space - apiExx <- apiExxFiles >>= getApiExx + apiExx <- getApiExx (apiExxFiles langs) rs <- getRules apiExx syntaxAPI rs2 <- getRules apiExx structuralAPI let rss = rs ++ rs2 @@ -87,7 +79,7 @@ main = do space title "Lexical Paradigms" append "#LParadigms" - paradigmFiles >>= mapM_ (putParadigms cs) + mapM_ (putParadigms cs) (paradigmFiles langs) space include "additional.txt" space @@ -242,20 +234,18 @@ catAPI = srcPath "abstract/Cat.gf" syntaxAPI = srcPath "api/Constructors.gf" structuralAPI = srcPath "abstract/Structural.gf" -paradigmFiles :: IO [(String,FilePath)] -paradigmFiles = do - langs <- loadLangsFrom configFile - return $ - [ (name, srcPath $ printf "%s/Paradigms%s.gf" (langDir lang) (langCode lang)) - | lang <- langs - , langSynopsis lang - , let name = formatName (langDir lang) - ] +-- all languages shown (a copy of this list appears in Makefile) +apiExxFiles :: [LangInfo] -> [FilePath] +apiExxFiles langs = + [ "api-examples-" ++ (langCode lang) ++ ".txt" + | lang <- langs + ] --- | Format language name from directory name --- "ancient_greek -> Ancient Greek" -formatName :: String -> String -formatName = unwords . map (\(s:ss) -> toUpper s : ss) . splitOn (=='_') +paradigmFiles :: [LangInfo] -> [(String,FilePath)] +paradigmFiles langs = + [ (langName lang, srcPath $ printf "%s/Paradigms%s.gf" (langDir lang) (langCode lang)) + | lang <- langs + ] -- | Split a string at given character, similar to words splitOn :: (Char -> Bool) -> String -> [String] diff --git a/doc/synopsis/intro.txt b/doc/synopsis/intro.txt index 1da91288d..fbd7c0915 100644 --- a/doc/synopsis/intro.txt +++ b/doc/synopsis/intro.txt @@ -3,41 +3,8 @@ =Introduction= The GF Resource Grammar Library is the standard library for Grammatical Framework. -It covers the morphology and basic syntax of currently 34 languages: -Afrikaans, -Arabic, -Bulgarian, -Catalan, -Chinese (simplified), -Danish, -Dutch, -English, -Estonian, -Finnish, -French, -German, -Greek, -Hindi, -Icelandic, -Japanese, -Italian, -Latvian, -Maltese, -Mongolian, -Nepali, -Norwegian (bokmÃ¥l), -Norwegial (nynorsk), -Persian, -Polish, -Portuguese, -Punjabi, -Romanian, -Russian, -Sindhi, -Spanish, -Swedish, -Thai, -Urdu. +It covers the morphology and basic syntax of currently #LANGUAGE_COUNT languages: +#LANGUAGES This document contains the most important parts of the GF Resource Grammar API, as needed by a GF application programmer.