Skip to content

Commit

Permalink
Sitemap editor: Trim spaces from color value (#2091)
Browse files Browse the repository at this point in the history
When generating the sitemap DSL from a UI configured sitemap with color
conditions, if the color in the condition has a leading space, it will
be included in the color string.
While this does not have an impact on the sitemap functionality (it
works), it is an issue if one would copy this sitemap to a sitemap file.
This PR strips the blanks from the color.

See #2082 and the example provided there.

Signed-off-by: Mark Herwege <[email protected]>
  • Loading branch information
mherwege authored Sep 25, 2023
1 parent 881a8b7 commit 35c3ae0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function writeWidget (widget, indent) {
dsl += '['
dsl += widget.config[key].filter(Boolean).map(color => {
let index = color.lastIndexOf('=') + 1
let colorvalue = color.substring(index)
let colorvalue = color.substring(index).trim()
if (!/^(".*")|('.*')$/.test(colorvalue)) {
colorvalue = '"' + colorvalue + '"'
}
Expand Down

0 comments on commit 35c3ae0

Please sign in to comment.