From bc7c00968216b04eed74c54a9b65cbfe25e9e511 Mon Sep 17 00:00:00 2001
From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com>
Date: Fri, 13 Dec 2024 09:39:36 +0100
Subject: [PATCH 1/2] changing some div to span to solve the phantom newlines
in copy-pasting plumed code
---
PlumedToHTML/PlumedFormatter.py | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/PlumedToHTML/PlumedFormatter.py b/PlumedToHTML/PlumedFormatter.py
index 765bcb4..792872f 100644
--- a/PlumedToHTML/PlumedFormatter.py
+++ b/PlumedToHTML/PlumedFormatter.py
@@ -70,7 +70,7 @@ def format(self, tokensource, outfile):
outfile.write('__FILL__')
# This is for vim syntax expression
elif "vim:" in value :
- outfile.write('
')
+ outfile.write('' + value + 'Enables syntax highlighting for PLUMED files in vim. See here for more details. ')
else : raise ValueError("found invalid Literal in input " + value)
elif ttype==Comment.Hashbang :
# This handles the mechanism for closing the expanding shortcut
@@ -185,7 +185,7 @@ def format(self, tokensource, outfile):
else :
select = inp.strip()
if select in self.keyword_dict["groups"] : tooltip, link = self.keyword_dict["groups"][select]["description"], self.keyword_dict["groups"][select]["link"]
- if len(tooltip)>0 : outfile.write('')
+ if len(tooltip)>0 : outfile.write('' + inp + '' + tooltip + '. Click here for more information. ')
else : outfile.write( html.escape(inp) )
else : outfile.write( html.escape(inp) )
nocomma = False
@@ -238,15 +238,15 @@ def format(self, tokensource, outfile):
if "actionlink" in self.keyword_dict[action]["syntax"][mykey].keys() and self.keyword_dict[action]["syntax"][mykey]["actionlink"]!="none" :
linkaction = self.keyword_dict[action]["syntax"][mykey]["actionlink"]
desc = desc + ". Options for this keyword are explained in the documentation for " + linkaction + ".";
- outfile.write('')
+ outfile.write('' + value + '' + desc + '')
elif ttype==Name.Constant :
# @replicas in special replica syntax
if value=="@replicas:" :
- outfile.write('')
+ outfile.write('' + value + 'This keyword specifies that different replicas have different values for this quantity. See here for more details.')
# Deal with external libraries doing atom selections
else :
if value not in self.keyword_dict["groups"] : raise Exception("special group " + value + " not in special group dictionary")
- outfile.write('');
+ outfile.write('' + value + '' + self.keyword_dict["groups"][value]["description"] + '. Click here for more information. ');
elif ttype==Keyword :
# Name of action
action, notooltips = value.strip().upper(), False
@@ -259,20 +259,20 @@ def format(self, tokensource, outfile):
if default_state!=0 or shortcut_state==1 :
if label!="" and label!=act_label : raise Exception("mismatched label and act_label for shortcut/default")
if notooltips :
- outfile.write('')
+ outfile.write('' + value.strip() + 'This action is not part of PLUMED and was included by using a LOAD command More details')
elif shortcut_state==1 and default_state==1 :
- outfile.write('')
+ outfile.write('' + value.strip() + '' + self.keyword_dict[action]["description"] + ' This action is a shortcut and it has hidden defaults. More details')
elif shortcut_state==1 and default_state==2 :
- outfile.write('')
+ outfile.write('' + value.strip() + '' + self.keyword_dict[action]["description"] + ' This action is a shortcut and uses the defaults shown here. More details')
elif default_state==1 :
- outfile.write('')
+ outfile.write('' + value.strip() + '' + self.keyword_dict[action]["description"] + ' This action has hidden defaults. More details')
elif default_state==2 :
- outfile.write('')
+ outfile.write('' + value.strip() + '' + self.keyword_dict[action]["description"] + ' This action uses the defaults shown here. More details')
elif shortcut_state==1 :
- if action=="INCLUDE" : outfile.write('')
- else : outfile.write('')
+ if action=="INCLUDE" : outfile.write('' + value.strip() + '' + self.keyword_dict[action]["description"] + ' More details. Show included file')
+ else : outfile.write('' + value.strip() + '' + self.keyword_dict[action]["description"] + ' This action is a shortcut. More details')
else :
- outfile.write('')
+ outfile.write('' + value.strip() + ''+ self.keyword_dict[action]["description"] + ' More details')
# Check if there is stuff to output for the last action in the file
if len(label)>0 and label not in all_labels and label not in self.valuedict.keys() :
all_labels.add( label )
From aed3d6975e016643c9397d218d4e06e6da29fcbe Mon Sep 17 00:00:00 2001
From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com>
Date: Fri, 13 Dec 2024 17:32:52 +0100
Subject: [PATCH 2/2] corrected wrong span rewriting
---
PlumedToHTML/PlumedFormatter.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/PlumedToHTML/PlumedFormatter.py b/PlumedToHTML/PlumedFormatter.py
index 792872f..30ce692 100644
--- a/PlumedToHTML/PlumedFormatter.py
+++ b/PlumedToHTML/PlumedFormatter.py
@@ -238,11 +238,11 @@ def format(self, tokensource, outfile):
if "actionlink" in self.keyword_dict[action]["syntax"][mykey].keys() and self.keyword_dict[action]["syntax"][mykey]["actionlink"]!="none" :
linkaction = self.keyword_dict[action]["syntax"][mykey]["actionlink"]
desc = desc + ". Options for this keyword are explained in the documentation for " + linkaction + ".";
- outfile.write('' + value + '' + desc + '')
+ outfile.write('' + value + '' + desc + '')
elif ttype==Name.Constant :
# @replicas in special replica syntax
if value=="@replicas:" :
- outfile.write('' + value + 'This keyword specifies that different replicas have different values for this quantity. See here for more details.')
+ outfile.write('' + value + 'This keyword specifies that different replicas have different values for this quantity. See here for more details.')
# Deal with external libraries doing atom selections
else :
if value not in self.keyword_dict["groups"] : raise Exception("special group " + value + " not in special group dictionary")