X-Git-Url: http://nitlanguage.org
diff --git a/src/ni_nitdoc.nit b/src/ni_nitdoc.nit
index 61f2eb6..f4e54cd 100644
--- a/src/ni_nitdoc.nit
+++ b/src/ni_nitdoc.nit
@@ -126,14 +126,14 @@ class Nitdoc
fun modules do
for mmodule in model.mmodules do
var modulepage = new NitdocModule(mmodule, modelbuilder, dot_dir)
- modulepage.save("{output_dir.to_s}/{mmodule.name}.html")
+ modulepage.save("{output_dir.to_s}/{mmodule.url}")
end
end
fun classes do
for mclass in modelbuilder.model.mclasses do
var classpage = new NitdocClass(mclass, self, dot_dir, source)
- classpage.save("{output_dir.to_s}/{mclass.name}.html")
+ classpage.save("{output_dir.to_s}/{mclass.url}")
end
end
@@ -146,7 +146,7 @@ class Nitdoc
if not prop isa MMethod then continue
content.append("\"{prop.name}\": [")
for propdef in prop.mpropdefs do
- content.append("\{txt: \"{propdef.mproperty.full_name}\", url:\"{propdef.mproperty.anchor}\" \}")
+ content.append("\{txt: \"{propdef.mproperty.full_name}\", url:\"{propdef.url}\" \}")
if not propdef is prop.mpropdefs.last then content.append(", ")
end
content.append("]")
@@ -156,7 +156,7 @@ class Nitdoc
for mclass in model.mclasses do
content.append("\"{mclass.name}\": [")
for mclassdef in mclass.mclassdefs do
- content.append("\{txt: \"{mclassdef.mclass.full_name}\", url:\"{mclass.link_anchor}\" \}")
+ content.append("\{txt: \"{mclassdef.mclass.full_name}\", url:\"{mclass.url}\" \}")
if not mclassdef is mclass.mclassdefs.last then content.append(", ")
end
content.append("]")
@@ -359,7 +359,7 @@ class NitdocOverview
var op = new Buffer
op.append("digraph dep \{ rankdir=BT; node[shape=none,margin=0,width=0,height=0,fontsize=10]; edge[dir=none,color=gray]; ranksep=0.2; nodesep=0.1;\n")
for mmodule in mmodules do
- op.append("\"{mmodule.name}\"[URL=\"{mmodule.name}.html\"];\n")
+ op.append("\"{mmodule.name}\"[URL=\"{mmodule.url}\"];\n")
for imported in mmodule.in_importation.direct_greaters do
if imported.direct_owner == null then
op.append("\"{mmodule.name}\"->\"{imported.name}\";\n")
@@ -500,7 +500,7 @@ class NitdocModule
if m == mmodule then
op.append("\"{m.name}\"[shape=box,margin=0.03];\n")
else
- op.append("\"{m.name}\"[URL=\"{m.name}.html\"];\n")
+ op.append("\"{m.name}\"[URL=\"{m.url}\"];\n")
end
end
for imported in m.in_importation.direct_greaters do
@@ -753,7 +753,7 @@ class NitdocClass
append("
")
for sup in sorted do
if sup == mclass then continue
- append("- {sup.name}
")
+ append("- {sup.link(mbuilder)}
")
end
append("
")
end
@@ -767,7 +767,7 @@ class NitdocClass
append("")
for sub in sorted do
if sub == mclass then continue
- append("- {sub.name}
")
+ append("- {sub.link(mbuilder)}
")
end
append("
")
else if mclass.children.length <= 100 then
@@ -777,7 +777,7 @@ class NitdocClass
append("")
for sub in sorted do
if sub == mclass then continue
- append("- {sub.name}
")
+ append("- {sub.link(mbuilder)}
")
end
append("
")
else
@@ -828,18 +828,18 @@ class NitdocClass
var nowner = mbuilder.mmodule2nmodule[owner]
append("")
if nowner.short_comment.is_empty then
- append("{owner.name}")
+ append("{owner.name}")
else
- append("{owner.name}: {nowner.short_comment}")
+ append("{owner.name}: {nowner.short_comment}")
end
if not mmodules.is_empty then
append("")
for mmodule in mmodules do
var nmodule = mbuilder.mmodule2nmodule[mmodule]
if nmodule.short_comment.is_empty then
- append("- {mmodule.name}
")
+ append("- {mmodule.name}
")
else
- append("- {mmodule.name}: {nmodule.short_comment}
")
+ append("- {mmodule.name}: {nmodule.short_comment}
")
end
end
append("
")
@@ -888,7 +888,7 @@ class NitdocClass
append("")
append("")
for owner, mmodules in sections do
- append("")
+ append("")
if owner != mclass.intro_mmodule and owner != mclass.public_owner then
var nowner = mbuilder.mmodule2nmodule[owner]
append("Methods refined in {owner.link(mbuilder)}
")
@@ -904,7 +904,7 @@ class NitdocClass
for prop in mmethods do append(prop.html_full_desc(self))
end
for mmodule in mmodules do
- append("")
+ append("")
var nmodule = mbuilder.mmodule2nmodule[mmodule]
if mmodule != mclass.intro_mmodule and mmodule != mclass.public_owner then
if nmodule.short_comment.is_empty then
@@ -970,7 +970,7 @@ class NitdocClass
if c == mclass then
op.append("\"{c.name}\"[shape=box,margin=0.03];\n")
else
- op.append("\"{c.name}\"[URL=\"{c.name}.html\"];\n")
+ op.append("\"{c.name}\"[URL=\"{c.url}\"];\n")
end
for c2 in pe.poset[c].direct_greaters do
if not cla.has(c2) then continue
@@ -1023,9 +1023,33 @@ redef class MModule
return methods
end
+ # URL to nitdoc page
+ fun url: String do
+ var res = new Buffer
+ res.append("module_")
+ var mowner = public_owner
+ if mowner != null then
+ res.append("{public_owner.name}_")
+ end
+ res.append("{self.name}.html")
+ return res.to_s
+ end
+
+ # html anchor id to the module in a nitdoc page
+ fun anchor: String do
+ var res = new Buffer
+ res.append("MOD_")
+ var mowner = public_owner
+ if mowner != null then
+ res.append("{public_owner.name}_")
+ end
+ res.append(self.name)
+ return res.to_s
+ end
+
# Return a link (html a tag) to the nitdoc module page
fun link(mbuilder: ModelBuilder): String do
- return "{name}"
+ return "{name}"
end
# Return the module signature decorated with html
@@ -1106,12 +1130,12 @@ redef class MClass
if mbuilder.mclassdef2nclassdef.has_key(intro) then
var nclass = mbuilder.mclassdef2nclassdef[intro]
if nclass isa AStdClassdef then
- return "{html_signature}"
+ return "{html_signature}"
else
- return "{html_signature}"
+ return "{html_signature}"
end
else
- return "{html_signature}"
+ return "{html_signature}"
end
end
@@ -1123,8 +1147,8 @@ redef class MClass
return res.to_s
end
- fun link_anchor: String do
- return "{name}.html"
+ fun url: String do
+ return "class_{public_owner}_{c_name}.html"
end
# Escape name for html output
@@ -1136,10 +1160,6 @@ redef class MProperty
redef type OTHER: MProperty
redef fun <(other: OTHER): Bool do return self.name < other.name
- fun anchor: String do
- return "PROP_{c_name}"
- end
-
# Return the property namespace decorated with html
fun html_namespace(mbuilder: ModelBuilder): String do
return "{intro_mclassdef.mclass.html_namespace(mbuilder)}::{intro.link(mbuilder)}"
@@ -1182,13 +1202,16 @@ redef class MPropDef
redef type OTHER: MPropDef
redef fun <(other: OTHER): Bool do return self.mproperty.name < other.mproperty.name
+ fun url: String do return "{mclassdef.mclass.url}#{anchor}"
+ fun anchor: String do return "PROP_{mclassdef.mclass.public_owner.name}_{c_name}"
+
# Return a link (html a tag) to the nitdoc class page
fun link(mbuilder: ModelBuilder): String do
if mbuilder.mpropdef2npropdef.has_key(self) then
var nprop = mbuilder.mpropdef2npropdef[self]
- return "{mproperty.name}"
+ return "{mproperty.name}"
else
- return "{mproperty.name}"
+ return "{mproperty.name}"
end
end
@@ -1249,7 +1272,7 @@ redef class MMethodDef
else
classes.add("public")
end
- res.append("")
+ res.append("")
res.append("{mprop.html_signature(page.mbuilder)}
")
res.append(html_info(page))
res.append("")
@@ -1334,7 +1357,7 @@ redef class MVirtualTypeDef
else
classes.add("public")
end
- res.append("
")
+ res.append("")
res.append("{mprop.name}: {bound.link(page.mbuilder)}
")
res.append(html_info(page))
res.append("")