Skip to content

Commit b70f221

Browse files
Gareth Aneurin TribelloGareth Aneurin Tribello
authored andcommitted
Bug fix to deal with cases where line numbers don't exists in files that are being displayed in modals
1 parent 9866360 commit b70f221

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

PlumedToHTML/PlumedFormatter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ def format(self, tokensource, outfile):
147147
for n, l in enumerate(self.auxinputlines) :
148148
bounds = l.split("-")
149149
start, end = int( bounds[0] ), int( bounds[1] )
150+
if start>len(allines) : break
150151
if n>0 : shortversion += "...\n"
151-
for kk in range(start,end+1) : shortversion += allines[kk-1] + "\n"
152+
for kk in range(start,end+1) :
153+
if kk<=len(allines) : shortversion += allines[kk-1] + "\n"
152154
fcontent = shortversion
153155
outfile.write('<div class="tooltip">' + inp + '<div class="right"> Click <a onclick=\'openModal("' + self.egname + inp + str(nfiles) + '")\'>here</a> to see an extract from this file.<i></i></div></div>')
154156
outfile.write('<div id="' + self.egname + inp + str(nfiles) + '" class="modal">')

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.91',
9+
version='0.92',
1010
author="Gareth Tribello",
1111
author_email="[email protected]",
1212
description="A package for creating pretified HTML for PLUMED files",

0 commit comments

Comments
 (0)