X-Git-Url: http://nitlanguage.org diff --git a/src/doc/html_templates/html_components.nit b/src/doc/html_templates/html_components.nit index 5194e08..bc83f96 100644 --- a/src/doc/html_templates/html_components.nit +++ b/src/doc/html_templates/html_components.nit @@ -20,133 +20,6 @@ import doc_base import template import json::static -# A documentation page -redef class DocPage - super Template - - # Page url - var url: String is writable, noinit - - # Directory where css, js and other assets can be found - var shareurl: String is writable, noinit - - # Attributes of the body tag element - var body_attrs = new Array[TagAttribute] - - # Top menu template if any - var topmenu: TplTopMenu is writable, noinit - - # Sidebar template if any - var sidebar: nullable TplSidebar = null is writable - - # Content of the page in form a TplSection - var sections = new Array[TplSection] - - # Footer content if any - var footer: nullable Writable = null is writable - - # JS scripts to append at the end of the body - var scripts = new Array[TplScript] - - # Add a section to this page - fun add_section(section: TplSection) do - sections.add section - end - - # Render the html header - private fun render_head do - var css = (self.shareurl / "css").html_escape - var vendors = (self.shareurl / "vendors").html_escape - - addn "" - addn "" - addn " " - addn " " - addn " " - addn " " - addn " " - addn " " - addn " " - addn " " - addn " {title.html_escape}" - addn "" - add "" - end - - # Render the topmenu template - private fun render_topmenu do - addn "
" - add topmenu - addn "
" - end - - # Render the sidebar - # Sidebar is automatically populated with a summary of all sections - fun render_sidebar do - if sidebar == null then return - var summary = new TplSummary.with_order(0) - for section in sections do - section.render_summary summary - end - sidebar.boxes.add summary - add sidebar.as(not null) - end - # Render the footer and content - private fun render_content do - for section in sections do add section - if footer != null then - addn "" - end - end - - # Render JS scripts - private fun render_footer do - var vendors = (self.shareurl / "vendors").html_escape - var js = (self.shareurl / "js").html_escape - - addn "" - addn "" - addn "" - addn "" - for script in scripts do add script - addn """""" - addn "" - addn "" - end - - # Render the whole page - redef fun rendering do - render_head - addn "
" - render_topmenu - addn "
" - if sidebar != null then - addn "
" - render_sidebar - addn "
" - addn "
" - render_content - addn "
" - else - addn "
" - render_content - addn "
" - end - addn "
" - addn "
" - render_footer - end -end - ######################### # general layout elements #########################