lib/markdown: merge processor and emitter
[nit.git] / src / web / api_docdown.nit
index 80c50c7..84dcc8c 100644 (file)
@@ -25,7 +25,7 @@ redef class NitwebConfig
        # Specific Markdown processor to use within Nitweb
        var md_processor: MarkdownProcessor is lazy do
                var proc = new MarkdownProcessor
-               proc.emitter.decorator = new NitwebDecorator(view, modelbuilder)
+               proc.decorator = new NitwebDecorator(view, modelbuilder)
                return proc
        end
 end
@@ -106,7 +106,7 @@ class NitwebInlineDecorator
        end
 end
 
-redef class MarkdownEmitter
+redef class MarkdownProcessor
 
        # Parser used to process doc commands
        var parser = new DocCommandParser
@@ -226,7 +226,7 @@ end
 redef class DocCommand
 
        # Emit the HTML related to the execution of this doc command
-       fun render(v: MarkdownEmitter, token: TokenWikiLink, model: ModelView) do
+       fun render(v: MarkdownProcessor, token: TokenWikiLink, model: ModelView) do
                v.write_error("not yet implemented command `{token.link or else "null"}`")
        end
 end
@@ -253,7 +253,7 @@ redef class CommentCommand
                end
                v.add "</h3>"
                if not opts.has_key("no-comment") then
-                       v.add v.processor.process(mdoc.comment).write_to_string
+                       v.add v.process(mdoc.comment).write_to_string
                end
        end
 end
@@ -317,7 +317,11 @@ redef class GraphCommand
                var mentity = v.find_mentity(model, name)
                if mentity == null then return
                var g = new InheritanceGraph(mentity, model)
-               v.add g.draw(3, 3).to_svg
+               var pdepth = if opts.has_key("pdepth") and opts["pdepth"].is_int then
+                       opts["pdepth"].to_i else 3
+               var cdepth = if opts.has_key("cdepth") and opts["cdepth"].is_int then
+                       opts["cdepth"].to_i else 3
+               v.add g.draw(pdepth, cdepth).to_svg
        end
 end