diff --git a/PlumedToHTML/PlumedFormatter.py b/PlumedToHTML/PlumedFormatter.py index 4f45a72..ea90352 100644 --- a/PlumedToHTML/PlumedFormatter.py +++ b/PlumedToHTML/PlumedFormatter.py @@ -166,6 +166,7 @@ def format(self, tokensource, outfile): outfile.write('') # Deal with atom selections elif "@" in inp : + tooltip, link = "", "" # Deal with residue if "-" in inp : select, defs, residue = "", inp.split("-"), "" @@ -178,9 +179,9 @@ def format(self, tokensource, outfile): else : tooltip, link = self.keyword_dict["groups"][select]["description"] + " " + residue, self.keyword_dict["groups"][select]["link"] else : select = inp.strip() - if select not in self.keyword_dict["groups"] : raise Exception("special group " + select + " not in special group dictionary") - tooltip, link = self.keyword_dict["groups"][select]["description"], self.keyword_dict["groups"][select]["link"] - outfile.write('
' + inp + '
' + tooltip + '. Click here for more information.
') + if select in self.keyword_dict["groups"] : tooltip, link = self.keyword_dict["groups"][select]["description"], self.keyword_dict["groups"][select]["link"] + if len(tooltip)>0 : outfile.write('
' + inp + '
' + tooltip + '. Click here for more information.
') + else : outfile.write( html.escape(inp) ) else : outfile.write( html.escape(inp) ) nocomma = False elif ttype==String or ttype==String.Double : diff --git a/setup.py b/setup.py index 0da33e7..408d2a8 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name='PlumedToHTML', - version='0.96', + version='0.97', author="Gareth Tribello", author_email="gareth.tribello@gmail.com", description="A package for creating pretified HTML for PLUMED files", diff --git a/tdata/groups.dat b/tdata/groups.dat new file mode 100644 index 0000000..20459e2 --- /dev/null +++ b/tdata/groups.dat @@ -0,0 +1,20 @@ +groupa: GROUP ... + ATOMS={ + 10 + 50 + 60 + 70 + 80 + 120 + } +... +groupb: GROUP ... + ATOMS={ + 11 + 51 + 61 + 71 + 81 + 121 + } +... diff --git a/tdata/tests.json b/tdata/tests.json index 0e144da..cc7effb 100644 --- a/tdata/tests.json +++ b/tdata/tests.json @@ -158,9 +158,16 @@ "tooltips": ["DEBUG", "logRequestedAtoms", "STRIDE"], "badges": ["pass"] }, + { + "input": "INCLUDE FILE=tdata/groups.dat", + "index": 25, + "actions": ["INCLUDE", "GROUP"], + "tooltips": ["INCLUDE", "FILE", "GROUP", "ATOMS", "GROUP", "ATOMS"], + "badges": ["pass"] + }, { "input": "#SETTINGS NREPLICAS=2\n t: TORSION ATOMS=1,2,3,4\n INCLUDE FILE=tdata/other.inc", - "index": 24, + "index": 25, "actions": ["TORSION", "INCLUDE", "RESTRAINT", "RESTRAINT"], "tooltips": ["TORSION", "ATOMS", "INCLUDE", "FILE", "RESTRAINT", "ARG", "AT", "KAPPA", "RESTRAINT", "ARG", "AT", "KAPPA"], "badges": ["pass"]