summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-04-08 20:31:32 +0000
committeraarne <aarne@chalmers.se>2010-04-08 20:31:32 +0000
commit0138e6bba1d593fcdf5417dc8596c63757585796 (patch)
tree29a1c34b00b4c770ec653e310fd147883afbe798 /src
parente98d1238f4615a14faae6f435527e19d0b8c96f4 (diff)
German phrasebook; ontology document; ignoring single lines in gfdoc
Diffstat (limited to 'src')
-rw-r--r--src/tools/GFDoc.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/tools/GFDoc.hs b/src/tools/GFDoc.hs
index 91410864a..fcd5ae405 100644
--- a/src/tools/GFDoc.hs
+++ b/src/tools/GFDoc.hs
@@ -88,11 +88,10 @@ help = unlines $ [
" -- new paragraph",
" --! new page (in HTML, recognized by the htmls program)",
" --. end of document",
---- " --- ignore this comment line in document",
---- " {---} ignore this code line in document",
" --*[Text] Text paragraph starting with a bullet",
" --[Text] Text belongs to text paragraph",
" [Text] Text belongs to code paragraph",
+ " --% (in the end of a line): ignore this line",
"",
"Within a text paragraph, text enclosed between certain characters",
"is treated specially:",
@@ -143,7 +142,7 @@ pDoc time s = case dropWhile emptyOrPragma (lines s) of
paras -> Doc [] time (map pPara (grp paras))
where
grp ss = case ss of
- s : rest --- | ignore s -> grp rest
+ s : rest | ignore s -> grp rest
| isEnd s -> []
| begComment s -> let (s1,s2) = getComment (drop 2 s : rest)
in map ("-- " ++) s1 ++ grp s2
@@ -169,17 +168,16 @@ pDoc time s = case dropWhile emptyOrPragma (lines s) of
get k con isEnd cs = con beg : pItems (drop k rest)
where (beg,rest) = span (not . isEnd) cs
- ignore s = case s of
- '-':'-':'-':_ -> True
- '{':'-':'-':'-':'}':_ -> True
- _ -> False
-
isEnd s = case s of
'-':'-':'.':_ -> True
_ -> False
emptyOrPragma s = all isSpace s || "--#" `isPrefixOf` s
+ignore s = case reverse s of
+ '%':'-':'-':_ -> True
+ _ -> False
+
-- render in html
doc2html :: Doc -> String
@@ -196,7 +194,7 @@ para2html :: Paragraph -> String
para2html p = case p of
Text its -> concat (map item2html its)
Item its -> mkTagXML "li" ++ concat (map item2html its)
- Code s -> unlines $ tagXML "pre" $ map (indent 2) $
+ Code s -> unlines $ tagXML "pre" $ map (indent 2) $ filter (not . ignore) $
remEmptyLines $ lines $ spec s
New -> mkTagXML "p"
NewPage -> mkTagXML "p" ++ "\n" ++ mkTagXML "!-- NEW --"