LightGuard / asciidoc-splitter

A splitter utility for helping create modular docs from chapter files.
BSD 2-Clause "Simplified" License
8 stars 8 forks source link

Conditions and meta tags not retained properly for "= Additional resources" in each split assembly #81

Closed sterobin closed 3 years ago

sterobin commented 3 years ago

Current behavior

This is most likely related to #80 , but at the end of each chapter file in the source repo there is an "= Additional resources" section that's conditioned for enterprise only and that contains a [role="_additional-resources"] tag, as follows:

ifdef::KOGITO-ENT[]
[role="_additional-resources"]
== Additional resources
* {URL_CREATING_RUNNING}[_{CREATING_RUNNING}_]
* {URL_DEPLOYING_ON_OPENSHIFT}[_{DEPLOYING_ON_OPENSHIFT}_]
* {URL_PROCESS_SERVICES}[_{PROCESS_SERVICES}_]
* {URL_CONFIGURING_KOGITO}[_{CONFIGURING_KOGITO}_]
endif::[]

The expectation again with these conditions is that they will be retained exactly as is in the conversion, so that that the bottom of the new assembly you'll see the above same conditioned section. And the expectation is that any tags like that will be retained too.

Instead, today the start ifdef is removed and the endif is left in place, which breaks the build for every assembly. Also, for some reason the [role="_additional-resources"] tag, which is required for Pantheon 2, is getting removed.

This is how the above looks after the split:

== Additional resources

* {URL_CREATING_RUNNING}[_{CREATING_RUNNING}_]
* {URL_DEPLOYING_ON_OPENSHIFT}[_{DEPLOYING_ON_OPENSHIFT}_]
* {URL_PROCESS_SERVICES}[_{PROCESS_SERVICES}_]
* {URL_CONFIGURING_KOGITO}[_{CONFIGURING_KOGITO}_]
endif::[]

Example source chap file with the correct conditions: https://raw.githubusercontent.com/kiegroup/kie-docs/master-kogito/doc-content/kogito-docs/src/main/asciidoc/dmn/chap-kogito-using-dmn-models.adoc

Example converted assembly with the start ifdef and removed: https://gitlab.cee.redhat.com/red-hat-jboss-bxms-documentation/kie-docs-translator/-/blob/master-kogito/assemblies/assembly-kogito-using-dmn-models.adoc

Target behavior

Retain conditions and tags during the split, without manipulation or removal. The following section, for example, would be transferred identically from the chapter to assembly after the split:

ifdef::KOGITO-ENT[]
[role="_additional-resources"]
== Additional resources
* {URL_CREATING_RUNNING}[_{CREATING_RUNNING}_]
* {URL_DEPLOYING_ON_OPENSHIFT}[_{DEPLOYING_ON_OPENSHIFT}_]
* {URL_PROCESS_SERVICES}[_{PROCESS_SERVICES}_]
* {URL_CONFIGURING_KOGITO}[_{CONFIGURING_KOGITO}_]
endif::[]

Resources

LightGuard commented 3 years ago

"Retain conditions and tags during the split, without manipulation or removal." That cannot be done.

I'll see if I can tweak it some more. Please provide a test case.

sterobin commented 3 years ago

@LightGuard "Please provide a test case." Don't know what you mean, I've given all the details above: source vs. target repos and branches to use, current vs. expected behavior, etc.

sterobin commented 3 years ago

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.