diff --git a/cyberpnk.txt b/cyberpnk.txt index 376c058..a22a1f9 100644 --- a/cyberpnk.txt +++ b/cyberpnk.txt @@ -1,13 +1,126 @@ -@ Compétences -+ Sub section -- Competence 1 -- Competence 2 -. Repeating 1 -+ Sub section 2 -+ Sub section 3 -+ Sub section 4 -@ Magie -+ Subsection 2 -@ Combat -+ Subsection 2 -- Competence2 +@ Physique ++ Compétences de combat +- : Armes à feu +- : Armes d'assaut +- : Armes de poing +- Armes Lourdes +- : Projectiles autopropulsés +- : Armement laser +- Artillerie + : Guidage de missiles + : Systemes de défences + : Balistique superlative +- Combat à Mains Nues + : Neo Kwon Do + : Zero-G +- Combat Armé + : Armes Contandantes + : Armes Tranchantes +- Maniement des Explosifs + ++ Compétences physiques +- Athlétisme +- : Aerien +- : Terrestre +- : Maritime +- : Zero G +- Survie +- : Environnement Sauvage +- : Environnement Urbain +- : Environnement Spacial + ++ Utilisation d’implants +- Utilisation de Cyberware +- : Utilisation de Neuro Accelerateurs +- : Utilisation d'Interfaces de tir +- : Overdrive Physique + ++ Compétences de Pilotage +- Pilotage athmosphérique +- : Pilotage de Chasseurs +- : Pilotage de Navettes +- Vehicules Terestres +- : Vehicules Legers +- : Vehicules Lourds +- : Véhicules de Course +- Vaisseaux Spatiaux +- : Batiments légers +- : Batiments lourds +- : Batiments super lourds + +@ Intelectuelles + ++ Compétences Techniques +- Biotech +- : Chirurgie d’implants +- Electronique +- : Interconnection des systèmes +- : Verrous magnétiques +- Informatique +- : Hardware +- : Software +- : Systèmes embarqués +- Mecanique +- : Réacteurs à Fusion +- : Réacteurs à Fission +- : Compensateurs d'Inertie +- : Technologie Lightfold +- : Systèmes de Survie +- : Systemes de Propultion +- Prospection stellaire +- : Corps stellaires +- : Excavation planetaire + ++ Connaissances +- Bioware +- : Implants Céphaliens +- : Implants Corporels +- Médecine +- : Soins Intensifs +- : Cybernetisation +- Sciences +- : Astromathématiques +- : Biologie +- : Xenobiologie +- : Mathématiques +- : Physique/Chimie +- : Lightfold +- : Sociologie + ++ Culture Générale +- Instruction Civique +- : Administratif/Politique/Droit +- : Finances +- : Psychologie +- Théorie Militaire +- : Tactique +- : Stratégie + +@ Social ++ Compétences Sociales +- Etiquette +- : Alpha Centauri +- : Eridani +- : Banard +- : Tau +- : Sirius +- : C.I.C. +- : Sol +- : Pègre +- Interrogation +- : Intimidation +- Commandement +- Négociation +- Baratin + ++ Competences Clandestines +- Discretion +- Crochetage +- Informations +- Larcin +- Marchés noirs +- : Acquisition d’Objets +- : Acquisition d’Informations + ++ Contacts et Réputations +. Contacts diff --git a/gen.html b/gen.html new file mode 100644 index 0000000..94c664b --- /dev/null +++ b/gen.html @@ -0,0 +1,1680 @@ + + + +
+
+ + + + +
+
+ +

Compétences de combat

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+ +

Compétences physiques

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+ +

Utilisation d’implants

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+ +

Compétences de Pilotage

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+
+
+ + + +
+
+ +

Compétences Techniques

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+ +

Connaissances

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+ +

Culture Générale

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+
+
+ + + +
+
+ +

Compétences Sociales

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+ +

Competences Clandestines

+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+
+
+ +

Contacts et Réputations

