Nested snippets with conditions - is there a bug? WORKROUND
Posted: Fri Aug 11, 2017 1:23 pm
I can't remember clearly, but I seem to remember someone mentioning that if you have a snippet that contains conditions, include that snippet inside another snippet, and then apply conditions to the OUTER snippet, that the conditions don't "stick".
I have a set of conditions and in one set I have PrintOnly and ScreenOnly, and in the other set I have products, e.g. ProductA, ProductB and ProductC.
My INNER snippet is used in quite a few places, and has the following conditions: ProductA PrintOnly, ProductB ScreenOnly, ProductB PrintOnly, ProductB ScreenOnly, ProductC PrintOnly, ProductC ScreenOnly.
I added the inner snippet to the OUTER snippet and didn't apply any snippet conditions there, as the OUTER snippet is used in a few places too.
When I added the outer snippet to a topic for use in Product C, I applied snippet conditions to it to Include ProductC and exclude ProductA and ProductB. Then when generating my Print and Screen outputs I put the PrintOnly and ScreenOnly conditions on the target.
As I see it, if I'm generating a Screen target for ProductC I should be able to apply Include ScreenOnly and Exclude PrintOnly and it should work. Just to make certain I applied advanced snippet conditions to also exclude ProdB and Print, Prod B and Screen, Prod A and Print and Prod A and Screen. But for some reason all three ScreenOnly bits from the inner snippet are included in the output.
Any suggestions? Is this a bug, or have I made things too complicated and missed something?
Update: I converted the inner snippet to text in the outer snippet and that resolved the problem, so that seems to confirm that conditions applied to an outer snippet don't affect an inner snippet. Meh, not happy with that, so I'll just have to report it.
I have a set of conditions and in one set I have PrintOnly and ScreenOnly, and in the other set I have products, e.g. ProductA, ProductB and ProductC.
My INNER snippet is used in quite a few places, and has the following conditions: ProductA PrintOnly, ProductB ScreenOnly, ProductB PrintOnly, ProductB ScreenOnly, ProductC PrintOnly, ProductC ScreenOnly.
I added the inner snippet to the OUTER snippet and didn't apply any snippet conditions there, as the OUTER snippet is used in a few places too.
When I added the outer snippet to a topic for use in Product C, I applied snippet conditions to it to Include ProductC and exclude ProductA and ProductB. Then when generating my Print and Screen outputs I put the PrintOnly and ScreenOnly conditions on the target.
As I see it, if I'm generating a Screen target for ProductC I should be able to apply Include ScreenOnly and Exclude PrintOnly and it should work. Just to make certain I applied advanced snippet conditions to also exclude ProdB and Print, Prod B and Screen, Prod A and Print and Prod A and Screen. But for some reason all three ScreenOnly bits from the inner snippet are included in the output.
Any suggestions? Is this a bug, or have I made things too complicated and missed something?
Update: I converted the inner snippet to text in the outer snippet and that resolved the problem, so that seems to confirm that conditions applied to an outer snippet don't affect an inner snippet. Meh, not happy with that, so I'll just have to report it.