packages feed

claferwiki 0.3.9 → 0.3.10

raw patch · 5 files changed

+172/−165 lines, 5 filesdep ~claferdep ~gitit

Dependency ranges changed: clafer, gitit

Files

CHANGES.md view
@@ -1,3 +1,7 @@+**ClaferIG Version 0.3.10 released on April 24, 2015**
+
+[Release](https://github.com/gsdlab/claferwiki/pull/10)
+
 **ClaferIG Version 0.3.9 released on March 06, 2015**
 
 [Release](https://github.com/gsdlab/claferwiki/pull/9)
README.md view
@@ -1,11 +1,11 @@ Clafer Wiki
 ===========
 
-v0.3.9
+v0.3.10
 
-**ClaferWiki** is a wiki system integrated with [Clafer compiler](https://github.com/gsdlab/clafer). [Clafer](http://clafer.org) is a lightweight yet powerful structural modeling language. ClaferWiki allows for embedding Clafer model fragments in wiki pages and provides model authoring support including code highlighting, parse and semantic error reporting, hyperlinking from identifier use to its definition, and graphical view rendering. 
+**ClaferWiki** is a wiki system integrated with [Clafer compiler](https://github.com/gsdlab/clafer). [Clafer](http://clafer.org) is a lightweight yet powerful structural modeling language. ClaferWiki allows for embedding Clafer model fragments in wiki pages and provides model authoring support including code highlighting, parse and semantic error reporting, hyperlinking from identifier use to its definition, and graphical view rendering.
 
-ClaferWiki supports informal-to-formal modeling, that is, gradually refining parts of specification in natural language into a Clafer model fragments. ClaferWiki supports *literate modeling* - both the rich text and the model fragments can be freely mixed. Informal-to-formal modeling is important during domain modeling. 
+ClaferWiki supports informal-to-formal modeling, that is, gradually refining parts of specification in natural language into a Clafer model fragments. ClaferWiki supports *literate modeling* - both the rich text and the model fragments can be freely mixed. Informal-to-formal modeling is important during domain modeling.
 
 Also, ClaferWiki acts as a collaborative, lightweight, web-based integrated development environment (IDE) for Clafer. In addition to code highlighting, error reporting, hyperlinking, and graphical view rendering, it also provides model versioning and distributed online/offline editing capabilities as it is based on the Git distributed version control system and the [Gitit wiki](http://gitit.net/).
 
@@ -31,16 +31,16 @@ 
 Regardless of the installation method, the following are required:
 
-* [Clafer compiler](https://github.com/gsdlab/clafer/) v0.3.9.
+* [Clafer compiler](https://github.com/gsdlab/clafer/) v0.3.10.
 * [The Haskell Platform](http://hackage.haskell.org/platform) v2014.2.0.0.
-* [Git](http://git-scm.com) 
-* [Gitit wiki](http://gitit.net) v0.10.6.1.
-  
+* [Git](http://git-scm.com)
+* [Gitit wiki](http://gitit.net) v0.10.6.2.
+
 ### Installation from Hackage
 
 1. `cabal update`
-2. `cabal install claferwiki`
-3. `cd <cabal's lib or share folder>`  (`C:\Users\<user>\AppData\Roaming\cabal\i386-windows-ghc-7.8.3\claferwiki-0.3.9` on Windows or `.cabal/share/x86_64-linux-ghc-7.8.3/claferwiki-0.3.9/` on Linux)
+2. `cabal install claferwiki-0.3.10 -fhighlighting -fhttps -fplugins -fnetwork-uri`
+3. `cd <cabal's lib or share folder>`  (`C:\Users\<user>\AppData\Roaming\cabal\i386-windows-ghc-7.8.3\claferwiki-0.3.10` on Windows or `.cabal/share/x86_64-linux-ghc-7.8.3/claferwiki-0.3.10/` on Linux)
   * execute `make install to=<target directory>`
   * this will copy the wiki files
 
@@ -57,8 +57,8 @@ 
 ### Important: Branches must correspond
 
-All related projects are following the *simultaneous release model*. 
-The branch `master` contains releases, whereas the branch `develop` contains code under development. 
+All related projects are following the *simultaneous release model*.
+The branch `master` contains releases, whereas the branch `develop` contains code under development.
 When building the tools, the branches should match.
 Releases from branches 'master` are guaranteed to work well together.
 Development versions from branches `develop` should work well together but this might not always be the case.
@@ -78,8 +78,8 @@ Update
 ------
 
-* in the `<source directory>` execute `git pull` 
-* execute `make update to=<target directory>` 
+* in the `<source directory>` execute `git pull`
+* execute `make update to=<target directory>`
   * this will keep the directory structure and your existing git repository with the wiki contents
 
 Features
claferwiki.cabal view
@@ -1,5 +1,5 @@ Name:                   claferwiki
-version:                0.3.9
+version:                0.3.10
 stability:              experimental
 author:                 Michał Antkiewicz, Chris Walker, Luke Michael Brown
 maintainer:             Michał Antkiewicz <mantkiew@gsd.uwaterloo.ca>
@@ -13,6 +13,7 @@ license:                MIT
 license-file:           LICENSE
 tested-with:            GHC == 7.8.3
+                      , GHC == 7.10.1
 data-files:             claferwiki.sh
                       , gitit.cnf
                       , Makefile
@@ -43,9 +44,9 @@                       , network-uri >= 2.6
                       , SHA >= 1.6.4
                       , utf8-string >= 0.3.8
-                      , gitit >= 0.10.6.1
+                      , gitit >= 0.10.6.2
 
-                      , clafer == 0.3.9
+                      , clafer == 0.3.10
   hs-source-dirs:       src
-  ghc-options:          -Wall -fno-warn-unused-do-bind -fno-warn-orphans
+  ghc-options:          -Wall -fno-warn-orphans
   exposed-modules:      Network.Gitit.Plugin.ClaferWiki
claferwiki.sh view
@@ -1,9 +1,9 @@ echo "-----------------------------------------"
-echo "| ClaferWiki v0.3.9                     |"
+echo "| ClaferWiki v0.3.10                    |"
 echo "| https://github.com/gsdlab/claferwiki/ |"
 echo "| By Michal Antkiewicz, Chris Walker    |"
 echo "| Generative Software Development Lab   |"
-echo "| Using `clafer -V`                    |"
+echo "| Using `clafer -V`                   |"
 echo "-----------------------------------------"
 echo ""
 echo "Starting gitit..."
src/Network/Gitit/Plugin/ClaferWiki.hs view
@@ -44,6 +44,8 @@ import Language.Clafer.Css as Css
 import Language.Clafer.Generator.Html (highlightErrors)
 
+import Prelude
+
 -- | claferWiki collects Clafer code from .clafer code blocks, renders as HTML and graph,
 --   and replaces the original blocks with RawBlocks containing the results
 plugin :: Plugin
@@ -51,187 +53,187 @@ 
 claferWiki :: Pandoc -> PluginM Pandoc
 claferWiki pandoc = do
-	-- make sure the directories and clafer.css exist
-	liftIO $ do
-		createDirectoryIfMissing True "static/clafer/"
-		createDirectoryIfMissing True "static/css/"
-		cssExist <- doesFileExist "static/css/clafer.css"
-		unless cssExist $ writeFile "static/css/clafer.css" css
+    -- make sure the directories and clafer.css exist
+    liftIO $ do
+        createDirectoryIfMissing True "static/clafer/"
+        createDirectoryIfMissing True "static/css/"
+        cssExist <- doesFileExist "static/css/clafer.css"
+        unless cssExist $ writeFile "static/css/clafer.css" css
 
-	serverURL <- liftIO $ getHostName
-	pageName <- getPageName
-	config <- askConfig
+    serverURL <- liftIO $ getHostName
+    pageName <- getPageName
+    config <- askConfig
 
-	let
-		serverPort = show $ portNumber config
-		-- produce the required outputs in a single compilation
-		allCompilationResults = compileFragments fragments claferModes
+    let
+        serverPort = show $ portNumber config
+        -- produce the required outputs in a single compilation
+        allCompilationResults = compileFragments fragments claferModes
 
-		htmlCode = extractOutput allCompilationResults Html
-		htmlCodeFragments = splitOn "\n<!-- # FRAGMENT /-->\n" htmlCode
+        htmlCode = extractOutput allCompilationResults Html
+        htmlCodeFragments = splitOn "\n<!-- # FRAGMENT /-->\n" htmlCode
 
-		stats = maybe "No model." statistics $ extractCompilerResult allCompilationResults Html
+        stats = maybe "No model." statistics $ extractCompilerResult allCompilationResults Html
 
-		dotGraph = maybe "" outputCode $ extractCompilerResult allCompilationResults Graph
+        dotGraph = maybe "" outputCode $ extractCompilerResult allCompilationResults Graph
 
-		dotCVLGraph = maybe "" outputCode $ extractCompilerResult allCompilationResults CVLGraph
+        dotCVLGraph = maybe "" outputCode $ extractCompilerResult allCompilationResults CVLGraph
 
-	-- render the graphs to SVG using dot
-	(_, svgGraphWithoutRefs, _) <- liftIO $ readProcessWithExitCode "dot" [ "-Tsvg" ] dotGraph
-	(_, svgGraphWithRefs, _) <- liftIO $ readProcessWithExitCode "dot" [ "-Tsvg" ] $ changeTransparentToLightGray dotGraph
-	(_, svgCVLGraph, _) <- liftIO $ readProcessWithExitCode "dot" [ "-Tsvg" ] dotCVLGraph
+    -- render the graphs to SVG using dot
+    (_, svgGraphWithoutRefs, _) <- liftIO $ readProcessWithExitCode "dot" [ "-Tsvg" ] dotGraph
+    (_, svgGraphWithRefs, _) <- liftIO $ readProcessWithExitCode "dot" [ "-Tsvg" ] $ changeTransparentToLightGray dotGraph
+    (_, svgCVLGraph, _) <- liftIO $ readProcessWithExitCode "dot" [ "-Tsvg" ] dotCVLGraph
 
-		-- using the WikiEnv as state, replace clafer code blocks with appropriate results:
-		-- html rendering of clafer code, graph rendering, download links, ide, configurator, and visualizer buttons
-	let
-		initialWikiEnv = WikiEnv {
-							we_fileName = pageName,
-							we_serverURL = serverURL,
-							we_serverPort = serverPort,
-							we_htmlCodeFragments = htmlCodeFragments,
-							we_stats = stats,
-							we_graphNo = 0,		-- needed to construct unique IDs of <div> for graphs
-							we_svgGraphWithRefs = svgGraphWithRefs,
-							we_svgGraphWithoutRefs = svgGraphWithoutRefs,
-							we_svgCVLGraph = svgCVLGraph
-						 }
-		newPandoc = evalState (bottomUpM replaceClaferWikiBlocks pandoc) initialWikiEnv
+        -- using the WikiEnv as state, replace clafer code blocks with appropriate results:
+        -- html rendering of clafer code, graph rendering, download links, ide, configurator, and visualizer buttons
+    let
+        initialWikiEnv = WikiEnv {
+                            we_fileName = pageName,
+                            we_serverURL = serverURL,
+                            we_serverPort = serverPort,
+                            we_htmlCodeFragments = htmlCodeFragments,
+                            we_stats = stats,
+                            we_graphNo = 0,     -- needed to construct unique IDs of <div> for graphs
+                            we_svgGraphWithRefs = svgGraphWithRefs,
+                            we_svgGraphWithoutRefs = svgGraphWithoutRefs,
+                            we_svgCVLGraph = svgCVLGraph
+                         }
+        newPandoc = evalState (bottomUpM replaceClaferWikiBlocks pandoc) initialWikiEnv
 
-	-- save original model
-	liftIO $ writeFile ("static/clafer/" ++ pageName ++ ".cfr") completeModel
-	-- save html version
-	liftIO $ writeFile ("static/clafer/" ++ pageName ++ ".html") $ selfContained htmlCode
+    -- save original model
+    liftIO $ writeFile ("static/clafer/" ++ pageName ++ ".cfr") completeModel
+    -- save html version
+    liftIO $ writeFile ("static/clafer/" ++ pageName ++ ".html") $ selfContained htmlCode
 
-	return $ newPandoc
-	where
-		-- collect clafer model fragments
-		fragments :: [ String ]
-		fragments = queryWith addFragment pandoc
+    return $ newPandoc
+    where
+        -- collect clafer model fragments
+        fragments :: [ String ]
+        fragments = queryWith addFragment pandoc
 
-		-- collects compiler modes depending on the kinds of blocks on the page
-		claferModes :: [ ClaferMode ]
-		claferModes = nub $ queryWith addMode pandoc
+        -- collects compiler modes depending on the kinds of blocks on the page
+        claferModes :: [ ClaferMode ]
+        claferModes = nub $ queryWith addMode pandoc
 
-		fragmentedModel = intercalate "//# FRAGMENT\n" fragments
-		completeModel = intercalate "\n" fragments
+        fragmentedModel = intercalate "//# FRAGMENT\n" fragments
+        completeModel = intercalate "\n" fragments
 
-		addFragment :: Block -> [String]
-		addFragment (CodeBlock (_, [ "clafer" ], _) code) = [ code ++ "\n" ]
-		addFragment _                                     = []
+        addFragment :: Block -> [String]
+        addFragment (CodeBlock (_, [ "clafer" ], _) code) = [ code ++ "\n" ]
+        addFragment _                                     = []
 
-		addMode :: Block -> [ClaferMode]
-		addMode (CodeBlock (_, [ "clafer" ], _) _)				= [Html]
-		addMode (CodeBlock (_, [ "clafer", "graph" ], _) _)		= [Graph]
-		addMode (CodeBlock (_, [ "clafer", "summary" ], _) _)	= [Graph]
-		addMode (CodeBlock (_, [ "clafer", "cvlGraph" ], _) _)	= [CVLGraph]
-		addMode (CodeBlock (_, [ "clafer", "cvlgraph" ], _) _)	= [CVLGraph]
-		addMode _ 												= []
+        addMode :: Block -> [ClaferMode]
+        addMode (CodeBlock (_, [ "clafer" ], _) _)              = [Html]
+        addMode (CodeBlock (_, [ "clafer", "graph" ], _) _)     = [Graph]
+        addMode (CodeBlock (_, [ "clafer", "summary" ], _) _)   = [Graph]
+        addMode (CodeBlock (_, [ "clafer", "cvlGraph" ], _) _)  = [CVLGraph]
+        addMode (CodeBlock (_, [ "clafer", "cvlgraph" ], _) _)  = [CVLGraph]
+        addMode _                                               = []
 
-		extractCompilerResult :: Either [ClaferErr] (Map.Map ClaferMode CompilerResult) -> ClaferMode -> Maybe CompilerResult
-		extractCompilerResult result claferMode = either (const Nothing) (Map.lookup claferMode) result
+        extractCompilerResult :: Either [ClaferErr] (Map.Map ClaferMode CompilerResult) -> ClaferMode -> Maybe CompilerResult
+        extractCompilerResult result claferMode = either (const Nothing) (Map.lookup claferMode) result
 
-		extractOutput :: Either [ClaferErr] (Map.Map ClaferMode CompilerResult) -> ClaferMode -> String
-		extractOutput (Right compilerResultMap) claferMode =
-			case (Map.lookup claferMode compilerResultMap) of
-				Just CompilerResult{ outputCode } -> outputCode
-				Just NoCompilerResult{ reason } -> "Error: No " ++ show claferMode ++ " output. Reason:" ++ reason
-				Nothing -> "Error: No " ++ show claferMode ++ " output."
-		extractOutput (Left err) _ = highlightErrors fragmentedModel err
+        extractOutput :: Either [ClaferErr] (Map.Map ClaferMode CompilerResult) -> ClaferMode -> String
+        extractOutput (Right compilerResultMap) claferMode =
+            case (Map.lookup claferMode compilerResultMap) of
+                Just CompilerResult{ outputCode } -> outputCode
+                Just NoCompilerResult{ reason } -> "Error: No " ++ show claferMode ++ " output. Reason:" ++ reason
+                Nothing -> "Error: No " ++ show claferMode ++ " output."
+        extractOutput (Left err) _ = highlightErrors fragmentedModel err
 
-		selfContained htmlCode =
-			concat [
-				Css.header,
-				"<style>",
-				Css.css,
-				"</style>",
-				"</head>\n<body>\n",
-				htmlCode,
-				"</body>\n</html>"
-			]
+        selfContained htmlCode =
+            concat [
+                Css.header,
+                "<style>",
+                Css.css,
+                "</style>",
+                "</head>\n<body>\n",
+                htmlCode,
+                "</body>\n</html>"
+            ]
 
 -- | Environment (state) for rewriting the page
 data WikiEnv = WikiEnv {
-					we_fileName :: String,
-					we_serverURL :: String,
-					we_serverPort :: String,
-					-- | code fragments are consumed
-					we_htmlCodeFragments :: [ String ],
-					we_stats :: String,
-					we_graphNo :: Int,
-					we_svgGraphWithRefs :: String,
-					we_svgGraphWithoutRefs :: String,
-					we_svgCVLGraph :: String
-			   }
+                    we_fileName :: String,
+                    we_serverURL :: String,
+                    we_serverPort :: String,
+                    -- | code fragments are consumed
+                    we_htmlCodeFragments :: [ String ],
+                    we_stats :: String,
+                    we_graphNo :: Int,
+                    we_svgGraphWithRefs :: String,
+                    we_svgGraphWithoutRefs :: String,
+                    we_svgCVLGraph :: String
+               }
 
 
 replaceClaferWikiBlocks :: Block -> State WikiEnv Block
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer" ], _) _) = do
-	wikiEnv <- get
-	let (fragment:fragments) = we_htmlCodeFragments wikiEnv
-	put $ wikiEnv { we_htmlCodeFragments = fragments }
-	return $ RawBlock "html" ("<div class=\"code\">" ++ fragment ++ "</div>")
+    wikiEnv <- get
+    let (fragment:fragments) = we_htmlCodeFragments wikiEnv
+    put $ wikiEnv { we_htmlCodeFragments = fragments }
+    return $ RawBlock "html" ("<div class=\"code\">" ++ fragment ++ "</div>")
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "links" ], _) _) = do
-	fileName <- gets we_fileName
-	return $ RawBlock "html" $ renderLinks fileName
+    fileName <- gets we_fileName
+    return $ RawBlock "html" $ renderLinks fileName
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "stats" ], _) _) = do
-	stats <- gets we_stats
-	return $ RawBlock "html" $ renderStats stats
+    stats <- gets we_stats
+    return $ RawBlock "html" $ renderStats stats
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "graph" ], _) _) = do
-	wikiEnv <- get
-	graphNo <- gets we_graphNo
-	svgGraphWithRefs <- gets we_svgGraphWithRefs
-	svgGraphWithoutRefs <- gets we_svgGraphWithoutRefs
-	put $ wikiEnv { we_graphNo = graphNo + 1 }
-	return $ RawBlock "html" $ renderGraphWithToggle svgGraphWithoutRefs svgGraphWithRefs  graphNo
+    wikiEnv <- get
+    graphNo <- gets we_graphNo
+    svgGraphWithRefs <- gets we_svgGraphWithRefs
+    svgGraphWithoutRefs <- gets we_svgGraphWithoutRefs
+    put $ wikiEnv { we_graphNo = graphNo + 1 }
+    return $ RawBlock "html" $ renderGraphWithToggle svgGraphWithoutRefs svgGraphWithRefs  graphNo
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "cvlGraph" ], _) _) =  do
-	svgCVLGraph <- gets we_svgCVLGraph
-	return $ RawBlock "html" $ renderGraph svgCVLGraph
+    svgCVLGraph <- gets we_svgCVLGraph
+    return $ RawBlock "html" $ renderGraph svgCVLGraph
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "cvlgraph" ], _) _) =  do
-	svgCVLGraph <- gets we_svgCVLGraph
-	return $ RawBlock "html" $ renderGraph svgCVLGraph
+    svgCVLGraph <- gets we_svgCVLGraph
+    return $ RawBlock "html" $ renderGraph svgCVLGraph
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "summary" ], _) _) =  do
-	wikiEnv <- get
-	fileName <- gets we_fileName
-	stats <- gets we_stats
-	graphNo <- gets we_graphNo
-	svgGraphWithRefs <- gets we_svgGraphWithRefs
-	svgGraphWithoutRefs <- gets we_svgGraphWithoutRefs
-	put $ wikiEnv { we_graphNo = graphNo + 1 }
-	return $ RawBlock "html" $ renderSummary fileName stats svgGraphWithoutRefs svgGraphWithRefs graphNo
+    wikiEnv <- get
+    fileName <- gets we_fileName
+    stats <- gets we_stats
+    graphNo <- gets we_graphNo
+    svgGraphWithRefs <- gets we_svgGraphWithRefs
+    svgGraphWithoutRefs <- gets we_svgGraphWithoutRefs
+    put $ wikiEnv { we_graphNo = graphNo + 1 }
+    return $ RawBlock "html" $ renderSummary fileName stats svgGraphWithoutRefs svgGraphWithRefs graphNo
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "mooviz" ], _) _) =  do
-	wikiEnv <- get
-	return $ renderAnalyzeWithClaferMooViz (we_fileName wikiEnv) (we_serverURL wikiEnv) (we_serverPort wikiEnv)
+    wikiEnv <- get
+    return $ renderAnalyzeWithClaferMooViz (we_fileName wikiEnv) (we_serverURL wikiEnv) (we_serverPort wikiEnv)
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "config" ], _) _) =  do
-	wikiEnv <- get
-	return $ renderConfigureWithClaferConfigurator (we_fileName wikiEnv) (we_serverURL wikiEnv) (we_serverPort wikiEnv)
+    wikiEnv <- get
+    return $ renderConfigureWithClaferConfigurator (we_fileName wikiEnv) (we_serverURL wikiEnv) (we_serverPort wikiEnv)
 
 replaceClaferWikiBlocks (CodeBlock (_, [ "clafer", "ide" ], _) _) =  do
