Skip to content

Commit

Permalink
Fixed bug in dealing with mda syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Nov 12, 2024
1 parent 8d0978c commit 2e230e3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
7 changes: 4 additions & 3 deletions PlumedToHTML/PlumedFormatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def format(self, tokensource, outfile):
outfile.write('</div>')
# Deal with atom selections
elif "@" in inp :
tooltip, link = "", ""
# Deal with residue
if "-" in inp :
select, defs, residue = "", inp.split("-"), ""
Expand All @@ -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('<div class="tooltip">' + inp + '<div class="right">' + tooltip + '. <a href="' + link + '">Click here</a> for more information. <i></i></div></div>')
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('<div class="tooltip">' + inp + '<div class="right">' + tooltip + '. <a href="' + link + '">Click here</a> for more information. <i></i></div></div>')
else : outfile.write( html.escape(inp) )
else : outfile.write( html.escape(inp) )
nocomma = False
elif ttype==String or ttype==String.Double :
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name='PlumedToHTML',
version='0.96',
version='0.97',
author="Gareth Tribello",
author_email="[email protected]",
description="A package for creating pretified HTML for PLUMED files",
Expand Down
20 changes: 20 additions & 0 deletions tdata/groups.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
groupa: GROUP ...
ATOMS={
10
50
60
70
80
120
}
...
groupb: GROUP ...
ATOMS={
11
51
61
71
81
121
}
...
9 changes: 8 additions & 1 deletion tdata/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 2e230e3

Please sign in to comment.