A DocPage documenting a MEntity

Introduced properties

type MENTITY: MEntity

nitc :: PageMEntity :: MENTITY

Type of MEntity documented by this page
private var _api_tab: DocTab

nitc :: PageMEntity :: _api_tab

API tab
private var _code_tab: DocTab

nitc :: PageMEntity :: _code_tab

Code tab
private var _concerns: nullable ConcernsTree

nitc :: PageMEntity :: _concerns

Concerns to display in this page.
private var _dep_tab: DocTab

nitc :: PageMEntity :: _dep_tab

Dependencies tab
private var _html_url: String

nitc :: PageMEntity :: _html_url

private var _lin_tab: DocTab

nitc :: PageMEntity :: _lin_tab

Lienarization tab
private var _main_tab: DocTab

nitc :: PageMEntity :: _main_tab

For mentities the main tab is the doc tab
private var _mentity: MENTITY

nitc :: PageMEntity :: _mentity

MEntity documented by this page
private var _tabs: Array[DocTab]

nitc :: PageMEntity :: _tabs

private var _title: String

nitc :: PageMEntity :: _title

fun api_tab: DocTab

nitc :: PageMEntity :: api_tab

API tab
protected fun api_tab=(api_tab: DocTab)

nitc :: PageMEntity :: api_tab=

API tab
fun build_api(doc: DocModel)

nitc :: PageMEntity :: build_api

Build the API tab
fun build_code(doc: DocModel)

nitc :: PageMEntity :: build_code

Build the code panel
fun build_dependencies(doc: DocModel)

nitc :: PageMEntity :: build_dependencies

Build the dependencies tab
fun build_linearization(doc: DocModel)

nitc :: PageMEntity :: build_linearization

Build the linearization panel
fun build_main(doc: DocModel)

nitc :: PageMEntity :: build_main

Build the main tab (the one that contains the MDoc)
fun code_tab: DocTab

nitc :: PageMEntity :: code_tab

Code tab
protected fun code_tab=(code_tab: DocTab)

nitc :: PageMEntity :: code_tab=

Code tab
fun concerns: nullable ConcernsTree

nitc :: PageMEntity :: concerns

Concerns to display in this page.
protected fun concerns=(concerns: nullable ConcernsTree)

nitc :: PageMEntity :: concerns=

Concerns to display in this page.
fun dep_tab: DocTab

nitc :: PageMEntity :: dep_tab

Dependencies tab
protected fun dep_tab=(dep_tab: DocTab)

nitc :: PageMEntity :: dep_tab=

Dependencies tab
fun lin_tab: DocTab

nitc :: PageMEntity :: lin_tab

Lienarization tab
protected fun lin_tab=(lin_tab: DocTab)

nitc :: PageMEntity :: lin_tab=

Lienarization tab
fun mentity: MENTITY

nitc :: PageMEntity :: mentity

MEntity documented by this page
protected fun mentity=(mentity: MENTITY)

nitc :: PageMEntity :: mentity=

MEntity documented by this page
init new(mentity: MEntity): PageMEntity

nitc :: PageMEntity :: new

Redefined properties

redef type SELF: PageMEntity

nitc $ PageMEntity :: SELF

Type of this instance, automatically specialized in every class
redef fun apply_structure(doc: DocModel)

nitc :: static_structure $ PageMEntity :: apply_structure

Create the structure of this page
redef fun html_url: String

nitc :: static_html $ PageMEntity :: html_url

Page url
redef fun html_url=(html_url: String)

nitc :: static_html $ PageMEntity :: html_url=

Page url
redef fun init_title(doc: DocModel)

nitc :: static_html $ PageMEntity :: init_title

Build page title string
redef fun init_topmenu(doc: DocModel)

nitc :: static_html $ PageMEntity :: init_topmenu

Build top menu template if any
redef fun main_tab: DocTab

nitc $ PageMEntity :: main_tab

For mentities the main tab is the doc tab
redef fun main_tab=(main_tab: DocTab)

nitc $ PageMEntity :: main_tab=

For mentities the main tab is the doc tab
redef fun render_content

nitc :: static_html $ PageMEntity :: render_content

Renders the footer and content
redef fun tabs: Array[DocTab]

nitc $ PageMEntity :: tabs

Page tab panels
redef fun tabs=(tabs: Array[DocTab])

nitc $ PageMEntity :: tabs=

Page tab panels
redef fun title: String

nitc $ PageMEntity :: title

Title of this page
redef fun title=(title: String)

nitc $ PageMEntity :: title=

Title of this page

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type MENTITY: MEntity

nitc :: PageMEntity :: MENTITY

Type of MEntity documented by this page
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _api_tab: DocTab

nitc :: PageMEntity :: _api_tab

API tab
private var _code_tab: DocTab

nitc :: PageMEntity :: _code_tab

