nitc :: DocPage :: _piwik_script
Piwik script to append in the page scriptsnitc :: DocPage :: apply_structure
Create the structure of this pagenitc :: DocPage :: defaultinit
nitc :: DocPage :: piwik_script
Piwik script to append in the page scriptsnitc :: DocPage :: piwik_script=
Piwik script to append in the page scriptstemplate :: Template :: _is_frozen
Is the template allowing more modification (add
)
template :: Template :: _is_writing
Flag to avoid infinite recursivity if a template contains itselfnitc :: DocPage :: _piwik_script
Piwik script to append in the page scriptstemplate :: Template :: _render_done
Flag to avoid multiple renderingnitc :: DocPage :: apply_structure
Create the structure of this pagecore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: DocPage :: defaultinit
template :: Template :: defaultinit
core :: Object :: defaultinit
core :: Writable :: 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 itselfcore :: Object :: native_class_name
The class name of the object in CString format.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).
nitc :: PagePerson
A page that lists the packages maintained and contributed by a person
# A documentation page abstraction
class DocPage
# Title of this page
var title: String is writable
# Page tab panels
#
# Nitdoc pages are tabulated.
# If a page has only one tab, it is presented as a single page.
# With more than one tab, the HTML rendering process adds tab headers and
# links.
var tabs: Array[DocTab] = [main_tab] is lazy
# The page main tab
#
# For most pages this tab is suffisent.
# Subclasses can add more tabs.
var main_tab = new DocTab("main", "Main")
redef fun to_s do return title
end
src/doc/static/static_base.nit:91,1--112,3
redef class DocPage
# Create the structure of this page
fun apply_structure(doc: DocModel) do end
end
src/doc/static/static_structure.nit:20,1--24,3
redef class DocPage
super Template
# Page url
var html_url: String is writable, noinit
# Render the page as a html template
fun render(doc: DocModel): Writable do
# init page options
self.shareurl = doc.share_url or else "."
self.footer = doc.custom_footer
# build page
init_title(doc)
init_topmenu(doc)
# piwik tracking
var tracker_url = doc.tracker_url
var site_id = doc.piwik_site_id
if tracker_url != null and site_id != null then
piwik_script = new PiwikScript(tracker_url, site_id)
end
return self
end
# Build page title string
fun init_title(doc: DocModel) do end
# Renders the html `<head>`
private fun render_head do
var css = (self.shareurl / "css").html_escape
var vendors = (self.shareurl / "vendors").html_escape
addn "<!DOCTYPE html>"
addn "<head>"
addn " <meta charset='utf-8'/>"
addn " <link rel='stylesheet' href='{vendors}/bootstrap/css/bootstrap.min.css'/>"
addn " <link rel='stylesheet' href='{css}/nitdoc.bootstrap.css'/>"
addn " <link rel='stylesheet' href='{css}/nitdoc.cards.css'/>"
addn " <link rel='stylesheet' href='{css}/nitdoc.code.css'/>"
addn " <link rel='stylesheet' href='{css}/nitdoc.css'/>"
addn " <link rel='stylesheet' href='{css}/nitdoc.quicksearch.css'/>"
addn " <title>{title.html_escape}</title>"
addn "</head>"
add "<body>"
end
# Renders the footer and content
private fun render_content do
if tabs.is_empty then return
if tabs.length == 1 then
addn tabs.first
return
end
addn "<ul class='nav nav-tabs'>"
for tab in tabs do
if tab.is_empty and not tab isa DocTabLink then continue
addn tab.tab_link
end
addn "</ul>"
addn "<div class='tab-content'>"
for tab in tabs do
if tab.is_empty then continue
addn tab
end
addn "</div>"
end
# Piwik script to append in the page scripts
var piwik_script: nullable PiwikScript = null is writable
# Render the whole page
redef fun rendering do
render_head
add topmenu
addn "<div class='container-fluid'>"
render_content
addn "</div>"
render_footer
end
end
src/doc/static/static_html.nit:21,1--150,3