Skip to content

Commit

Permalink
Fixed issue that appears when round brackets are used around keyword …
Browse files Browse the repository at this point in the history
…entry
  • Loading branch information
Gareth Aneurin Tribello committed Jun 25, 2024
1 parent 2fe5b14 commit 80c421e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion PlumedToHTML/PlumedLexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class PlumedLexer(RegexLexer):
(r'(\w+)(=)(@\S+:)((?s)\{.*?\})', bygroups(Name.Attribute, Text, Name.Constant, Generic)),
# Find special replica syntax without brackets
(r'(\w+)(=)(@\S+:)(\S+\b)', bygroups(Name.Attribute, Text, Name.Constant, Generic)),
# Find KEYWORD with brackets around value
# Find KEYWORD with {} brackets around value
(r'(\w+)(=)((?s)\{.*?\})', bygroups(Name.Attribute, Text, Generic)),
# Find KEYWORD with () brackets around value
(r'(\w+)(=)((?s)\(.*?\))', bygroups(Name.Attribute, Text, Generic)),
# Find KEYWORD=whatever
(r'(\w+)(=)(\S+\b)', bygroups(Name.Attribute, Text, Generic))
],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name='PlumedToHTML',
version='0.71',
version='0.72',
author="Gareth Tribello",
author_email="[email protected]",
description="A package for creating pretified HTML for PLUMED files",
Expand Down
4 changes: 4 additions & 0 deletions tdata/lexertests.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
{
"input": "# This is a comment \n phi: TORSION ATOMS=1,2,3,4 # This is also a comment with : a colon",
"output": "<div class=\"highlight\"><pre><span></span><span class=\"c\"># This is a comment </span>\n <span class=\"s\">phi</span>: <span class=\"k\">TORSION</span> <span class=\"na\">ATOMS</span>=<span class=\"g\">1,2,3,4</span> <span class=\"c\"># This is also a comment with : a colon</span>\n</pre></div>\n"
},
{
"input": "st_saxs: STATS ARG=(SAXS\\.q-.*) PARARG=(SAXS\\.exp-.*)",
"output": "<div class=\"highlight\"><pre><span></span><span class=\"s\">st_saxs</span>: <span class=\"k\">STATS</span> <span class=\"na\">ARG</span>=<span class=\"g\">(SAXS\\.q-.*)</span> <span class=\"na\">PARARG</span>=<span class=\"g\">(SAXS\\.exp-.*)</span>\n</pre></div>\n"
}
]
}

0 comments on commit 80c421e

Please sign in to comment.