make gfdoc

This commit is contained in:
aarne
2004-06-22 14:54:05 +00:00
parent 6cb989f467
commit 8725379be3
2 changed files with 11 additions and 10 deletions

View File

@@ -133,3 +133,5 @@ install: install-gf2
$(INSTALL) -d $(libdir)/GF-$(PACKAGE_VERSION) $(INSTALL) -d $(libdir)/GF-$(PACKAGE_VERSION)
$(INSTALL) jgf2 $(bindir) $(INSTALL) jgf2 $(bindir)
$(INSTALL) java/gf-java.jar $(libdir)/GF-$(PACKAGE_VERSION) $(INSTALL) java/gf-java.jar $(libdir)/GF-$(PACKAGE_VERSION)
gfdoc:
cd util ; $(GHMAKE) GFDoc.hs -o gfdoc ; cd ..

View File

@@ -13,22 +13,21 @@ main :: IO ()
main = do main = do
xx <- getArgs xx <- getArgs
let let
(typ,format,name) = case xx of (typ,format,names) = case xx of
"+latex" : x: [] -> (0,doc2latex,x) "-latex" : xs -> (0,doc2latex,xs)
"+htmls" : x: [] -> (2,doc2html,x) "-htmls" : xs -> (2,doc2html,xs)
x:[] -> (1,doc2html,x) xs -> (1,doc2html,xs)
_ -> (1,doc2html, "unknown.txt") ---
if null xx if null xx
then do then do
putStrLn welcome putStrLn welcome
putStrLn help putStrLn help
else do else flip mapM_ names (\name -> do
ss <- readFile name ss <- readFile name
let outfile = fileFormat typ name let outfile = fileFormat typ name
writeFile outfile $ format $ pDoc $ ss writeFile outfile $ format $ pDoc $ ss)
if typ == 2 if typ == 2
then do then do
system $ "htmls " ++ (fileFormat typ name) mapM (\name -> system $ "htmls " ++ (fileFormat typ name)) names
return () return ()
else return () else return ()
@@ -40,10 +39,10 @@ welcome = unlines [
help = 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", "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", "HTML file (by default). The output is written in a file",
"whose name is formed from the input file name by replacing its suffix", "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", "with html or tex; in case of set of HTML files, the names are prefixed",