Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcoded header depth #38

Open
opoudjis opened this issue Aug 5, 2021 · 15 comments
Open

Hardcoded header depth #38

opoudjis opened this issue Aug 5, 2021 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@opoudjis
Copy link
Contributor

opoudjis commented Aug 5, 2021

https://github.com/metanorma/metanorma-plugin-lutaml/blob/4ffdcaad5c1ac6a6c0bf3f1ac6f41dd26639fa7e/lib/metanorma/plugin/lutaml/lutaml_uml_attributes_table_preprocessor.rb

def table_template
          <<~TEMPLATE
          === {{ definition.name }}
          {{ definition.definition }}

This means that any instance of lutaml_uml_attributes_table ever will always result in a section number one level deep.

It should go without saying that this is unacceptable: I should be able to get lutaml to generate clauses at any level depth I choose, in general.

In fact, I think it is completely wrong for Lutaml macros to be generating the title of the section at all. If it must do that, you have to give me the option of choosing the section depth.

@opoudjis opoudjis added the enhancement New feature or request label Aug 5, 2021
@opoudjis
Copy link
Contributor Author

opoudjis commented Aug 5, 2021

This has been partially addressed, by 1dbd31a : titles are now optional, and can be disabled with the "skip" parameter.

But now that lutaml is importing correctly, things are worse than that. The IDs automatically being generated for titles in lutaml_uml_attributes_table instances is colliding with anchors present elsewhere in the document. This results in invalid Metanorma documents.

For example,

<clause id="term" inline-header="false" obligation="normative">
<title>Term</title>
<figure id="_ff58c387-3ea4-4388-ad17-fa0bc801e3a1">
<name>Terms and Definitions elements of StandardDocument</name>

is being generated by lutaml_uml_attributes_table, and it collides with a instance of term already defined as a clause ID elsewhere.

Metanorma determines ID assignment for assets. Without exception. It is responsible for their uniqueness. If this functionality is to persist, I am going to overwrite any anchor generated by lutaml with a GUID, to avoid collisions, and I'd rather lutaml do that.

As is, I am removing every single title in lutaml_uml_attributes_table instances in the document I am working on, and replacing them with skip.

@ronaldtse
Copy link
Contributor

I should be able to get lutaml to generate clauses at any level depth I choose, in general.

Agree.

The IDs automatically being generated for titles in lutaml_uml_attributes_table instances is colliding with anchors present elsewhere in the document

Isn't this easily solved by having lutaml change the IDs generated? e.g. lutaml_xxx?

Why is skip even necessary?

@opoudjis
Copy link
Contributor Author

Why is skip even necessary?

To have the title hardcoded in the YAML is absurd. You have no business telling the author there shall be no content between the clause title and the generated table: only the table is automated content; the title I put it under in my document is my business.

And you certainly cannot hardcode the depth of the title, as was the case: that is just absurd.

@w00lf
Copy link
Contributor

w00lf commented Aug 13, 2021

@opoudjis @ronaldtse what should we do with entity name(definition.name)? Currently, its rendered like that:

=== {{ definition.name }}
{{ definition.definition }}

{% if definition.attributes %}
{% if definition.keyword == 'enumeration' %}
.{{ definition.name }} values

@ronaldtse
Copy link
Contributor

@w00lf we can either use the AsciiDoc include to increase the depth, or use a Liquid counter to determine the number of = signs, as we have done before.

@w00lf
Copy link
Contributor

w00lf commented Aug 13, 2021

use the AsciiDoc include to increase the depth

@ronaldtse do have an example?

@w00lf
Copy link
Contributor

w00lf commented Aug 13, 2021

In case we will be using nesting level variable we will need user to pass depth each time, is it ok? @opoudjis

@ronaldtse
Copy link
Contributor

I think it's something like:

include::myfile.adoc[level=+1]

@ronaldtse
Copy link
Contributor

In case we will be using nesting level variable we will need user to pass depth each time, is it ok? @opoudjis

You can set a default level if user didn't set it.

@w00lf
Copy link
Contributor

w00lf commented Aug 13, 2021

In case we will be using nesting level variable we will need user to pass depth each time, is it ok? @opoudjis

You can set a default level if user didn't set it.

@opoudjis is it ok if we done it like that?

@opoudjis
Copy link
Contributor Author

You can do that, sure. I'm not going to use it anyway, because I feel the title should be decided by the author.

@ronaldtse
Copy link
Contributor

@opoudjis how do you plan to "decide" the title for an enumerated tree of packages? Providing a pattern that accepts the name of the package/class? Can you elaborate how that can be possible?

@w00lf
Copy link
Contributor

w00lf commented Aug 18, 2021

@opoudjis how do you plan to "decide" the title for an enumerated tree of packages? Providing a pattern that accepts the name of the package/class? Can you elaborate how that can be possible?

@ronaldtse lutaml_uml_attributes_table macro always accepts entity name to render, there will never be a package tree here.

@opoudjis
Copy link
Contributor Author

opoudjis commented Oct 4, 2021

@w00lf @ronaldtse Is this ticket still open?

@w00lf
Copy link
Contributor

w00lf commented Oct 13, 2021

ping @ronaldtse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants