X-Git-Url: http://nitlanguage.org
diff --git a/src/test_markdown.nit b/src/test_markdown.nit
index 24b48f7..6e6ccc3 100644
--- a/src/test_markdown.nit
+++ b/src/test_markdown.nit
@@ -16,49 +16,51 @@
module test_markdown
import modelize_property
+import highlight
import markdown
redef class ModelBuilder
fun test_markdown(page: HTMLTag, mmodule: MModule)
do
- page.add_raw_html ""
- page.add_raw_html "
module {mmodule}
"
- if mmodule2nmodule.has_key(mmodule) then
- do
- var mdoc = mmodule.mdoc
- if mdoc == null then break label x
+ page.add_raw_html "module {mmodule}"
+ var mdoc = mmodule.mdoc
+ if mdoc != null then
+ page.add mdoc.full_markdown
+ end
+ for mclassdef in mmodule.mclassdefs do
+ mdoc = mclassdef.mdoc
+ if mdoc != null then
+ page.add_raw_html "class {mclassdef}"
page.add mdoc.full_markdown
- end label x
- for mclassdef in mmodule.mclassdefs do
- do
- var mdoc = mclassdef.mdoc
- if mdoc != null then
- if mclassdef.mclass.intro == mclassdef then page.add_raw_html ""
- page.add_raw_html "class {mclassdef}
"
- page.add mdoc.full_markdown
- end
- end
- for mpropdef in mclassdef.mpropdefs do
- var mdoc = mpropdef.mdoc
- if mdoc != null then
- if mpropdef.mproperty.intro == mpropdef then page.add_raw_html ""
-
- page.add_raw_html "prop {mpropdef}
"
- page.add mdoc.full_markdown
- end
+ end
+ for mpropdef in mclassdef.mpropdefs do
+ mdoc = mpropdef.mdoc
+ if mdoc != null then
+ page.add_raw_html "prop {mpropdef}
"
+ page.add mdoc.full_markdown
end
end
end
end
end
+redef class MModule
+ redef fun href do return "#{to_s}"
+end
+redef class MClassDef
+ redef fun href do return "#{to_s}"
+end
+redef class MPropDef
+ redef fun href do return "#{to_s}"
+end
+
var toolcontext = new ToolContext
var opt_full = new OptionBool("Process also imported modules", "--full")
toolcontext.option_context.add_option(opt_full)
toolcontext.tooldescription = "Usage: test_markdown [OPTION]... ...\nGenerates HTML of comments of documentation from Nit source files."
-toolcontext.process_options
+toolcontext.process_options(args)
var args = toolcontext.option_context.rest
var model = new Model
@@ -73,6 +75,9 @@ var page = new HTMLTag("html")
page.add_raw_html """
+"""
+page.add_raw_html hv.head_content
+page.add_raw_html """
-
-"""
+"""
if opt_full.value then
- for m in model.mmodules do
- modelbuilder.test_markdown(page, m)
+ for p in model.mprojects do
+ page.add_raw_html "project {p.name}"
+ var mdoc = p.mdoc
+ if mdoc != null then
+ page.add mdoc.full_markdown
+ end
+ for g in p.mgroups do
+ mdoc = g.mdoc
+ if mdoc != null then
+ page.add_raw_html "group {g.full_name}
"
+ page.add mdoc.full_markdown
+ end
+ for m in g.mmodules do
+ modelbuilder.test_markdown(page, m)
+ end
+ end
end
else
for m in mmodules do
@@ -106,5 +125,6 @@ else
end
end
+page.add_raw_html hv.foot_content
page.add_raw_html ""
page.write_to(stdout)