-	wikiEnv <- get
-	return $ renderAddOpenInIDE (we_fileName wikiEnv) (we_serverURL wikiEnv) (we_serverPort wikiEnv)
+    wikiEnv <- get
+    return $ renderAddOpenInIDE (we_fileName wikiEnv) (we_serverURL wikiEnv) (we_serverPort wikiEnv)
 
 replaceClaferWikiBlocks block = return block
 
 renderLinks :: String -> String
 renderLinks fileName =
-	"<div><b>Module Downloads:</b> | <a href=\"/clafer/" ++
-	fileName ++
-	".cfr\">[.cfr]</a> | <a href=\"/clafer/" ++
-	fileName ++
-	".html\">[.html]</a> |</div><br>\n"
+    "<div><b>Module Downloads:</b> | <a href=\"/clafer/" ++
+    fileName ++
+    ".cfr\">[.cfr]</a> | <a href=\"/clafer/" ++
+    fileName ++
+    ".html\">[.html]</a> |</div><br>\n"
 
 renderStats :: String -> String
 renderStats stats =
-	"<div><b>Module Statistics:</b> \n| " ++
-	(intercalate " | " $ lines stats ) ++
-	" |</div><br>\n"
+    "<div><b>Module Statistics:</b> \n| " ++
+    (intercalate " | " $ lines stats ) ++
+    " |</div><br>\n"
 
 
 renderGraphWithToggle :: String           -> String        -> Int      -> String
