Closed sterobin closed 3 years ago
Please provide test case. I thought I had conditionals figured out.
As discussed in chat, you should have all the info and links that you need above to create a branch or download the zip for a test case.
I hate conditionals. Have to think on this a lot more. The way things are done both within asciidoctor and what I've done in the splitter don't make this easy.
Current behavior
Some modules/sections are conditioned, such as to apply for community but not enterprise, or vice versa.
For example, the following two modules in this DMN chap file apply to Kogito community docs but not to Kogito enterprise docs, and thus the two module sections in the chapter file are conditionalized accordingly with an ifdef before the first and an endif after the second:
The expectation is that the above condition tags will be left in place in the converted assembly file surrounding the two converted module includes, as follows:
Instead, what happens today is the following:
ifdef
is ignored entirely.endif
is retained at the end of the second file, the one that immediately precedes the closing tag. As a result, that strayendif
breaks the build. See the strayendif
on the last line of the second file: https://gitlab.cee.redhat.com/red-hat-jboss-bxms-documentation/kie-docs-translator/-/blob/master-kogito/modules/dmn/ref-dmn-model-enhancements.adocTarget behavior
Retain all ifdef/endif conditions as they are, including condition tags that should surround a module include in the assembly file not just content in the module file.
This might be tricky because, how can the splitter know if an endif at the end of a module is the close of a condition that encapsulates the entire module and should thus be conditioned in the assembly file VS. just the close of conditioned content within that module and thus be conditioned within the module file? The answer to that determines whether to retain the conditions in the assembly (surrounding the includes) or within the module file.
Example, this is a condition to enclose the includes in the assembly:
Whereas this is a condition to enclose just a portion within the module file:
Note how in both cases the second file ends with an endif exactly the same way. Asciidoc doesn't have any trouble because it tracks back to the start ifdef tag wherever it is and removes it out regardless.
So is there a way for the splitter to detect whether to condition out entire modules and retain the ifdefs in the assembly vs. condition out module content and retain the ifdefs only in the module file? It seems to struggle with that today.
Resources