Skip to content
This repository
Newer
Older
100644 45 lines (38 sloc) 1.586 kb
183ddf23 »
2012-03-16 Document generation! Properly implemented instead of hacky script!
1 -- Implicit CAD. Copyright (C) 2011, Christopher Olah (chris@colah.ca)
2 -- Released under the GNU GPL, see LICENSE
3
4 {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, FlexibleContexts, TypeSynonymInstances, UndecidableInstances, ScopedTypeVariables #-}
5
6 import Graphics.Implicit.ExtOpenScad.Primitives (primitives)
7 import Graphics.Implicit.ExtOpenScad.Util.ArgParser
8
9 import Control.Monad
10
11 isExample (ExampleDoc _ ) = True
12 isExample _ = False
13
14 isArgument (ArgumentDoc _ _ _) = True
15 isArgument _ = False
16
17 main = do
18 let names = map fst primitives
19 docs <- sequence $ map (getArgParserDocs.($ []).snd) primitives
20
21 forM_ (zip names docs) $ \(moduleName, moduleDocList) -> do
22 let
23 examples = filter isExample moduleDocList
24 arguments = filter isArgument moduleDocList
25 putStrLn moduleName
ab6f143e »
2012-07-17 move documentation to markdown.
26 putStrLn (map (const '-') moduleName)
27 putStrLn ""
28 if not $ null examples then putStrLn "**Examples:**\n" else return ()
29 forM_ examples $ \(ExampleDoc example) -> do
30 putStrLn $ " * `" ++ example ++ "`"
31 putStrLn ""
32 putStrLn "**Arguments:**\n"
183ddf23 »
2012-03-16 Document generation! Properly implemented instead of hacky script!
33 forM_ arguments $ \(ArgumentDoc name posfallback description) ->
34 case (posfallback, description) of
35 (Nothing, "") -> do
ab6f143e »
2012-07-17 move documentation to markdown.
36 putStrLn $ " * `" ++ name ++ "`"
183ddf23 »
2012-03-16 Document generation! Properly implemented instead of hacky script!
37 (Just fallback, "") -> do
ab6f143e »
2012-07-17 move documentation to markdown.
38 putStrLn $ " * `" ++ name ++ " = " ++ fallback ++ "`"
183ddf23 »
2012-03-16 Document generation! Properly implemented instead of hacky script!
39 (Nothing, _) -> do
ab6f143e »
2012-07-17 move documentation to markdown.
40 putStrLn $ " * `" ++ name ++ "`"
41 putStrLn $ " " ++ description
183ddf23 »
2012-03-16 Document generation! Properly implemented instead of hacky script!
42 (Just fallback, _) -> do
ab6f143e »
2012-07-17 move documentation to markdown.
43 putStrLn $ " * `" ++ name ++ " = " ++ fallback ++ "`"
44 putStrLn $ " " ++ description
183ddf23 »
2012-03-16 Document generation! Properly implemented instead of hacky script!
45 putStrLn ""
46
Something went wrong with that request. Please try again.