@@ -263,24 +265,24 @@ 
 renderSummary :: String -> String -> String           -> String        -> Int    -> String
 renderSummary    fileName  stats     svgGraphWithoutRefs svgGraphWithRefs graphNo =
-	renderGraphWithToggle svgGraphWithoutRefs svgGraphWithRefs graphNo ++
-	renderStats stats ++
-	renderLinks fileName
+    renderGraphWithToggle svgGraphWithoutRefs svgGraphWithRefs graphNo ++
+    renderStats stats ++
+    renderLinks fileName
 
 
 compileFragments :: [ String ] -> [ ClaferMode ] -> Either [ClaferErr] (Map.Map ClaferMode CompilerResult)
 compileFragments    fragments     claferModes    =
-	-- compile all clafer code
-	runClafer defaultClaferArgs{
-				mode=claferModes,
-				keep_unused=True,
-				add_comments=True,
-				show_references=False } $ do
-											mapM_ addModuleFragment fragments
-											parse
-											iModule <- desugar Nothing
-											compile iModule
-											generate
+    -- compile all clafer code
+    runClafer defaultClaferArgs{
+                mode=claferModes,
+                keep_unused=True,
+                add_comments=True,
+                show_references=False } $ do
+                                            mapM_ addModuleFragment fragments
+                                            parse
+                                            iModule <- desugar Nothing
+                                            compile iModule
+                                            generate
 
 
 renderAnalyzeWithClaferMooViz :: String -> String -> String -> Block
@@ -309,7 +311,7 @@ 
 renderAddOpenInIDE :: String -> String -> String -> Block
 renderAddOpenInIDE fileName serverURL serverPort =
-	RawBlock "html" (unlines [
+    RawBlock "html" (unlines [
       "<div>" ++
       "<a href=\"http://" ++ serverURL ++ ":8094/?claferFileURL=http://" ++ serverURL ++ ":" ++ serverPort ++ "/clafer/" ++
       fileName ++