docToolchain icon indicating copy to clipboard operation
docToolchain copied to clipboard

generateSite: create an expandable toc with subitems

Open FelixGeisler opened this issue 3 years ago • 3 comments

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

FelixGeisler avatar Feb 25 '22 10:02 FelixGeisler

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.

rdmueller avatar Feb 25 '22 16:02 rdmueller

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....

FelixGeisler avatar Feb 28 '22 14:02 FelixGeisler

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

rdmueller avatar Mar 02 '22 21:03 rdmueller