Open HassanAkbar opened 3 months ago
@opoudjis Should I also sanitize the prefix and id to convert all forbidden characters to _
, or is this enough for what you need?
@opoudjis Should I also sanitize the prefix and id to convert all forbidden characters to _, or is this enough for what you need?
It turns out that yes, you will need to do that sanitisation in the glossarist plugin. :
inside of cross-references is already being used to do namespaced cross-references (which we've done for Express), so Metanorma ends up putting them inside of the bibliography, and treats their content after the first colon as an anchor within an external file. They simply will not work as is.
So yes, I will need you to escape :
in identifiers-as-anchors, in both cross-references to identifiers, and anchors. The function to do so consistently is Metanorma::Utils.to_ncname()
@HassanAkbar Needs sanitisation in BOTH anchors and cross-references; so:
[[urn_iso_std_iso_14812_3.1.1.1]]
=== entity
concrete or abstract thing that exists, did exist, or can possibly exist, including associations among these things
[example]
{{urn:iso:std:iso:14812:3.1.1.6,person,Person}}, object, event, idea, process, etc.
needs to be:
[[urn_iso_std_iso_14812_3.1.1.1]]
=== entity
concrete or abstract thing that exists, did exist, or can possibly exist, including associations among these things
[example]
{{urn_iso_std_iso_14812_3.1.1.6,person,Person}}, object, event, idea, process, etc.
The anchor needs to look identical to the concept reference to the anchor (since anchors is what we are doing).
@HassanAkbar Needs sanitisation in BOTH anchors and cross-references;
@opoudjis I am currently working on making the references sanitized. I am identifying the places where the references can appear i.e notes, examples, definitions etc and then I will perform sanitization for all those places when loading the concept.
@opoudjis I've updated the PR to sanitize the references as well. I will test the regex on complete glossaries to see if it makes a significant difference or not and will update it accordingly but I think that this will fix the issue of anchors and references.
And crossreferences to anchors need to be formatted as anchor cross-references: {{<<urn_iso_std_iso_14812_3.1.4.7>>,physical view}}
. {{urn_iso_std_iso_14812_3.1.4.7,physical view}}
is interpreted as "term, rendered term" (so it is looking for a term titled urn_iso_std_iso_14812_3.1.4.7, but will display it as "physical view". Therefore it will not work.
The syntax is: {{ (<<anchor>>,)? term(, rendered term)?(, cross-reference number)?(, options)? }}
: https://www.metanorma.org/author/topics/sections/concepts/#citeterms
And globally replacing {{urn([^,]+),
with {{<<urn\1>>,
in the generated asciidoc removes all the missing cross-reference warnings...
And globally replacing
{{urn([^,]+),
with{{<<urn\1>>,
in the generated asciidoc removes all the missing cross-reference warnings...
@opoudjis I think this should be fixed in the data source because the prefix and ids can be different for different datasources. I will open a PR for this fix in the isotc204-glossary
repo.
@HassanAkbar there are two things we should do with glossarist.
@HassanAkbar Update on this please.
Added an option to allow anchor prefix when rendering a single concept or complete dataset as discussed here -> https://github.com/metanorma/metanorma-plugin-glossarist/issues/27#issuecomment-2275553450
fixes #27