Code tab
private var _concerns: nullable ConcernsTree

nitc :: PageMEntity :: _concerns

Concerns to display in this page.
private var _content: Array[Writable]

template :: Template :: _content

Each sub-elements
private var _dep_tab: DocTab

nitc :: PageMEntity :: _dep_tab

Dependencies tab
private var _html_url: String

nitc :: PageMEntity :: _html_url

private var _html_url: String

nitc :: DocPage :: _html_url

Page url
private var _is_frozen: Bool

template :: Template :: _is_frozen

Is the template allowing more modification (add)
private var _is_writing: Bool

template :: Template :: _is_writing

Flag to avoid infinite recursivity if a template contains itself
private var _lin_tab: DocTab

nitc :: PageMEntity :: _lin_tab

Lienarization tab
private var _main_tab: DocTab

nitc :: PageMEntity :: _main_tab

For mentities the main tab is the doc tab
private var _main_tab: DocTab

nitc :: DocPage :: _main_tab

The page main tab
private var _mentity: MENTITY

nitc :: PageMEntity :: _mentity

MEntity documented by this page
private var _piwik_script: nullable PiwikScript

nitc :: DocPage :: _piwik_script

Piwik script to append in the page scripts
private var _render_done: Bool

template :: Template :: _render_done

Flag to avoid multiple rendering
private var _shareurl: String

nitc :: DocPage :: _shareurl

Directory where css, js and other assets can be found
private var _tabs: Array[DocTab]

nitc :: DocPage :: _tabs

Page tab panels
private var _tabs: Array[DocTab]

nitc :: PageMEntity :: _tabs

private var _title: String

nitc :: DocPage :: _title

Title of this page
private var _title: String

nitc :: PageMEntity :: _title

private var _topmenu: DocTopMenu

nitc :: DocPage :: _topmenu

Top menu template if any
fun add(element: Writable)

template :: Template :: add

Append an element (String, other Template, etc.) at the end of the template.
fun add_all(elements: Collection[Writable])

template :: Template :: add_all

Append a bunch of elements at the end of the template.
fun add_list(elements: Collection[Writable], sep: Writable, last_sep: Writable)

template :: Template :: add_list

Append a bunch of elements at the end of the template with separations.
fun addn(element: Writable)

template :: Template :: addn

Append element and the end of the template then append a "\n".
fun api_tab: DocTab

nitc :: PageMEntity :: api_tab

API tab
protected fun api_tab=(api_tab: DocTab)

nitc :: PageMEntity :: api_tab=

API tab
fun apply_structure(doc: DocModel)

nitc :: DocPage :: apply_structure

Create the structure of this page
fun build_api(doc: DocModel)

nitc :: PageMEntity :: build_api

Build the API tab
fun build_code(doc: DocModel)

nitc :: PageMEntity :: build_code

Build the code panel
fun build_dependencies(doc: DocModel)

nitc :: PageMEntity :: build_dependencies

Build the dependencies tab
fun build_linearization(doc: DocModel)

nitc :: PageMEntity :: build_linearization

Build the linearization panel
fun build_main(doc: DocModel)

nitc :: PageMEntity :: build_main

Build the main tab (the one that contains the MDoc)
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun code_tab: DocTab

nitc :: PageMEntity :: code_tab

Code tab
protected fun code_tab=(code_tab: DocTab)

nitc :: PageMEntity :: code_tab=

Code tab
fun concerns: nullable ConcernsTree

nitc :: PageMEntity :: concerns

Concerns to display in this page.
protected fun concerns=(concerns: nullable ConcernsTree)

nitc :: PageMEntity :: concerns=

Concerns to display in this page.
private fun content: Array[Writable]

template :: Template :: content

Each sub-elements
private fun content=(content: Array[Writable])

template :: Template :: content=

Each sub-elements
init defaultinit(title: String)

nitc :: DocPage :: defaultinit

fun dep_tab: DocTab

nitc :: PageMEntity :: dep_tab

Dependencies tab
protected fun dep_tab=(dep_tab: DocTab)

nitc :: PageMEntity :: dep_tab=

Dependencies tab
fun footer: nullable Writable

nitc :: DocPage :: footer

Footer content if any
fun footer=(footer: nullable Writable)

nitc :: DocPage :: footer=

Footer content if any
fun force_render

template :: Template :: force_render

Call rendering, if not already done
fun freeze

template :: Template :: freeze

Disable further modification: no more add is allowed
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun html_url: String

nitc :: DocPage :: html_url

Page url
fun html_url=(html_url: String)

nitc :: DocPage :: html_url=

Page url
init init

core :: Object :: init

fun init_title(doc: DocModel)

nitc :: DocPage :: init_title

Build page title string
fun init_topmenu(doc: DocModel)

nitc :: DocPage :: init_topmenu

Build top menu template if any
fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_frozen: Bool

