@@ -214,7 +214,7 @@ def get_cltoolfile_html( inpt, name, plumedexe ) :
214214 # Setup the formatter
215215 formatfile = os .path .join (os .path .dirname (__file__ ),"PlumedFormatter.py" )
216216 valuedict , actions = {}, set ()
217- plumed_formatter = load_formatter_from_file (formatfile , "PlumedFormatter" , keyword_dict = keyword_dict ["cltools" ], input_name = name , hasload = False , broken = False , auxinputs = [], auxinputlines = [], valuedict = valuedict , actions = actions )
217+ plumed_formatter = load_formatter_from_file (formatfile , "PlumedFormatter" , keyword_dict = keyword_dict ["cltools" ], input_name = name , hasload = False , broken = False , auxinputs = [], auxinputlines = [], valuedict = valuedict , actions = actions , checkaction = "" )
218218 return highlight ( inpt , plumed_lexer , plumed_formatter )
219219
220220def get_cltoolarg_html ( inpt , name , plumedexe ) :
@@ -258,10 +258,10 @@ def get_cltoolarg_html( inpt, name, plumedexe ) :
258258 # Setup the formatter
259259 formatfile = os .path .join (os .path .dirname (__file__ ),"PlumedFormatter.py" )
260260 valuedict , actions = {}, set ()
261- plumed_formatter = load_formatter_from_file (formatfile , "PlumedFormatter" , keyword_dict = keyword_dict ["cltools" ], input_name = name , hasload = False , broken = False , auxinputs = [], auxinputlines = [], valuedict = valuedict , actions = actions )
261+ plumed_formatter = load_formatter_from_file (formatfile , "PlumedFormatter" , keyword_dict = keyword_dict ["cltools" ], input_name = name , hasload = False , broken = False , auxinputs = [], auxinputlines = [], valuedict = valuedict , actions = actions , checkaction = "" )
262262 return highlight ( inpt , plumed_lexer , plumed_formatter )
263263
264- def get_html ( inpt , name , outloc , tested , broken , plumedexe , usejson = None , maxchecks = None , actions = set ({}), ghmarkdown = True ) :
264+ def get_html ( inpt , name , outloc , tested , broken , plumedexe , usejson = None , maxchecks = None , actions = set ({}), ghmarkdown = True , checkaction = "" , checkactionkeywords = set ({}) ) :
265265 """
266266 Generate the html representation of a PLUMED input file
267267
@@ -355,7 +355,7 @@ def get_html( inpt, name, outloc, tested, broken, plumedexe, usejson=None, maxch
355355 keyword_dict = getPlumedSyntax ( plumedexe )
356356 # Setup the formatter
357357 formatfile = os .path .join (os .path .dirname (__file__ ),"PlumedFormatter.py" )
358- plumed_formatter = load_formatter_from_file (formatfile , "PlumedFormatter" , keyword_dict = keyword_dict , input_name = name , hasload = found_load , broken = any (broken ), auxinputs = inputfiles , auxinputlines = inputfilelines , valuedict = valuedict , actions = actions )
358+ plumed_formatter = load_formatter_from_file (formatfile , "PlumedFormatter" , keyword_dict = keyword_dict , input_name = name , hasload = found_load , broken = any (broken ), auxinputs = inputfiles , auxinputlines = inputfilelines , valuedict = valuedict , actions = actions , checkaction = checkaction )
359359
360360 # Now generate html of input
361361 html = '<div class="plumedpreheader">\n '
@@ -404,6 +404,13 @@ def get_html( inpt, name, outloc, tested, broken, plumedexe, usejson=None, maxch
404404 else :
405405 # html += highlight( final_inpt, plumed_lexer, HtmlFormatter() )
406406 html += highlight ( final_inpt , plumed_lexer , plumed_formatter )
407+
408+ # Now remove keywords that appear in examples
409+ mykeywords = plumed_formatter .getCheckActionKeywords ()
410+ for key in mykeywords :
411+ if key in checkactionkeywords :
412+ checkactionkeywords .remove (key )
413+
407414 # Test output is valid parsable html
408415 try :
409416 etree .parse (StringIO (html ), etree .HTMLParser (recover = False ))
@@ -669,7 +676,7 @@ def processMarkdown( filename, plumedexe, plumed_names, actions, jsondir="./", g
669676 ninputs , nfail = processMarkdownString ( inp , filename , plumedexe , plumed_names , actions , ofile , jsondir , ghmarkdown )
670677 return ninputs , nfail
671678
672- def processMarkdownString ( inp , filename , plumedexe , plumed_names , actions , ofile , jsondir = "./" , ghmarkdown = True ) :
679+ def processMarkdownString ( inp , filename , plumedexe , plumed_names , actions , ofile , jsondir = "./" , ghmarkdown = True , checkaction = "ignore" , checkactionkeywords = set ({}) ) :
673680 """
674681 Process a string of markdown that contains LUMED input files using PlumedtoHTML
675682
@@ -789,7 +796,9 @@ def processMarkdownString( inp, filename, plumedexe, plumed_names, actions, ofil
789796 plumedexe ,
790797 usejson = (not success [- 1 ]),
791798 actions = actions ,
792- ghmarkdown = ghmarkdown )
799+ ghmarkdown = ghmarkdown ,
800+ checkaction = checkaction ,
801+ checkactionkeywords = checkactionkeywords )
793802 # Print the html for the solution
794803 if ghmarkdown : ofile .write ( "{% raw %}\n " + html + "\n {% endraw %} \n " )
795804 else : ofile .write ( html )
0 commit comments