asam-ev / asam-project-guide

(WIP!) Project Guide for ASAM OpenX standards
Mozilla Public License 2.0
2 stars 0 forks source link

Implement behavior for "code-" anchors #154

Open philipwindecker opened 2 years ago

philipwindecker commented 2 years ago

Subject

Define expected behavior for the use of the anchor type "code-" regarding Antora extensions.

Description

When the extension for handling anchors was written, only requirements for the anchors "top-", "sec-", "fig-", and "tab-" were specified. Now, there also is some specification on the use of the anchor "code-": https://asam-ev.github.io/asam-project-guide/asamprojectguide/latest/compendium/Editorial_guide/07_source_code.html

The extension, however, will mark these anchors as "non-standard" and will execute some default behavior for them, which may be incorrect in the context of ASAM.

Suggestion

To change this, specify requirements and implement them accordingly in the respective extensions. This should mostly be fixed within the content_analyzer.js module, unless some other functionality beyond handling the anchor name is required (e.g. in loft).

Assumptions

Rules

CURRENT WORKAROUND

The current implementation has a line added to reset the code counter back to 0 for each file. The reason is that in osc2 the use of code- anchors is not consistent and, therefore, numbers will jump. Remove this after osc2 has been released.

philipwindecker commented 2 years ago

First assessment

What works

What does not work yet

What will not work

philipwindecker commented 2 years ago

Extension update is ready for testing: https://code.asam.net/common/asam-antora-extensions/-/tree/update_loft_and_anchors Example use: https://code.asam.net/simulation/standard/openscenario-2.0/-/tree/fix_uml2adoc_anchor_names

christiangoedert commented 2 years ago

Suggestion for rules

Use ==== for example blocks
Use "exa-" for anchor prefix
Reference text on example: "Example <number>"

Use ---- for source code blocks
Use "code-" for anchor prefix
Reference text on source code: "Code example <number>"

Comparison of example and source code highlighting

[.underline]#XML example#

*Original File*

[source, xml, linenums]
----
<planView>
    <include file="planview.xml"/>
</planView>
----

*Included File*

[source, xml, linenums]
----
<planView>
    <geometry x="-0.014" y="-0.055" hdg="2.88" length="95.89" s="0.0">
        <arc curvature="-0.000490572"/>
    </geometry>
    <geometry x="-92.10" y="26.64" hdg="2.84" length="46.65" s="95.89">
        <spiral curvStart="-0.000490572" curvEnd="-0.004661241"/>
    </geometry>
</planView>
----

[#exa-uid]
.XML example
====
[#code-uid-1]
.Original File
[source, xml, linenums]
----
<planView>
    <include file="planview.xml"/>
</planView>
----

[#code-uid-2]
.Included File
[source, xml, linenums]
----
<planView>
    <geometry x="-0.014" y="-0.055" hdg="2.88" length="95.89" s="0.0">
        <arc curvature="-0.000490572"/>
    </geometry>
    <geometry x="-92.10" y="26.64" hdg="2.84" length="46.65" s="95.89">
        <spiral curvStart="-0.000490572" curvEnd="-0.004661241"/>
    </geometry>
</planView>
----
====