Dynamically generate navigation lists.


A crucial part of Guise Mummy functionality is being able to navigate among pages, and having the navigation automatically managed/generated by the static site generator. Thus if we have something like this (assuming that the mummy: prefix represents the https://guise.io/name/mummy/ namespace):

In the presence of mummy:regenerate="regenerate" (which in the future might be mummy:regenerate in HTML), Guise Mummy would regenerate the navigation list to this for example:

This new feature will require the ability for the mummify context to provide:

  • The context path of the current resource being processed.

  • The context path of the child resources, if the current resource is a directory (or index.xhtml).

  • The context paths of the sibling resources (including the current resource).

  • The context paths of the "navigation resources", which will be the child resources if the current resource is a directory (or index.xhtml), or the sibling resources otherwise.

In the future we can add some mechanism to plug in an "element mummifier" (as opposed to a "resource mummifier) to work on subtrees of the input XHTML tree.

The generation needs to automatically provide the correct attributes and styles based upon whether each link corresponds to the current artifact. The "correct" attributes and styles can be determined by using the original navigation list as a template (and it may very well have come from a separate template file). If the original link corresponds to the current artifact, its attributes and styles will be used for the "current" link. Any other link will be used for the others links. Thus if the original code has the following:

  • Tip: The original link can use "" as a way to easily indicate "the current artifact".

  • Tip: For other than the current artifact, the link can simply leave off the href altogether.

When generating navigation links, the list item that corresponds to the currently selected item will be given an active class, and the link itself will be given a disabled class. The non-selected links will be given the title ^{it.title}. Note that disabled links are outside the scope of this ticket, and expression interpolation (e.g. for the title) is not yet supported (see ); it is shown only for example.

Related to this idea of the current resource, if an artifact has children, the label of the artifact needs to be shown at the front of the list. For example, the page …/example/index.xhtml really stands for the resource …/example/, and if it has children …/foo/ and …/bar/, the regenerated navigation list needs to contain "Example", "Foo", and "Bar" (assuming those are the associated labels).




Garret Wilson
April 23, 2019, 11:34 PM

Reopening to implement correct attributes-by-example on list items, as well as add parent resources to the lists.

Garret Wilson
April 8, 2019, 11:11 PM

Now that is done, this functionality needs to be updated to get link labels from artifact descriptions.

Garret Wilson
March 22, 2019, 5:23 PM

The current implementation is very basic. The last segment of navigation links are used as the navigation link labels. In the future, we'll get this from the parsed metadata of the individual artifacts.

Garret Wilson
March 21, 2019, 11:43 PM

This implementation, which making relative links, is currently using a technique that will not work if a navigation link "backtracks" and links to something higher in the hierarchy such as a parent, or to something in a sibling tree. This is because of JDK-6226081. For the moment it shouldn't matter as this simple implementation only supports navigation to the same level or below. This will be fixed after is implemented.

Garret Wilson
March 21, 2019, 11:41 PM

It turns out that in we wound up doing things a little differently. There is a separate planning phase which creates a tree of artifacts, each of which knows its source file and output file in the file system. Directories and their "content artifacts" are distinct, but reference resolution will refer to the directories themselves (the "context artifact").



Garret Wilson


Garret Wilson




Fix versions