summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <unknown>2004-06-22 14:54:05 +0000
committeraarne <unknown>2004-06-22 14:54:05 +0000
commit0b55c09abbac9ce56bc7ca1bc03e9ca3dd74d6a4 (patch)
tree0d7a51cb5641dc423dae318a97e8d64f8042aded
parent8a0d51c5f68fa91fa1ac6dd5d1a96980e0880e26 (diff)
make gfdoc
-rw-r--r--src/Makefile2
-rw-r--r--src/tools/GFDoc.hs19
2 files changed, 11 insertions, 10 deletions
diff --git a/src/Makefile b/src/Makefile
index 08917e4e8..640d90500 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -133,3 +133,5 @@ install: install-gf2
$(INSTALL) -d $(libdir)/GF-$(PACKAGE_VERSION)
$(INSTALL) jgf2 $(bindir)
$(INSTALL) java/gf-java.jar $(libdir)/GF-$(PACKAGE_VERSION)
+gfdoc:
+ cd util ; $(GHMAKE) GFDoc.hs -o gfdoc ; cd ..
diff --git a/src/tools/GFDoc.hs b/src/tools/GFDoc.hs
index 0f5143f57..883349748 100644
--- a/src/tools/GFDoc.hs
+++ b/src/tools/GFDoc.hs
@@ -13,22 +13,21 @@ main :: IO ()
main = do
xx <- getArgs
let
- (typ,format,name) = case xx of
- "+latex" : x: [] -> (0,doc2latex,x)
- "+htmls" : x: [] -> (2,doc2html,x)
- x:[] -> (1,doc2html,x)
- _ -> (1,doc2html, "unknown.txt") ---
+ (typ,format,names) = case xx of
+ "-latex" : xs -> (0,doc2latex,xs)
+ "-htmls" : xs -> (2,doc2html,xs)
+ xs -> (1,doc2html,xs)
if null xx
then do
putStrLn welcome
putStrLn help
- else do
+ else flip mapM_ names (\name -> do
ss <- readFile name
let outfile = fileFormat typ name
- writeFile outfile $ format $ pDoc $ ss
+ writeFile outfile $ format $ pDoc $ ss)
if typ == 2
then do
- system $ "htmls " ++ (fileFormat typ name)
+ mapM (\name -> system $ "htmls " ++ (fileFormat typ name)) names
return ()
else return ()
@@ -40,10 +39,10 @@ welcome = unlines [
help = unlines $ [
"",
- "Usage: gfdoc (+latex|+htmls) file",
+ "Usage: gfdoc (-latex|-htmls) <file>+",
"",
"The program operates with lines in GF code, treating them into LaTeX",
- "(flag +latex), to a set of HTML documents (flag +htmls), or to one",
+ "(flag -latex), to a set of HTML documents (flag -htmls), or to one",
"HTML file (by default). The output is written in a file",
"whose name is formed from the input file name by replacing its suffix",
"with html or tex; in case of set of HTML files, the names are prefixed",