template :: Template :: is_frozen

Is the template allowing more modification (add)
protected fun is_frozen=(is_frozen: Bool)

template :: Template :: is_frozen=

Is the template allowing more modification (add)
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private fun is_writing: Bool

template :: Template :: is_writing

Flag to avoid infinite recursivity if a template contains itself
private fun is_writing=(is_writing: Bool)

template :: Template :: is_writing=

Flag to avoid infinite recursivity if a template contains itself
fun lin_tab: DocTab

nitc :: PageMEntity :: lin_tab

Lienarization tab
protected fun lin_tab=(lin_tab: DocTab)

nitc :: PageMEntity :: lin_tab=

Lienarization tab
fun main_tab: DocTab

nitc :: DocPage :: main_tab

The page main tab
protected fun main_tab=(main_tab: DocTab)

nitc :: DocPage :: main_tab=

The page main tab
fun mentity: MENTITY

nitc :: PageMEntity :: mentity

MEntity documented by this page
protected fun mentity=(mentity: MENTITY)

nitc :: PageMEntity :: mentity=

MEntity documented by this page
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
init new(mentity: MEntity): PageMEntity

nitc :: PageMEntity :: new

fun new_sub: Template

template :: Template :: new_sub

Return a new basic template that is automatically added in self (using add)
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun piwik_script: nullable PiwikScript

nitc :: DocPage :: piwik_script

Piwik script to append in the page scripts
fun piwik_script=(piwik_script: nullable PiwikScript)

nitc :: DocPage :: piwik_script=

Piwik script to append in the page scripts
fun render(doc: DocModel): Writable

nitc :: DocPage :: render

Render the page as a html template
private fun render_content

nitc :: DocPage :: render_content

Renders the footer and content
private fun render_done: Bool

template :: Template :: render_done

Flag to avoid multiple rendering
private fun render_done=(render_done: Bool)

template :: Template :: render_done=

Flag to avoid multiple rendering
private fun render_head

nitc :: DocPage :: render_head

Renders the html <head>
protected fun rendering

template :: Template :: rendering

Service used to render the content of the template.
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun shareurl: String

nitc :: DocPage :: shareurl

Directory where css, js and other assets can be found
fun shareurl=(shareurl: String)

nitc :: DocPage :: shareurl=

Directory where css, js and other assets can be found
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun tabs: Array[DocTab]

nitc :: DocPage :: tabs

Page tab panels
protected fun tabs=(tabs: Array[DocTab])

nitc :: DocPage :: tabs=

Page tab panels
fun title: String

nitc :: DocPage :: title

Title of this page
fun title=(title: String)

nitc :: DocPage :: title=

Title of this page
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun topmenu: DocTopMenu

nitc :: DocPage :: topmenu

Top menu template if any
fun topmenu=(topmenu: DocTopMenu)

nitc :: DocPage :: topmenu=

Top menu template if any
abstract fun write_to(stream: Writer)

core :: Writable :: write_to

Write itself to a stream
fun write_to_bytes: Bytes

core :: Writable :: write_to_bytes

Like write_to but return a new Bytes (may be quite large)
fun write_to_file(filepath: String)

core :: Writable :: write_to_file

Like write_to but take care of creating the file
fun write_to_string: String

core :: Writable :: write_to_string

Like write_to but return a new String (may be quite large).
package_diagram nitc::PageMEntity PageMEntity nitc::DocPage DocPage nitc::PageMEntity->nitc::DocPage template::Template Template nitc::DocPage->template::Template ...template::Template ... ...template::Template->template::Template nitc::PageMPackage PageMPackage nitc::PageMPackage->nitc::PageMEntity nitc::PageMGroup PageMGroup nitc::PageMGroup->nitc::PageMEntity nitc::PageMModule PageMModule nitc::PageMModule->nitc::PageMEntity nitc::PageMClass PageMClass nitc::PageMClass->nitc::PageMEntity nitc::PageMProperty PageMProperty nitc::PageMProperty->nitc::PageMEntity

Ancestors

interface Object

core :: Object

The root of the class hierarchy.
class Template

template :: Template

Templates are simple hierarchical pieces of text used for efficient stream writing.
interface Writable

core :: Writable

Things that can be efficienlty written to a Writer

Parents

class DocPage

nitc :: DocPage

A documentation page abstraction

Children

class PageMClass

nitc :: PageMClass

A documentation page about a MClass
class PageMGroup

nitc :: PageMGroup

A documentation page about a MGroup
class PageMModule

nitc :: PageMModule

A documentation page about a MModule
class PageMPackage

nitc :: PageMPackage

A documentation page for a MPackage
class PageMProperty

nitc :: PageMProperty

A documentation page about a MProperty

Class definitions

nitc $ PageMEntity
# 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

nitc :: static_structure $ PageMEntity
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