summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2009-06-20 07:02:13 +0000
committeraarne <aarne@chalmers.se>2009-06-20 07:02:13 +0000
commit30f90d707a3fa271bdd468ac7071faa79dd80ce1 (patch)
tree155f5bed21e2ad8634dccada1461769e730ab326 /src/GF
parentc81b1f2ab02b4da42a22dd700b030b7438473b36 (diff)
function for printing the help file in txt2tags
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/Command/Commands.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/GF/Command/Commands.hs b/src/GF/Command/Commands.hs
index 7ea046cbb..a85602b1d 100644
--- a/src/GF/Command/Commands.hs
+++ b/src/GF/Command/Commands.hs
@@ -85,6 +85,27 @@ commandHelp full (co,info) = unlines $ [
"examples:" ++++ unlines [" " ++ s | s <- examples info]
] else []
+-- for printing with txt2tags formatting
+
+commandHelpTags :: Bool -> (String,CommandInfo) -> String
+commandHelpTags full (co,info) = unlines $ [
+ "#VSPACE","","#NOINDENT",
+ lit co ++ " = " ++ lit (longname info) ++ ": " ++
+ "//" ++ synopsis info ++ ".//"] ++ if full then [
+ "","#TINY","",
+ explanation info,
+ "- Syntax: ``" ++ syntax info ++ "``",
+ "- Options:\n" ++++
+ unlines [" | ``-" ++ o ++ "`` | " ++ e | (o,e) <- options info],
+ "- Flags:\n" ++++
+ unlines [" | ``-" ++ o ++ "`` | " ++ e | (o,e) <- flags info],
+ "- Examples:\n```" ++++
+ unlines [" " ++ s | s <- examples info],
+ "```",
+ "", "#NORMAL", ""
+ ] else []
+ where
+ lit s = "``" ++ s ++ "``"
type PGFEnv = (PGF, Map.Map Language Morpho)