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

Only split chap files, leave non-chap module files in tact and simply cover over during the split #79

Closed sterobin closed 3 years ago

sterobin commented 3 years ago

Current behavior

The splitter is designed to split apparently any detected adoc file of any kind to an assembly, strip out modules, and place the resulting modules in the modules file in the target. However, the splitter needs an enhancement to split only adoc files prefixed with chap-, and for any other files, copy over as is and update any include references to them accordingly in the split version.

Example, the Kogito source DMN folder contains a chapter file to be split as well as a standalone module file that is intentionally not pasted in the chapter file and instead is an include in the chapter file. This ref file is treated as a chap file and thus converted to an assembly in the split assemblies folder, and the include for it that was previously in the chap file is not updated to reflect the new location of the same module file in the modules folder (since the conversion didn't happen at all and the module doesn't exist there).

The use case for this is that so far at least one file must stay a standalone module because it's synced with the code repo where the mother file exists and is tested with the code when it's autobuilt. Then where they two files get out of sync, we have a process (in the works) for updating and aligning the two docs. Basically single-sourcing the file between the two repos. There are more files like this that will be coming for DMN, so it's a genuine use case. Putting that file's content in the chap file like any other module disables the ability to autocheck if they are identical to update accordingly. There's another option for addressing this, but the developer Matteo Mortari would prefer for us to try updating the splitter to achieve this first, since it's a reasonable scenario.

Target behavior

Maybe just update the splitter to split only files with prefix chap- as usual, and for any other non-chap files, simply copy over as is to that folder in modules and update all includes that point to it to reflect the new location (i.e., just add modules/ to the include as the splitter already does today).

Resources