nitc :: PageMEntity
nitc :: PageMEntity :: _concerns
Concerns to display in this page.nitc :: PageMEntity :: _html_url
nitc :: PageMEntity :: _main_tab
For mentities the main tab is the doc tabnitc :: PageMEntity :: _title
nitc :: PageMEntity :: build_dependencies
Build the dependencies tabnitc :: PageMEntity :: build_linearization
Build the linearization panelnitc :: PageMEntity :: build_main
Build the main tab (the one that contains the MDoc)nitc :: PageMEntity :: concerns
Concerns to display in this page.nitc :: PageMEntity :: concerns=
Concerns to display in this page.nitc :: PageMEntity :: defaultinit
nitc :: PageMEntity :: mentity=
MEntity documented by this pagenitc :: PageMEntity :: new
nitc $ PageMEntity :: SELF
Type of this instance, automatically specialized in every classnitc :: static_structure $ PageMEntity :: apply_structure
Create the structure of this pagenitc :: static_html $ PageMEntity :: init_title
Build page title stringnitc $ PageMEntity :: main_tab=
For mentities the main tab is the doc tabnitc :: static_html $ PageMEntity :: render_content
Renders the footer and contentnitc :: PageMEntity :: _concerns
Concerns to display in this page.nitc :: PageMEntity :: _html_url
template :: Template :: _is_frozen
Is the template allowing more modification (add
)
template :: Template :: _is_writing
Flag to avoid infinite recursivity if a template contains itselfnitc :: PageMEntity :: _main_tab
For mentities the main tab is the doc tabnitc :: DocPage :: _piwik_script
Piwik script to append in the page scriptstemplate :: Template :: _render_done
Flag to avoid multiple renderingnitc :: PageMEntity :: _title
nitc :: DocPage :: apply_structure
Create the structure of this pagenitc :: PageMEntity :: build_dependencies
Build the dependencies tabnitc :: PageMEntity :: build_linearization
Build the linearization panelnitc :: PageMEntity :: build_main
Build the main tab (the one that contains the MDoc)core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: PageMEntity :: concerns
Concerns to display in this page.nitc :: PageMEntity :: concerns=
Concerns to display in this page.template :: Template :: defaultinit
nitc :: PageMEntity :: defaultinit
nitc :: DocPage :: defaultinit
core :: Writable :: defaultinit
core :: Object :: defaultinit
template :: Template :: is_frozen=
Is the template allowing more modification (add
)
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
template :: Template :: is_writing
Flag to avoid infinite recursivity if a template contains itselftemplate :: Template :: is_writing=
Flag to avoid infinite recursivity if a template contains itselfnitc :: PageMEntity :: mentity=
MEntity documented by this pagecore :: Object :: native_class_name
The class name of the object in CString format.nitc :: PageMEntity :: new
core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: DocPage :: piwik_script
Piwik script to append in the page scriptsnitc :: DocPage :: piwik_script=
Piwik script to append in the page scriptstemplate :: Template :: render_done=
Flag to avoid multiple renderingcore :: Writable :: write_to_bytes
Likewrite_to
but return a new Bytes (may be quite large)
core :: Writable :: write_to_file
Likewrite_to
but take care of creating the file
core :: Writable :: write_to_string
Likewrite_to
but return a new String (may be quite large).
# A DocPage documenting a MEntity
abstract class PageMEntity
super DocPage
autoinit mentity
new(mentity: MEntity) do
if mentity isa MPackage then
return new PageMPackage(mentity)
else if mentity isa MGroup then
return new PageMGroup(mentity)
else if mentity isa MModule then
return new PageMModule(mentity)
else if mentity isa MClass then
return new PageMClass(mentity)
else if mentity isa MProperty then
return new PageMProperty(mentity)
else
print "Not yet implemented: Page for {mentity.full_name} ({mentity.class_name})"
abort
end
end
# Type of MEntity documented by this page
type MENTITY: MEntity
# MEntity documented by this page
var mentity: MENTITY
# For mentities the main tab is the doc tab
redef var main_tab = new DocTab("doc", "Doc", true, "book")
# API tab
#
# Where the MEntity API (groups, modules, classes, props) is displayed
var api_tab = new DocTab("api", "API", false, "list")
# Dependencies tab
#
# Where the MEntity importation or inheritance is displayed
var dep_tab = new DocTab("inh", "Dependencies", false, "object-align-vertical")
# Code tab
#
# Since all mentities does not have code, this tab in not in the `tabs` list
# by default.
var code_tab = new DocTab("code", "Code", false, "console")
# Lienarization tab
#
# Since all mentities does not have a linearization, this tab in not in the
# `tabs` list by default.
var lin_tab = new DocTab("lin", "Linearization", false, "arrow-down")
redef var tabs = [main_tab, api_tab, dep_tab] is lazy
redef var title is lazy do return mentity.name
end
src/doc/static/static_base.nit:119,1--174,3
redef class PageMEntity
# Concerns to display in this page.
var concerns: nullable ConcernsTree = null
redef fun apply_structure(doc) do
build_main(doc)
build_api(doc)
build_dependencies(doc)
end
# Build the main tab (the one that contains the MDoc)
fun build_main(doc: DocModel) do
var mentity = self.mentity
var sq = new CmdSummary(doc.model, doc.filter, mentity,
markdown_processor = doc.inline_processor)
sq.init_command
main_tab.content.add new CardMDoc(mentity, mentity.mdoc_or_fallback)
var summary = sq.summary
if summary != null then
main_tab.sidebar.cards.add new CardMdSummary(headlines = summary, md_processor = doc.inline_processor)
end
end
# Build the API tab
fun build_api(doc: DocModel) do
var summary = new CardSummary
var title = "All definitions"
if mentity isa MPackage then title = "All groups and modules"
if mentity isa MGroup then title = "All subgroups and modules"
if mentity isa MModule then title = "All class definitions"
if mentity isa MClass or mentity isa MClassDef then title = "All properties"
var section = new CardSection(2, title)
api_tab.content.add section
summary.cards.add section
var dq = new CmdFeatures(doc.model, doc.filter, mentity)
dq.init_command
var mentities = dq.results
if mentities == null then return
var list = new CardList("api", "API")
for m in mentities do
var card = new CardMEntity(m)
card.id = "api_{card.id}" # avoid id conflicts with main tab
list.cards.add card
summary.cards.add card
end
api_tab.content.add list
if summary.cards.not_empty then
api_tab.sidebar.cards.add summary
end
end
# Build the dependencies tab
fun build_dependencies(doc: DocModel) do
var summary = new CardSummary
var model = doc.model
var mainmodule = doc.mainmodule
var filter = doc.filter
if not doc.no_dot then
var gq = new CmdInheritanceGraph(model, mainmodule, filter, mentity)
gq.init_command
var graph = gq.graph
if graph != null then
graph.draw(2, 2)
dep_tab.content.add new CardGraph(mentity, graph)
end
end
# No inheritance lists for `Object`
if mentity isa MClass and mentity.name == "Object" then return
var inh = new HashMap[String, CmdEntityList]
inh["Ancestors"] = new CmdAncestors(model, mainmodule, filter, mentity, parents = false)
inh["Parents"] = new CmdParents(model, mainmodule, filter, mentity)
inh["Children"] = new CmdChildren(model, mainmodule, filter, mentity)
inh["Descendants"] = new CmdDescendants(model, mainmodule, filter, mentity, children = false)
for title, cmd in inh do
cmd.init_command
var results = cmd.results
if results == null or results.is_empty then continue
var section = new CardSection(3, title)
dep_tab.content.add section
summary.cards.add section
var list = new CardList("inh", "Inheritance")
for mentity in results do
var card = new CardMEntity(mentity)
list.cards.add card
summary.cards.add card
end
dep_tab.content.add list
end
if summary.cards.not_empty then
dep_tab.sidebar.cards.add summary
end
end
# Build the code panel
fun build_code(doc: DocModel) do
var code_url = doc.code_url
if not doc.no_code then
var cq = new CmdEntityCode(doc.model, doc.modelbuilder, doc.filter, mentity)
cq.init_command
var code = cq.node
if code == null then return
code_tab.content.add new CardCode(mentity, code)
else if doc.code_url != null then
code_tab = new DocTabLink("code", "Code", "console", mentity.source_url(code_url))
end
end
# Build the linearization panel
fun build_linearization(doc: DocModel) do
var summary = new CardSummary
var lq = new CmdLinearization(doc.model, doc.mainmodule, doc.filter, mentity)
lq.init_command
var mentities = lq.results
if mentities == null then return
if mentity isa MClass or mentity isa MClassDef then
if mentity.name == "Object" then return # No linearization for `Object`
if mentity.name == "Sys" then return # No linearization for `Sys`
var section = new CardSection(2, "Class definitions")
lin_tab.content.add section
summary.cards.add section
else if mentity isa MProperty or mentity isa MPropDef then
if mentity.name == "init" then return # No linearization for `init`
if mentity.name == "SELF" then return # No linearization for `SELF`
if mentity.name == "to_s" then return # No linearization for `to_s`
var section = new CardSection(2, "Property definitions")
lin_tab.content.add section
summary.cards.add section
end
var list = new CardLinearizationList(mentity)
for m in mentities do
var url = mentity.source_url(doc.code_url)
var node = doc.modelbuilder.mentity2node(m)
if node == null then continue
if doc.no_code then node = null
if m == mentity or
(m isa MClassDef and m.is_intro) or
(m isa MPropDef and m.is_intro) then
var card = new CardLinearizationDef(m, node, is_active = true, url)
list.cards.add card
summary.cards.add card
else
var card = new CardLinearizationDef(m, node, is_active = false, url)
list.cards.add card
summary.cards.add card
end
end
lin_tab.content.add list
if summary.cards.not_empty then
lin_tab.sidebar.cards.add summary
end
end
end
src/doc/static/static_structure.nit:55,1--228,3
redef class PageMEntity
redef var html_url is lazy do return mentity.html_url
redef fun init_title(doc) do title = mentity.html_name
redef fun render_content do
addn new CardPageHeader(
mentity.html_declaration.write_to_string,
mentity.html_namespace.write_to_string)
super
end
end
src/doc/static/static_html.nit:173,1--191,3