Closed Kobus-Smit closed 5 months ago
While there are certain changes you could do with customIf plugin (eg return ThisTag or CurrentContext) the main change is to use a different repeating region. If Templater detects multiple repeating regions it will behave slightly different then when it detects multiple tables. It will process each table on its own, while with this special regions it will try to find common/parent document part for all of those regions.
So one change you need to do is instead of repeating regions use tables without borders.
But this only partly solves the problem as it seems in this case you also need to help Templater a bit with :all
metadata. In which case it will continue over other tags. I will look if this can be improved in the future not to require this all metadata, but this should get you the behavior you are expecting.
Collapse.docx
The best way to understand that is to use debugger and see what happens on each of those resize.
Thanks @zapov
I had tried all the Handled.
enums in the customIf
plugin and it did not work for me.
I modified my Collapse.docx by adding the :all
and moving the [[ucCheckResponse...
into borderless tables (similar to your attachment) and it works fine.
But adding :all
did not help with my larger template and custom plugin. Also not sure where and when I should add :all
and if I can just add it to all tags to be safe (though ugly)? (I added :all
to your Collapse.docx and it still worked fine there)
My template's tags are already in borderless tables, I toggle View Gridlines
to show it:
For example when debugging Templater-Issue-71.docx
Up to step 18 is correct (for SMB data)
But then step 19 removes the the wrong table...
Step 20 removes the correct table.
So it turns out this is due to implementation of this plugin which uses smart low level resize(string[], 0)
instead of exact low level resize(tag position[], 0)
. I will change this example implementation to use the explicit one down the line so reduce future confusion
Hi @zapov
We have a template where we conditionally show certain tables and/or list entries, using a
showIf
custom plugin. It works in a simple template, but not in a more complicated template where we useshowIf
for the sametagValue
with multipleexpression
multiple times in the document. It would correctly collapse at some places, but not at other places later in the template etc.I could reproduce our issue by running the CollapseRegion example with this template: Collapse.docx
I just modified the example's Collapse.docx by
UC check message: [[ucCheckResponse]:collapseIf(Ok)]
underApplication
and pasting it underApplicant
twiceOK UC check message: [[ucCheckResponse]:collapseIf(Not good enough)]
Expected: Collapse-Result-Expected.docx
Actual: Collapse-Result-Wrong.docx
It does work with a simpler template: Collapse-Minimal-Works.docx
Result: Collapse-Minimal-Works-Result.docx
Any ideas how I can get the first template to work by modifying the
customIf
plugin?Thanks, Kobus