Add support for controlling document metadata in assembly files
AsciiDoc supports document metadata, i.e. attributes defined in the header of the document. With assembler, document metadata are no more document metadata in the generated assembly files but standard document attributes. This is true whether defined in the start page (`site.start_page` key in the playbook) when generating one single assembly (`root_level = 0`) or in the top-level asciidoc files in the navigation when generating multiple assemblies (`root_level = 1`). Currently, if the `metadata` attribute is defined in the header of the start page: ``` = Title :metadata: Some metadata Some content {metadata} Some other content ``` here is what we get when we generate a single assembly: ``` [#index] = Component :underscore: _ :page-component-name: component :page-component-version: :page-version: {page-component-version} :page-component-display-version: latest :page-component-title: Component :docname: index :page-module: ROOT :page-relative-src-path: index.adoc :page-origin-url: https://... :page-origin-start-path: content :page-origin-refname: main :page-origin-reftype: branch :page-origin-refhash: (worktree) :metadata: Some metadata Some content {metadata} Some other content ``` The metadata attribute can of course be used in the document and will have the proper value. But in the running content of the template file or in a custom title page extension, it has no value. When generating one single assembly, it's not really a problem because the attribute can be set in the assembler configuration file under the `asciidoc.attributes` category. However, when generating an assembly per top-level entry in the navigation, there is no workaround if we need different metadata in each assembly. I would then suggest that the document metadata are propagated to the assembly as document metadata and not as document attributes. We would then get something like the following: ``` [#index] = Component :metadata: Some metadata :underscore: _ :page-component-name: component :page-component-version: :page-version: {page-component-version} :page-component-display-version: latest :page-component-title: Component :docname: index :page-module: ROOT :page-relative-src-path: index.adoc :page-origin-url: https://... :page-origin-start-path: content :page-origin-refname: main :page-origin-reftype: branch :page-origin-refhash: (worktree) Some content {metadata} Some other content ``` In this example, the `metadata` attribute is moved in the header, before the assembler-specific attributes. This ensures that, in case of duplicates, the assembler-specific attributes always override document metadata. When generating a single assembly (`root_level = 0`), attributes defined in any AsciiDoc file other than the start page should be converted to standard document attributes (not metadata). To my knowledge, this is the current behavior. When generating assembly per top-level navigation entry (`root_level = 1`), attributes defined in any AsciiDoc file other than the top-level navigation AsciiDoc files should be converted to standard document attributes (not metadata). To my knowledge, this is also the current behavior. The standard precedence rule should still apply as-is. Thus, attributes defined in the playbook, in the component configuration file, and in the assembler configuration file would then take precedence over the document metadata defined in the assembly asciidoc file.
issue