# This file is part of NIT ( http://www.nitlanguage.org ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # HTML templates used by Nitdoc to generate API documentation # Pages are assembled using `Template` module doc_template import template # Full Nitdoc page template class TplNitdocPage super Template var head: TplHead writable var body_attrs = new Array[TagAttribute] # attributes for body tag element var topmenu: TplTopMenu writable var sidebar: nullable TplSidebar writable var content: Streamable writable var footer: nullable TplFooter writable var scripts = new Array[TplScript] # js scripts appended to body init do end redef fun rendering do add "" add "" add head add "" add "" add topmenu if footer != null then add "
" else add "
" end if sidebar != null then add sidebar.as(not null) end add content add "
" if footer != null then add footer.as(not null) end for script in scripts do add script end add "" add "" end end # general layout elements # tag class TplHead super Template var title: String var shareurl: String init(title, shareurl: String) do self.title = title self.shareurl = shareurl end redef fun rendering do add """ {{{title}}}""" end end # Top bar menu class TplTopMenu super Template private var elts = new Array[Streamable] redef fun rendering do add "
" add "" add "
" end fun add_elt(href, name: String, is_active: Bool) do elts.add(new TplTopMenuElt(href, name, is_active)) end fun add_raw(content: Streamable) do elts.add(content) end end # A topmenu element private class TplTopMenuElt super Template var href: String var name: String var is_active: Bool init(href, name: String, is_active: Bool) do self.href = href self.name = name self.is_active = is_active end redef fun rendering do if is_active then add """
  • {{{name}}}
  • """ else add """
  • {{{name}}}
  • """ end end end #