# build page
init_title(v, doc)
- init_sidebar(v, doc)
init_topmenu(v, doc)
init_content(v, doc)
+ init_sidebar(v, doc)
# piwik tracking
var tracker_url = v.ctx.opt_piwik_tracker.value
# Build page sidebar if any.
fun init_sidebar(v: RenderHTMLPhase, doc: DocModel) do
- sidebar = new TplSidebar
+ sidebar = new DocSideBar
+ sidebar.boxes.add new DocSideBox("Summary", html_toc)
end
# Build page content template.
- fun init_content(v: RenderHTMLPhase, doc: DocModel) do end
+ fun init_content(v: RenderHTMLPhase, doc: DocModel) do
+ root.init_html_render(v, doc, self)
+ end
end
redef class OverviewPage
section.add_child ssection
self.add_section section
end
-
- redef fun init_sidebar(v, doc) do sidebar = new TplSidebar
end
redef class SearchPage
for mclass in sorted do
list.add_li tpl_sidebar_item(mclass)
end
- sidebar.boxes.add new TplSideBox.with_content("All classes", list)
+ sidebar.boxes.add new DocSideBox("All classes", list)
+ sidebar.boxes.last.is_open = false
end
private fun tpl_sidebar_item(def: MClass): TplListItem do
for mclass in sorted do
list.add_li tpl_sidebar_item(mclass)
end
- sidebar.boxes.add new TplSideBox.with_content("All classes", list)
+ sidebar.boxes.add new DocSideBox("All classes", list)
+ sidebar.boxes.last.is_open = false
end
private fun tpl_sidebar_item(def: MClass): TplListItem do
by_kind.sort_groups(v.name_sorter)
for g in by_kind.groups do tpl_sidebar_list(g, summary)
- sidebar.boxes.add new TplSideBox.with_content("All properties", summary)
+ sidebar.boxes.add new DocSideBox("All properties", summary)
+ sidebar.boxes.last.is_open = false
end
private fun tpl_sidebar_list(mprops: PropertyGroup[MProperty], summary: TplList) do
#
# FIXME needed to maintain TplSection compatibility.
fun render(v: RenderHTMLPhase, doc: DocModel, page: MEntityPage, parent: TplSectionElt) is abstract
+
+ # Prepares the HTML rendering for this element.
+ #
+ # This visit is mainly used to set template attributes before rendering.
+ fun init_html_render(v: RenderHTMLPhase, doc: DocModel, page: DocPage) do
+ for child in children do child.init_html_render(v, doc, page)
+ end
end
redef class DocRoot
if mentity.is_intro and mentity.mmodule != page.mentity then
article.content = mentity.html_short_comment
end
+ if page isa MModulePage then is_toc_hidden = true
else if mentity isa MPropDef then
if page.mentity isa MClass then
title = new Template
title.add "in "
title.add mentity.mclassdef.html_link
article.title = title
- article.summary_title = "in {mentity.mclassdef.html_name}"
+ toc_title = "in {mentity.mclassdef.html_name}"
end
article.source_link = v.tpl_showsource(mentity.location)
end
file.close
sys.system("\{ test -f {path_sh}.png && test -f {path_sh}.s.dot && diff -- {path_sh}.dot {path_sh}.s.dot >/dev/null 2>&1 ; \} || \{ cp -- {path_sh}.dot {path_sh}.s.dot && dot -Tpng -o{path_sh}.png -Tcmapx -o{path_sh}.map {path_sh}.s.dot ; \}")
var fmap = new FileReader.open("{path}.map")
- var map = fmap.read_all
+ map = fmap.read_all
fmap.close
var article = new TplArticle("graph")
- var alt = ""
- # FIXME diff hack
- # if title != null then
- # article.title = title
- # alt = "alt='{title.html_escape}'"
- # end
article.css_classes.add "text-center"
- var content = new Template
- var name_html = id.html_escape
- content.add "<img src='{name_html}.png' usemap='#{name_html}' style='margin:auto' {alt}/>"
- content.add map
- article.content = content
+ article.content = write_to_string
parent.add_child article
end
end