diff --git a/PlumedToHTML/PlumedFormatter.py b/PlumedToHTML/PlumedFormatter.py index 504a359..7d5035a 100644 --- a/PlumedToHTML/PlumedFormatter.py +++ b/PlumedToHTML/PlumedFormatter.py @@ -18,6 +18,7 @@ def __init__(self, **options) : self.hasload=options["hasload"] self.broken=options["broken"] self.auxinputs=options["auxinputs"] + self.auxinputlines=options["auxinputlines"] self.valuedict=options["valuedict"] self.actions=options["actions"] self.valcolors = { @@ -140,13 +141,13 @@ def format(self, tokensource, outfile): iff = open( inp, 'r' ) fcontent = iff.read() iff.close() - if len(fcontent.splitlines())>5 : - n, shortversion = 0, "" - for l in fcontent.splitlines() : - shortversion += l + "\n" - n = n + 1 - if n==5 : break - shortversion += "...\n" + fcontent.splitlines()[-1] + if len(self.auxinputlines)>0 : + shortversion, allines = "", fcontent.splitlines() + for n, l in enumerate(self.auxinputlines) : + bounds = l.split("-") + start, end = int( bounds[0] ), int( bounds[1] ) + if n>0 : shortversion += "...\n" + for kk in range(start,end+1) : shortversion += allines[kk-1] + "\n" fcontent = shortversion outfile.write('
' + inp + '
Click here to see an extract from this file.
') outfile.write('