Skip to content

Commit 2e230e3

Browse files
Gareth Aneurin TribelloGareth Aneurin Tribello
authored andcommitted
Fixed bug in dealing with mda syntax
1 parent 8d0978c commit 2e230e3

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

PlumedToHTML/PlumedFormatter.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def format(self, tokensource, outfile):
166166
outfile.write('</div>')
167167
# Deal with atom selections
168168
elif "@" in inp :
169+
tooltip, link = "", ""
169170
# Deal with residue
170171
if "-" in inp :
171172
select, defs, residue = "", inp.split("-"), ""
@@ -178,9 +179,9 @@ def format(self, tokensource, outfile):
178179
else : tooltip, link = self.keyword_dict["groups"][select]["description"] + " " + residue, self.keyword_dict["groups"][select]["link"]
179180
else :
180181
select = inp.strip()
181-
if select not in self.keyword_dict["groups"] : raise Exception("special group " + select + " not in special group dictionary")
182-
tooltip, link = self.keyword_dict["groups"][select]["description"], self.keyword_dict["groups"][select]["link"]
183-
outfile.write('<div class="tooltip">' + inp + '<div class="right">' + tooltip + '. <a href="' + link + '">Click here</a> for more information. <i></i></div></div>')
182+
if select in self.keyword_dict["groups"] : tooltip, link = self.keyword_dict["groups"][select]["description"], self.keyword_dict["groups"][select]["link"]
183+
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>')
184+
else : outfile.write( html.escape(inp) )
184185
else : outfile.write( html.escape(inp) )
185186
nocomma = False
186187
elif ttype==String or ttype==String.Double :

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setuptools.setup(
88
name='PlumedToHTML',
9-
version='0.96',
9+
version='0.97',
1010
author="Gareth Tribello",
1111
author_email="[email protected]",
1212
description="A package for creating pretified HTML for PLUMED files",

tdata/groups.dat

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
groupa: GROUP ...
2+
ATOMS={
3+
10
4+
50
5+
60
6+
70
7+
80
8+
120
9+
}
10+
...
11+
groupb: GROUP ...
12+
ATOMS={
13+
11
14+
51
15+
61
16+
71
17+
81
18+
121
19+
}
20+
...

tdata/tests.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,16 @@
158158
"tooltips": ["DEBUG", "logRequestedAtoms", "STRIDE"],
159159
"badges": ["pass"]
160160
},
161+
{
162+
"input": "INCLUDE FILE=tdata/groups.dat",
163+
"index": 25,
164+
"actions": ["INCLUDE", "GROUP"],
165+
"tooltips": ["INCLUDE", "FILE", "GROUP", "ATOMS", "GROUP", "ATOMS"],
166+
"badges": ["pass"]
167+
},
161168
{
162169
"input": "#SETTINGS NREPLICAS=2\n t: TORSION ATOMS=1,2,3,4\n INCLUDE FILE=tdata/other.inc",
163-
"index": 24,
170+
"index": 25,
164171
"actions": ["TORSION", "INCLUDE", "RESTRAINT", "RESTRAINT"],
165172
"tooltips": ["TORSION", "ATOMS", "INCLUDE", "FILE", "RESTRAINT", "ARG", "AT", "KAPPA", "RESTRAINT", "ARG", "AT", "KAPPA"],
166173
"badges": ["pass"]

0 commit comments

Comments
 (0)