Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline Verbatim Syntax #422

Open
nward-terafuze opened this issue Jan 14, 2019 · 3 comments
Open

Inline Verbatim Syntax #422

nward-terafuze opened this issue Jan 14, 2019 · 3 comments

Comments

@nward-terafuze
Copy link

I suggest adding a note to the documentation for the Verbatim tag to point out that a string literal can be used for inline verbatim text. I found that Pebble works the same as the popular Jinja2 Python template engine in this regard. However, the documentation for Jinja2 addresses inline verbatim text (referred to as inline raw text in Jinja2), but Pebble docs doesn't. I actually assumed that I had to use the verbatim tag inline, which looked terrible and only realized that I could do the same as in Jinja2 when I was about to post an enhancement request here.

For example, I am need to include {{ in the output of a template with text before and after it on the same line. I found that I could do the following in Pebble...

     {{ "{{" }}

However, I made several templates where I didn't know that I could do this and so I did the following...

    {% verbatim %}{{{% endverbatim %}

With other text on the line before and after it, which looked terrible.

Nathan

@ebussieres
Copy link
Member

You can contribute and submit a pull request for that. All documentation are in docs module

https://github.com/PebbleTemplates/pebble/tree/master/docs/src/orchid/resources/wiki

@nward-terafuze
Copy link
Author

I will do that sometime soon. Might be a couple of weeks, but I'll get to it.

nward1234 added a commit to nward1234/pebble that referenced this issue Sep 1, 2019
ebussieres pushed a commit that referenced this issue Oct 19, 2019
* #422: Added inline verbatim description to Verbatim tag documentation

* Added tests for whitespace control for templates when New Line Trimming is enabled. Also added assertj and commons-io Maven dependencies for use in the tests. Commons IO is used to compare template output to expected output that is loaded from a file. Loading the expected template output from a file is useful for testing multiline template output, which is necessary to test various scenarios. These are a form of Integration Test rather than Unit Tests and so it is practical and reasonable to verify the template output in this way.

* Added javadoc to describe the purpose of several existing tests and changed the test method names in some cases to make the purpose of each test method more clear.

* Added a 3rd elseif in the template for the For Loop with Nested If Statement Thatis Skipped test

* Added tests with 2 ifelse in a nested if and also 3 ifelse in a nested if.

* Added test of Nested If with One ifelse statement

* Improved and added additional whitespace control tests.
ebussieres pushed a commit that referenced this issue Oct 21, 2019
* #422: Added inline verbatim description to Verbatim tag documentation

* Added tests for whitespace control for templates when New Line Trimming is enabled. Also added assertj and commons-io Maven dependencies for use in the tests. Commons IO is used to compare template output to expected output that is loaded from a file. Loading the expected template output from a file is useful for testing multiline template output, which is necessary to test various scenarios. These are a form of Integration Test rather than Unit Tests and so it is practical and reasonable to verify the template output in this way.

* Added javadoc to describe the purpose of several existing tests and changed the test method names in some cases to make the purpose of each test method more clear.

* Added a 3rd elseif in the template for the For Loop with Nested If Statement Thatis Skipped test

* Added tests with 2 ifelse in a nested if and also 3 ifelse in a nested if.

* Added test of Nested If with One ifelse statement

* Improved and added additional whitespace control tests.

* Changed Token.toString() implementation to include the line number, which I found useful to see in log statements.

* Added unit test and formatting standards to Contributing documentation page.

* Added a reference to the Jinja Python template engine, which I think provides more evidence that the Pebble syntax is good. Jinja is a very popular Python template engine.

* Added unit tests for the LexerImpl class. Also added log4j debug level log statements in LexerImpl, PebbleEngine and LexerImpl that were useful to me when trying to follow the code. Added logback-test.xml to configure the logging level. Disabled the debug logging by default.  Also removed Hamcrest Matchers and replaced references to Hamcrest in exception testing code with AssertJ. Also, changed the name of a few private methods in LexerImpl for improve clarity.

* Fixed minor text formatting in the summary statement at the top of the Home page.
ebussieres pushed a commit that referenced this issue Jun 7, 2020
* #422: Added inline verbatim description to Verbatim tag documentation

* Added tests for whitespace control for templates when New Line Trimming is enabled. Also added assertj and commons-io Maven dependencies for use in the tests. Commons IO is used to compare template output to expected output that is loaded from a file. Loading the expected template output from a file is useful for testing multiline template output, which is necessary to test various scenarios. These are a form of Integration Test rather than Unit Tests and so it is practical and reasonable to verify the template output in this way.

* Added javadoc to describe the purpose of several existing tests and changed the test method names in some cases to make the purpose of each test method more clear.

* Added a 3rd elseif in the template for the For Loop with Nested If Statement Thatis Skipped test

* Added tests with 2 ifelse in a nested if and also 3 ifelse in a nested if.

* Added test of Nested If with One ifelse statement

* Improved and added additional whitespace control tests.

* Changed Token.toString() implementation to include the line number, which I found useful to see in log statements.

* Added unit test and formatting standards to Contributing documentation page.

* Added a reference to the Jinja Python template engine, which I think provides more evidence that the Pebble syntax is good. Jinja is a very popular Python template engine.

* Added unit tests for the LexerImpl class. Also added log4j debug level log statements in LexerImpl, PebbleEngine and LexerImpl that were useful to me when trying to follow the code. Added logback-test.xml to configure the logging level. Disabled the debug logging by default.  Also removed Hamcrest Matchers and replaced references to Hamcrest in exception testing code with AssertJ. Also, changed the name of a few private methods in LexerImpl for improve clarity.

* Fixed minor text formatting in the summary statement at the top of the Home page.

* Changed log statements from debug level to trace level because debug statements were being output by default. Trace statements are not output unless configured to do so.
ebussieres pushed a commit that referenced this issue Jun 26, 2020
* #422: Added inline verbatim description to Verbatim tag documentation

* Added tests for whitespace control for templates when New Line Trimming is enabled. Also added assertj and commons-io Maven dependencies for use in the tests. Commons IO is used to compare template output to expected output that is loaded from a file. Loading the expected template output from a file is useful for testing multiline template output, which is necessary to test various scenarios. These are a form of Integration Test rather than Unit Tests and so it is practical and reasonable to verify the template output in this way.

* Added javadoc to describe the purpose of several existing tests and changed the test method names in some cases to make the purpose of each test method more clear.

* Added a 3rd elseif in the template for the For Loop with Nested If Statement Thatis Skipped test

* Added tests with 2 ifelse in a nested if and also 3 ifelse in a nested if.

* Added test of Nested If with One ifelse statement

* Improved and added additional whitespace control tests.

* Changed Token.toString() implementation to include the line number, which I found useful to see in log statements.

* Added unit test and formatting standards to Contributing documentation page.

* Added a reference to the Jinja Python template engine, which I think provides more evidence that the Pebble syntax is good. Jinja is a very popular Python template engine.

* Added unit tests for the LexerImpl class. Also added log4j debug level log statements in LexerImpl, PebbleEngine and LexerImpl that were useful to me when trying to follow the code. Added logback-test.xml to configure the logging level. Disabled the debug logging by default.  Also removed Hamcrest Matchers and replaced references to Hamcrest in exception testing code with AssertJ. Also, changed the name of a few private methods in LexerImpl for improve clarity.

* Fixed minor text formatting in the summary statement at the top of the Home page.

* Changed log statements from debug level to trace level because debug statements were being output by default. Trace statements are not output unless configured to do so.

* Added newline in debug statement when logging template output at debug level in PebbleTestContext used in unit tests.

* Started adding unit tests for the Syntax class in the lexer package.

* Added unit tests for Trailing Whiltespace Trim Regex defined in the Syntax class in the Lexer package.

* Tests for several regex Syntax.java in the lexer package.

* Added test for start delimiters

Co-authored-by: Nathan Ward <nathanward1234@gmail.com>
@ogrammer
Copy link
Contributor

@ebussieres Hi, pull request seems merged. Close issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants