Rock
Rock copied to clipboard
Merge Templates use wrong Lava RegEx
Prerequisites
- [x] Put an X between the brackets on this line if you have done all of the following:
- Can you reproduce the problem on a fresh install or the [http://rock.rocksolidchurchdemo.com/ demo site ]()?
- Did you include your Rock version number and [https://github.com/SparkDevNetwork/Rock/wiki/Environment-and-Diagnostics-Information client culture ]() setting?
- Did you [https://github.com/issues?q=is%3Aissue+user%3ASparkDevNetwork+-repo%3ASparkDevNetwork%2FSlack perform a cursory search ]() to see if your bug or enhancement is already reported?
Description
When using Lava in a word merge template, if you try to use formatting like this:
{% for x in items %}{{ x.Name }}
{% endfor %}{% next %}
You will get a Lava error. Notice the line feed, it is intentional. We were trying to generate a name tag that has a list of strings, one per line underneath the name. This worked except for the last name tag on the sheet. Debugging I found that the XML parser was splitting the above into 2 XML nodes (because of the line break).
First node was {% for x in items %}{{ x.Name }}
, second node was {% endfor %}{% next %}
. When parsing the document the WordDocumentMergeTemplateType code looks for the last node with Lava and appends {% next %}
if it is not contained in the node. Since the search is done for {{ }}
style Lava, it finds the first node and appends {% next %}
to it.
Later in the code the text is split by {% next %}
and the lava is executed, causing a for tag not closed
Lava error.
Current work around is to put {{ '' }}
after the new line so it detects that node as Lava.
Steps to Reproduce
See above.
Expected behavior:
It should match the {% %}
style Lava as well as {{ }}
.
Actual behavior:
It doesn't. Current work around
Versions
- Rock Version: 6.3
- Client Culture Setting: en-US
I can confirm that this is still an issue in 2021 :) (version 12.3)
After looking into this we don't see a way of supporting Lava that spans a Word document node. Perhaps in the future...?