Commit e707ded8 authored by Fabrice Roy's avatar Fabrice Roy

add clusters and storages

add a meso_num to deal with collapsible elts
many changes with templates
parent 76d938cd
......@@ -39,6 +39,9 @@ def jinja2_format_storage(value, power=0, units=['o', 'Kio', 'Mio', 'Gio', 'Tio'
# Extend default translator
class myHTMLTranslator(PelicanHTMLTranslator):
global num_meso
num_meso = 0
def __init__(self, *args, **kwargs):
# Pre-loading Jinja2 templates and filters
......@@ -51,6 +54,10 @@ class myHTMLTranslator(PelicanHTMLTranslator):
'format_storage': jinja2_format_storage,
})
self.meso_template = env.get_template('meso.tpl')
self.cluster_template = env.get_template('cluster.tpl')
self.cluster_list_template = env.get_template('cluster_list.tpl')
self.storage_template = env.get_template('storage.tpl')
self.storage_list_template = env.get_template('storage_list.tpl')
super().__init__(*args, *kwargs)
......@@ -61,42 +68,62 @@ class myHTMLTranslator(PelicanHTMLTranslator):
self.body.append('</div>')
def visit_meso_list(self, node):
super().visit_section(node)
self.body.append('<div class="meso_list">')
pass
# super().visit_section(node)
# self.body.append('<div class="meso_list">')
def depart_meso_list(self, node):
self.body.append('</div>')
super().depart_section(node)
pass
#self.body.append('</div>')
#super().depart_section(node)
def visit_meso(self, node):
self.body.extend(self.meso_template.render(meso=node, header=True).splitlines(True))
global num_meso
num_meso=num_meso+1
self.body.extend(self.meso_template.render(meso=node, num=num_meso, header=True).splitlines(True))
def depart_meso(self, node):
self.body.extend(self.meso_template.render(meso=node, footer=True).splitlines(True))
def visit_cluster_list(self, node):
pass
self.body.extend(self.cluster_list_template.render(num=num_meso, header=True).splitlines(True))
def depart_cluster_list(self, node):
pass
self.body.extend(self.cluster_list_template.render(num=num_meso, footer=True).splitlines(True))
def visit_cluster(self, node):
pass
self.body.extend(self.cluster_template.render(cluster=node, num=num_meso, header=True).splitlines(True))
def depart_cluster(self, node):
self.body.extend(self.cluster_template.render(cluster=node, num=num_meso, footer=True).splitlines(True))
def visit_cluster_storage_list(self, node):
pass
#self.body.extend(self.storage_list_template.render(num=num_meso, header=True).splitlines(True))
def visit_storage_list(self, node):
def depart_cluster_storage_list(self, node):
pass
#self.body.extend(self.storage_list_template.render(num=num_meso, footer=True).splitlines(True))
def depart_storage_list(self, node):
def visit_cluster_storage(self, node):
pass
#self.body.extend(self.storage_template.render(storage=node, num=num_meso, header=True).splitlines(True))
def visit_storage(self, node):
def depart_cluster_storage(self, node):
pass
#self.body.extend(self.storage_template.render(storage=node, num=num_meso, footer=True).splitlines(True))
def visit_storage_list(self, node):
self.body.extend(self.storage_list_template.render(num=num_meso, header=True).splitlines(True))
def depart_storage_list(self, node):
self.body.extend(self.storage_list_template.render(num=num_meso, footer=True).splitlines(True))
def visit_storage(self, node):
self.body.extend(self.storage_template.render(storage=node, num=num_meso, header=True).splitlines(True))
def depart_storage(self, node):
pass
self.body.extend(self.storage_template.render(storage=node, num=num_meso, footer=True).splitlines(True))
def visit_node_type_list(self, node):
pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment