diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js index 2320d24..0516abd 100644 --- a/vasl_templates/webapp/static/snippets.js +++ b/vasl_templates/webapp/static/snippets.js @@ -435,6 +435,9 @@ function make_snippet( $btn, params, extra_params, show_date_warnings ) snippet = strReplaceAll( snippet, "{{USER_FILES}}", APP_URL_BASE+"/user" ) ; snippet = strReplaceAll( snippet, "{{CHAPTER_H}}", APP_URL_BASE+"/chapter-h" ) ; + // tidy up the final snippet + snippet = snippet.replace( /[^\S\r\n]+$/gm, "" ) ; // nb: trim trailing whitespace + return { content: snippet, template_id: template_id, diff --git a/vasl_templates/webapp/tests/test_extras_templates.py b/vasl_templates/webapp/tests/test_extras_templates.py index 7706be9..6305ee1 100644 --- a/vasl_templates/webapp/tests/test_extras_templates.py +++ b/vasl_templates/webapp/tests/test_extras_templates.py @@ -153,7 +153,7 @@ def test_edit_extras_template( webapp, webdriver ): # generate the template (we should still be using the old template) snippet_btn = find_child( "button.generate", content ) snippet_btn.click() - wait_for_clipboard( 2, "param = ", contains=True ) + wait_for_clipboard( 2, "param =", contains=True ) # switch to another template, then back again _select_extras_template( webdriver, "extras/full" ) @@ -170,7 +170,7 @@ def test_edit_extras_template( webapp, webdriver ): # generate the template (we should be using the new template) snippet_btn = find_child( "button.generate", content ) snippet_btn.click() - wait_for_clipboard( 2, "added = added-val\nparam = ", contains=True ) + wait_for_clipboard( 2, "added = added-val\nparam =", contains=True ) # ---------------------------------------------------------------------