#ENCODING UTF-8 # content skills sections and others from a file, on the long run, it should be able to content the whole sheet import argparse, sys, os class Node(object): """Generic Node.""" def __init__(self, name,nb): self.name = name.strip(" ") self.number=nb self.children=[] self.checked="" self.parent=None self.pname=name.replace(" ","").lower() if nb==1: self.checked='checked="checked"' def content(self): return "" def header(self): return "" def css(self): return "" def addchild(self,child): self.children+=[child] # def printable(self,name): # return class Root(Node): """docstring for Root.""" def __init__(self): super(Root,self).__init__("",0) def generate(self): "Return the whole tree, printable" return self.content() def content(self): ret="" for child in self.children: ret+=child.header() # Ligne de chaque tab direct, puis tout for child in self.children: ret+=child.content() ret+="\n" return ret def css(self): "Return the whole css, printable" ret="""div.sheet-tab-content { display: none; }""" for child in self.children: ret+="input.sheet-tab{}:checked ~ div.sheet-tab{},\n".format(child.number) ret=ret[:-1] ret+="{display: block;}" return ret class Tab(Node): """Tab node, contains""" def __init__(self, name,nb): super(Tab, self).__init__(name,nb) def header(self): # Comes first return '\n'.format(self=self) def content(self): ret='