metanorma / metanorma-iso

Metanorma processor for ISO standards
BSD 2-Clause "Simplified" License
13 stars 5 forks source link

Sections titles #1124

Closed Intelligent2013 closed 5 months ago

Intelligent2013 commented 6 months ago

Source ticket: https://github.com/metanorma/metanorma-iso/issues/1091#issuecomment-1954666365

Is there a way to encode the top-level Sections titles? For example: image

image

(full PDF example see in https://github.com/metanorma/metanorma-iso/issues/1091#issuecomment-1937776848)

The requirements:

For BSI, we have the similar attribute [discrete%section] (https://www.metanorma.org/author/bsi/topics/markup/#sections). but the sub-clauses numbering independently.

opoudjis commented 6 months ago

These are not discrete headings, because they truly are part of the clause hierarchy: the numbering reflects that.

I think I can address this by using [heading=normative references] etc on clauses, to force this structure:

[type=section]
== General

[heading=scope]
=== Scope

[heading=normative refererence]
== Normative references

The "headings" (which fake the clause type) are likely needed, because ISO and indeed Metanorma processing has been hard coded to expect these special clauses to be at top-level. I can make this happen, but it will need some fiddling.

This was inane, and I'm not sure I understand why we are bothering with ancient history like 1987 documents.

Intelligent2013 commented 6 months ago

This was inane, and I'm not sure I understand why we are bothering with ancient history like 1987 documents

From https://github.com/metanorma/metanorma-iso/issues/1092#issuecomment-1936995248:

The purpose of implementing historical PDF layouts is just so that we can publish an old document in a similar presentation. There are occasions where we need to publish the same content in the same layout, without actually updating the contents of the document, therefore using the same identifier as the original. The point is that we cannot use the new layout to publish an old document without changing the identifier.

opoudjis commented 5 months ago

In the current implementation, special clause types (such as Scope or Terms and Definitions) are only recognised at the top level of clause, or if they are set by role attribute (e.g. [bibliography], [index]). We will allow them to be set also by an explicit heading= attribute.

opoudjis commented 5 months ago

We auto-rename clauses whose children are terms collections, presupposing that terms, definitions, symbols & abbreviated terms can be a clause containing a terms and definitions clause and a symbols clause. In a case like

[type=section]
== Section 2

=== Terms and definitions

=== Symbols

we do not want "Section 2" to be renamed to terms, definitions & symbols.

We need a general solution to prevent a clause title being overwritten with its predicted correct title; that requirement will pop up periodically (and it's a good thing it hasn't to date). That will be accomplished by setting a keeptitle attribute on the clause.

opoudjis commented 5 months ago

The desired markup here is therefore:

[type=section]
== General

[heading=scope]
=== Scope

[bibliography,heading=normative references]
=== Normative references

[heading=terms and definitions]
=== Terms and definitions

The reason we are inserting heading= is, automatic recognition is only done at top level. The reason we are doing type=section is, this is crossreferenced and labelled as a section, not a clause.

opoudjis commented 5 months ago

Doing some sneaky work on norm_ref_xpath: we allow //sections/clause[.//references] to be a normative reference clause, which we force to appear second after Scope. We will not if that clause has a type (as sections do, being mere containers.)