diff options
author | Håkon Hallingstad <hakon@yahooinc.com> | 2022-01-10 09:22:59 +0100 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahooinc.com> | 2022-01-10 09:22:59 +0100 |
commit | 137a169f65a79773a3f5a09ca27234f0e2fcfe2c (patch) | |
tree | c7d4841cd0bf10faa6bda7602023565b48d89200 /node-admin | |
parent | 96ff49a50ce0569e9b7664c9ed3fb87d7e72cf17 (diff) |
Unsupport comments
Diffstat (limited to 'node-admin')
4 files changed, 2 insertions, 33 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/Template.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/Template.java index 69fd84fd008..a603ee586c5 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/Template.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/Template.java @@ -16,17 +16,15 @@ import java.util.function.Consumer; * * <pre> * template: section* - * section: literal | variable | list | line-comment + * section: literal | variable | list * literal: plain text not containing %{ * variable: %{=identifier} * list: %{list identifier}template%{end} - * line-comment: %{#} * identifier: a valid Java identifier * </pre> * * <p>If the directive's end delimiter (}) is preceded by a "|" char, then any newline (\n) - * following the end delimiter is removed. Or in the case of line-comment: the newline terminating - * the line comment is removed.</p> + * following the end delimiter is removed.</p> * * <p>To use the template, <b>Instantiate</b> it to get a form ({@link #instantiate()}), fill it (e.g. * {@link Form#set(String, String) Form.set()}), and render the String ({@link Form#render()}).</p> @@ -82,10 +80,6 @@ public class Template { sections.add(formBuilder -> formBuilder.addListSection(range, name, body)); } - void appendCommentSection(Cursor end) { - verifyAndUpdateEnd(end); - } - private CursorRange range() { return new CursorRange(start, end); } private CursorRange verifyAndUpdateEnd(Cursor newEnd) { diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateDescriptor.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateDescriptor.java index 568ed20aafb..b585a1f414b 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateDescriptor.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateDescriptor.java @@ -9,7 +9,6 @@ package com.yahoo.vespa.hosted.node.admin.task.util.template; public class TemplateDescriptor { private static final char VARIABLE_DIRECTIVE_CHAR = '='; private static final char REMOVE_NEWLINE_CHAR = '|'; - private static final char COMMENT_CHAR = '#'; private String startDelimiter = "%{"; private String endDelimiter = "}"; @@ -33,5 +32,4 @@ public class TemplateDescriptor { char variableDirectiveChar() { return VARIABLE_DIRECTIVE_CHAR; } char removeNewlineChar() { return REMOVE_NEWLINE_CHAR; } - char commentChar() { return COMMENT_CHAR; } } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateParser.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateParser.java index 4c74e8553b9..ae0d6464b06 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateParser.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateParser.java @@ -68,8 +68,6 @@ class TemplateParser { if (current.skip(descriptor.variableDirectiveChar())) { parseVariableSection(); - } else if (current.skip(descriptor.commentChar())) { - parseCommentSection(startOfDirective); } else { var startOfType = new Cursor(current); String type = skipId().orElseThrow(() -> new BadTemplateException(current, "Missing section name")); @@ -98,16 +96,6 @@ class TemplateParser { template.appendVariableSection(name, nameStart, current); } - private void parseCommentSection(Cursor startOfDirective) { - if (parseEndDelimiter(false)) { - current.advancePast('\n'); - } else { - current.advanceTo('\n'); - } - - template.appendCommentSection(current); - } - private void parseEndDirective() { parseEndDelimiter(true); } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateFileTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateFileTest.java index be73caf9d1d..db3e487910a 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateFileTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateFileTest.java @@ -83,17 +83,6 @@ class TemplateFileTest { form.render()); } - @Test - void verifyComment() { - assertEquals("first\n" + - "second\n" + - "third and still third\n", - makeForm("first\n" + - "second%{#} rest of line is ignored\n" + - "third%{#|} this line continues on the next\n" + - " and still third\n").render()); - } - private Form getForm(String filename) { return TemplateFile.read(Path.of("src/test/resources/" + filename)).instantiate(); } |