@@ -63,7 +63,7 @@ def test_and_get_html( inpt, name, actions=set({}) ) :
6363
6464 return html
6565
66- def test_plumed ( executible , filename , header = [], printjson = False , jsondir = "./" , cmdTimeout :"None|float" = None ) :
66+ def test_plumed ( executible , filename , header = [], printjson = False , jsondir = "./" , cmdTimeout :"None|float" = None , ghmarkdown = True ) :
6767 """
6868 Test if plumed can parse this input file
6969
@@ -119,7 +119,8 @@ def test_plumed( executible, filename, header=[], printjson=False, jsondir="./",
119119 if len (header )> 0 : print (header ,file = stderr )
120120 print ("Stderr for source: " ,re .sub ("^data/" ,"" ,filename )," " ,file = stderr )
121121 print ("Download: [zipped raw stdout](" + plumed_file + "." + executible + ".stdout.txt.zip) - [zipped raw stderr](" + plumed_file + "." + executible + ".stderr.txt.zip) " ,file = stderr )
122- print ("{% raw %}\n <pre>" ,file = stderr )
122+ if ghmarkdown : print ("{% raw %}\n <pre>" ,file = stderr )
123+ else : print ("<pre>" ,file = stderr )
123124 # now we print the first 1000 lines of errtxtfile to errfile
124125 with open (errtxtfile , "r" ) as stdtxterr :
125126 # line counter
@@ -136,7 +137,8 @@ def test_plumed( executible, filename, header=[], printjson=False, jsondir="./",
136137 # print line to stderr
137138 print (line .strip (), file = stderr )
138139 # close stderr
139- print ("</pre>\n {% endraw %}" ,file = stderr )
140+ if ghmarkdown : print ("</pre>\n {% endraw %}" ,file = stderr )
141+ else : print ("</pre>\n " ,file = stderr )
140142 # compress both outfile and errtxtfile
141143 zip (outfile )
142144 zip (errtxtfile )
@@ -164,7 +166,7 @@ def manage_incomplete_inputs( inpt ) :
164166 return complete , incomplete
165167 return inpt , ""
166168
167- def get_html ( inpt , name , outloc , tested , broken , plumedexe , usejson = None , maxchecks = None , actions = set ({}) ) :
169+ def get_html ( inpt , name , outloc , tested , broken , plumedexe , usejson = None , maxchecks = None , actions = set ({}), ghmarkdown = True ) :
168170 """
169171 Generate the html representation of a PLUMED input file
170172
@@ -265,7 +267,10 @@ def get_html( inpt, name, outloc, tested, broken, plumedexe, usejson=None, maxch
265267 for i in range (len (tested )) :
266268 btype = 'passing-green.svg'
267269 if broken [i ] : btype = 'failed-red.svg'
268- html += '<tr><td style="padding:1px"><a href="' + outloc + '.' + plumedexe [i ] + '.stderr"><img src=\" https://img.shields.io/badge/' + tested [i ] + '-' + btype + '" alt="tested on' + tested [i ] + '" /></a></td></tr>'
270+ html += '<tr><td style="padding:1px">'
271+ if ghmarkdown : html += '<a href="' + outloc + '.' + plumedexe [i ] + '.stderr">'
272+ else : html += '<a href="../' + outloc + '.' + plumedexe [i ] + '.stderr">'
273+ html += '<img src=\" https://img.shields.io/badge/' + tested [i ] + '-' + btype + '" alt="tested on' + tested [i ] + '" /></a></td></tr>'
269274 if found_load :
270275 html += '<tr><td style="padding:1px"><img src=\" https://img.shields.io/badge/with-LOAD-yellow.svg" alt="tested on master" /></td></tr>\n '
271276 if len (incomplete )> 0 :
@@ -622,12 +627,12 @@ def processMarkdownString( inp, filename, plumedexe, plumed_names, actions, dirn
622627 # PlumedToHTML finds them when we do get_html (i.e. these will be in
623628 # the data directory where the calculation is run)
624629 if incomplete :
625- success [i ]= test_plumed (plumedexe [i ], solutionfile )
630+ success [i ]= test_plumed (plumedexe [i ], solutionfile , ghmarkdown = ghmarkdown )
626631 else :
627632 success [i ]= test_plumed (plumedexe [i ], solutionfile ,
628- printjson = True , jsondir = jsondir )
633+ printjson = True , jsondir = jsondir , ghmarkdown = ghmarkdown )
629634 else :
630- success [i ]= test_plumed ( plumedexe [i ], solutionfile )
635+ success [i ]= test_plumed ( plumedexe [i ], solutionfile , ghmarkdown = ghmarkdown )
631636 if (success [i ]!= 0 and success [i ]!= "custom" ) : nfail [i ] = nfail [i ] + 1
632637 # Use PlumedToHTML to create the input with all the bells and whistles
633638 html = get_html (plumed_inp ,
@@ -637,7 +642,8 @@ def processMarkdownString( inp, filename, plumedexe, plumed_names, actions, dirn
637642 success ,
638643 plumedexe ,
639644 usejson = (not success [- 1 ]),
640- actions = actions )
645+ actions = actions ,
646+ ghmarkdown = ghmarkdown )
641647 # Print the html for the solution
642648 if ghmarkdown : ofile .write ( "{% raw %}\n " + html + "\n {% endraw %} \n " )
643649 else : ofile .write ( html )
0 commit comments