+
+
diff --git a/gencss.css b/gencss.css new file mode 100644 index 0000000..5d67c3a --- /dev/null +++ b/gencss.css @@ -0,0 +1,21 @@ +div.sheet-tab-content { display: none; } +input.sheet-tab1:checked ~ div.sheet-tab1, +input.sheet-tab2:checked ~ div.sheet-tab2, +input.sheet-tab3:checked ~ div.sheet-tab3 +{display: block;} + +input.sheet-physique1:checked ~ div.sheet-physique1, +input.sheet-physique2:checked ~ div.sheet-physique2, +input.sheet-physique3:checked ~ div.sheet-physique3, +input.sheet-physique4:checked ~ div.sheet-physique4 +{display: block;} + +input.sheet-intelectuelles1:checked ~ div.sheet-intelectuelles1, +input.sheet-intelectuelles2:checked ~ div.sheet-intelectuelles2, +input.sheet-intelectuelles3:checked ~ div.sheet-intelectuelles3 +{display: block;} + +input.sheet-social1:checked ~ div.sheet-social1, +input.sheet-social2:checked ~ div.sheet-social2, +input.sheet-social3:checked ~ div.sheet-social3 +{display: block;} diff --git a/generator.py b/generator.py index 4a2db07..fdfffdb 100644 --- a/generator.py +++ b/generator.py @@ -1,19 +1,24 @@ -#ENCODING UTF-8 +# -*- coding: 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 +from unidecode import unidecode +# import unicode +def remove_non_ascii(text): + return unidecode(text) class Node(object): """Generic Node.""" def __init__(self, name,nb): - self.name = name.strip(" ") + self.name = name#name.strip(" ") self.number=nb self.children=[] self.checked="" self.parent=None - self.pname=name.replace(" ","").lower() + self.pname=u""+remove_non_ascii(self.name.replace(" ","")).lower() if nb==1: self.checked='checked="checked"' @@ -28,9 +33,7 @@ class Node(object): def addchild(self,child): self.children+=[child] - - # def printable(self,name): - # return + child.parent=self class Root(Node): """docstring for Root.""" @@ -52,11 +55,13 @@ class Root(Node): def css(self): "Return the whole css, printable" - ret="""div.sheet-tab-content { display: none; }""" + 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+="\ninput.sheet-tab{node.number}:checked ~ div.sheet-tab{node.number},".format(node=child) ret=ret[:-1] - ret+="{display: block;}" + ret+="\n{display: block;}\n" + for child in self.children: + ret+=child.css() return ret class Tab(Node): @@ -76,47 +81,56 @@ class Tab(Node): for child in self.children: ret+=child.content() return ret - + def css(self): + ret=" " + for child in self.children: + ret+="\ninput.sheet-{node.pname}{child.number}:checked ~ div.sheet-{node.pname}{child.number},".format(child=child,node=self) + ret=ret[:-1] + ret+="\n{display: block;}\n" + return ret class SubTab(Node): def __init__(self,name,nb): super(SubTab,self).__init__(name,nb) def header(self): - return """ \n""".format(self=self) + return """ \n""".format(self=self) def content(self): - ret= '
\n'.format(self=self) + ret= '
\n'.format(self=self) ret+=" \n

{self.name}

\n".format(self=self) for child in self.children: ret+=child.content() ret+="
\n" return ret + def css(self): + return "" class Skill(Node): """Print a skill.""" def __init__(self, name,nb): super(Skill, self).__init__(name,nb) - def content(self): + def content(self): # {self.parent.pname} is not needed, else _skilllevel_ cause a confict, legacy keeping I guess ? ret=""" - + - - + - -
""".format(self=self) - + +
\n""".format(self=self) + return ret +# # #

Compétences Intellectuelles

#
@@ -124,31 +138,33 @@ class Skill(Node): # # # - # + # #
#
if __name__ == '__main__': # filen=sys.argv[1] + # filen="light.txt" filen="cyberpnk.txt" - + output="gen.html" + outcss="gencss.css" def parse(filen): root=Root() active_tab,active_subtab=None,None tab_nb,subtab_nb,skill_nb=1,1,1 try: - with open(filen) as f: + with open(filen,encoding="utf-8") as f: for line in f.readlines(): if line[0]=="@": # Tab active_tab=Tab(line[1:-1],tab_nb) @@ -168,4 +184,7 @@ if __name__ == '__main__': print(filen,"was not found") return root root=parse(filen) - print(root.content()) + with open(output,"w",encoding="utf-8") as f: + f.write(root.content()) + with open(outcss,"w",encoding="utf-8") as f: + f.write(root.css()) diff --git a/light.txt b/light.txt new file mode 100644 index 0000000..9c069a3 --- /dev/null +++ b/light.txt @@ -0,0 +1,3 @@ +@ Physique ++ Compétences de combat +- : Armes à feu