docToolchain / docToolchain

a AsciiDoc Toolchain for technical Software Documentation, focused on Software Architecture Documentation
https://doctoolchain.github.io/docToolchain/
MIT License
748 stars 237 forks source link

generateSite: create an expandable toc with subitems #804

Open FelixGeisler opened 2 years ago

FelixGeisler commented 2 years ago

Is your feature request related to a problem? Please describe. Our documentation contains subfolders with further documentation files. The generateSite task adds to everything in the subfolders a "-draft" suffix. Is this a bug or intentional?

Describe the solution you'd like I would like an expandable toc with subitems. As e.g. in the MS docs: image

rdmueller commented 2 years ago

partly bug, partly intentional.

the expandable toc is a cool feature, but not yet implemented.

We try to follow a convention over configuration approach. This mean, a folder structure like this is expected:

01_menu_entry/01_toc_entry.adoc

this will lead to a "published" page, e.g., the attribute :jbake-status: is set automatically to published, otherwise to draft.

btw: it will also set :jbake-menu: to menu entry, :jbake-order: to 01 and :jbake-title: to toc entry.

Now, as you might already have guessed, you can now set these attributes directly in your files - those which are in subfolders. This will avoid that they will be rendered as draft.

The logic for this can be found in https://github.com/docToolchain/docToolchain/blob/ng/scripts/generateSite.gradle and https://github.com/docToolchain/docToolchain/blob/ng/src/site/templates/submenu.gsp .

So, for the subitems, I could imagine that a :jbake-menu: toplevel/subitem could be rendered by the submenu.gsp in the favour you imagine.

FelixGeisler commented 2 years ago

Thank you that helps me a lot to understand how it works.

Unfortunately, our documentation is very complex at the moment. My provisional solution is to set the draft-suffix to an empty String in the jbake.properties. So we don't have to set the attributes in the files. Files in subfolders will not appear in the toc. This is ok for us at the moment.

I really like the convention over configuration approach. Perhaps we will manage to implement the following approach at some point in the future:

01_menu_entry
│   01_toc_entry_level_1.adoc
│   02_toc_entry_level_1.adoc
└───03_toc_entry_level_1
│   │   01_toc_entry_level2.adoc
│   └───02_toc_entry_level2
│       │   01_toc_entry_level3.adoc
│       │   02_toc_entry_level3.adoc
│       │   ...
│   ...

i will investiagte further....

rdmueller commented 2 years ago

yes, this approach is also my goal. I guess we have to use the menu attribute as a list.

maybe I will find someone at the javaland conference who wants to work on this