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

Conditioned content for enterprise not being brought over in the split #77

Closed sterobin closed 3 years ago

sterobin commented 3 years ago

Current behavior

The splitter doesn't bring over content that is conditioned with the KOGITO-ENT ifdef. Conditioned content is removed from the file contents itself, and if what is conditioned is a module block, that module isn't converted to a module file, so it's just gone. I remember you added a splitter option KOGITO-ENT=true that one could use with the split command, but this is either now gone or changed and isn't recognized in the command.

I used the following command to run it:

target/asciidoc-splitter-1.0-SNAPSHOT-bin/bin/asciidoc-splitter.sh -sr git@github.com:sterobin/kie-docs.git -sb master-kogito-test-source-B -or git@gitlab.cee.redhat.com:red-hat-jboss-bxms-documentation/kie-docs-translator.git -ob master-kogito-test-split-B-LIVE -i index.adoc

As a result, any content that is conditioned today is simply removed. Compare the following:

Source chap file: Note the first module section on con-kogito-automation https://raw.githubusercontent.com/sterobin/kie-docs/master-kogito-test-source-B/doc-content/kogito-docs/src/main/asciidoc/creating-running/chap-kogito-creating-running.adoc

The include for con-kogito-automation is gone, and a huge gap above the includes list. https://gitlab.cee.redhat.com/red-hat-jboss-bxms-documentation/kie-docs-translator/-/blob/master-kogito-test-split-B-LIVE/assemblies/assembly-kogito-creating-running.adoc

The module file for con-kogito-automation is likewise not generated: https://gitlab.cee.redhat.com/red-hat-jboss-bxms-documentation/kie-docs-translator/-/tree/master-kogito-test-split-B-LIVE/modules/creating-running

Target behavior

Don't decipher ifdefs at all. To simplify and to be more agnostic for other teams that might use this, I suggest we make the splitter ignore ifdefs altogether. Just bring over all file contents including all ifdefs as they stand, and likewise convert all module content to module files, regardless of how they are conditioned. Who knows exactly how each team will condition content, so we shouldn't let the splitter try to decipher, just bring it all.

LightGuard commented 3 years ago

It doesn't look like you're using the -a attribute to send to asciidoctor. I can see if there's some way we can fanagle around ifdefs, but if you pass the attribute (like -a KOGITO-ENT=true|KOGITO-OTHER=false the | separates the two key value pairs) it should work they way you're thinking.

LightGuard commented 3 years ago

@sterobin I wish I could ignore ifdef, but because I'm running it through asciidoctor, I can't because that isn't a feature asciidoctor has. I may be able to comment out ifdefs then remove the comment on output. Probably about the best I can do.

sterobin commented 3 years ago

@LightGuard Actually, so long as the user can specify what the condition is when running the command, should work. So for me, I can say -a KOGITO-ENT=true while another user on another team would say -a QUARKUS-ENT=true if that's what they use. So long as that's kind of the deal, that's fine.

LightGuard commented 3 years ago

Try the latest master, you shouldn't need -a any more, and the ifdefs should still be in the output.

sterobin commented 3 years ago

@LightGuard , I rebased and it still requires the -a:

Without -a

sterobin@sterobin ~/repos/asciidoc-splitter  (master) $ target/asciidoc-splitter-1.0-SNAPSHOT-bin/bin/asciidoc-splitter.sh -sr git@github.com:sterobin/kie-docs.git -sb master-kogito-test-source-B -or git@gitlab.cee.redhat.com:red-hat-jboss-bxms-documentation/kie-docs-translator.git -ob master-kogito-test-split-B-LIVE -i index.adoc KOGITO-ENT=true
Unknown option: KOGITO-ENT=true

With -a

sterobin@sterobin ~/repos/asciidoc-splitter  (master) $ target/asciidoc-splitter-1.0-SNAPSHOT-bin/bin/asciidoc-splitter.sh -sr git@github.com:sterobin/kie-docs.git -sb master-kogito-test-source-B -or git@gitlab.cee.redhat.com:red-hat-jboss-bxms-documentation/kie-docs-translator.git -ob master-kogito-test-split-B-LIVE -i index.adoc -a KOGITO-ENT=true
Cloning origin...
...
LightGuard commented 3 years ago

No, I'm saying you shouldn't need to pass any additional attributes besides the source, branches, output and ignore.

On Fri, Sep 11, 2020 at 10:37 AM Stetson Robinson notifications@github.com wrote:

@LightGuard https://github.com/LightGuard , I rebased and it still requires the -a:

sterobin@sterobin ~/repos/asciidoc-splitter (master) $ target/asciidoc-splitter-1.0-SNAPSHOT-bin/bin/asciidoc-splitter.sh -sr git@github.com:sterobin/kie-docs.git -sb master-kogito-test-source-B -or git@gitlab.cee.redhat.com:red-hat-jboss-bxms-documentation/kie-docs-translator.git -ob master-kogito-test-split-B-LIVE -i index.adoc KOGITO-ENT=true Unknown option: KOGITO-ENT=true

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LightGuard/asciidoc-splitter/issues/77#issuecomment-691197663, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAHKE34B5S6LTZQORYYNQDSFJG4HANCNFSM4RFSLQNQ .

-- Jason Porter http://en.gravatar.com/lightguardjp

sterobin commented 3 years ago

Try the latest master, you shouldn't need -a any more, and the ifdefs should still be in the output.

I see, cool. I understood this to mean the -a attribute specifically.

Well, once the repeat-run issue is resolved, I can re-run and test it. I suppose I can scrap and re-run with content from scratch to workaround that other issue and test the attributes. Anyway, will see. Thanks.

LightGuard commented 3 years ago

@sterobin Please give things a try and if you're satisfied, please close.

sterobin commented 3 years ago

Good to go.