-
Notifications
You must be signed in to change notification settings - Fork 3
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
Confusion between link target and displayed text when link? #671
Comments
Thanks @jerstlouis for the report. Do you happen to know what the XML encoding of this link is? There is clearly a bug there... Thanks! |
@ronaldtse quite interestingly it has TWO nested <p id="_711a69b2-5c0b-e0d9-04ae-4d97b2bd5ba3">
<link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json">
<link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal"/>
</link>
</p> A fix would be to either consistently use the target of the inner link as the text, and use the outer link for the generated link target in both the PDF and HTML rendering, OR to not generate an inner link but directly using the text when generating the XML. |
@jerstlouis the similar issue was reported in #664. The solution is - escape https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json[\https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal] |
@Intelligent2013 Thank you for the work-around. Since the metanorma PDF and HTML renderings are inconsistent, I would still consider this a bug. This does seem to be related to #664, which I just finally wrapped my head around (see #664 (comment)) and applied the work-around. Ideally, anything inside of the text supplied for a link should disable any kind of link extraction for the text inside the I realize that ASCIIDoc itself seems broken in that regard, but metanorma behaves differently in requiring this extra From the perspective of the intermediate metanorma XML, ideally this This is what works with asciidoctor-pdf:
and this is the equivalent which works with metanorma:
(except that in this particular case that last link gets cut off and not line-breaked for the PDF rendering -- see #664 (comment)) Thanks for all the help trying to make metanorma easier to use for us poor editors :) |
- Fixes links so they get rendered properly ( see metanorma/metanorma-ogc#664 (comment) and metanorma/metanorma-ogc#671 )
Not urgent. |
Just noticed that the |
@opoudjis FYI, I've tried to generate the presentation XML with the old
The Presentation XML contains <ogc-standard xmlns="https://www.metanorma.org/ns/ogc" type="presentation" version="2.3.9" schema-version="v1.2.1">
...
<p id="_">Link TC1: <link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json">https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal</link>
</p>
<p id="_">Link TC2: <link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json">\https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal</link>
</p>
<p id="_">Link TC3: <link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json">https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal</link>
</p>
<p id="_">Link TC4: <link target="http://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json">http://maps.gnosis.earth/ogcapi/collections/OpenMapLocal</link>
</p> With today's generated <ogc-standard xmlns="https://www.metanorma.org/ns/ogc" type="presentation" version="2.5.9" schema-version="v1.3.2">
...
<p id="_">Link TC1: <link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json"><link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal"/></link></p>
<p id="_">Link TC2: <link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json">https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal</link></p>
<p id="_">Link TC3: <link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json"><link target="https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal"/></link></p>
<p id="_">Link TC4: <link target="http://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json"><link target="http://maps.gnosis.earth/ogcapi/collections/OpenMapLocal"/></link></p> Source
|
Ugh. Urgent. |
Now that I've finally had the time to look at what Alex reports: we used to require no \ . Now we do require \ . And at issue is, what has changed in processing in the past year. I'll investigate, but won't spend days on this... |
Yup, I know what it is. This change in processing was introduced in metanorma/metanorma-standoc#808 Asciidoctor out of the box applies character substitution globally, including to URLs. That means it converts To prevent that behaviour, I've introduced preprocessing that escapes all such links as passthrough text, so they are not text-substituted, and then converts them back to URLs in postprocessing. In that process, I've lost the ability to deal with URLs with URL text. If I have to have either Asciidoctor mangling legitimate links, or authors having to escape URL text in URL macros, I'm going to choose the former. Let me investigate whether I can refine the preprocessing. |
So in the macro,
is escaped as
What we want, and what the \ is having to do, is the equivalent of converting it instead to:
|
Addressed: running the link detection recursively. (The recursion does bottom out.) The |
... No, that doesn't work. Will need to insert |
…cting links from character substitution: metanorma/metanorma-ogc#671
In OGC API - Maps, Annex B / Section 2 we noticed the following.
A link in the ASCIIDoc is written as:
https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json[https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal]
The intent was to show the link to the reader without the
?f=json
, while resulting in the JSON representation of the resource being returned if the reader clicks on the link. This is becausef
is not a standard parameter but an alternative to anAccept: application/json
request header that cannot be specified in a URL.The current behavior is not as expected, and is opposite between the HTML and the PDF rendering of the document (with both behaviors unexpected).
https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal
and links tohttps://maps.gnosis.earth/ogcapi/collections/OpenMapLocal
without the?f=json
https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json
and links tohttps://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json
https://maps.gnosis.earth/ogcapi/collections/OpenMapLocal
but link tohttps://maps.gnosis.earth/ogcapi/collections/OpenMapLocal?f=json
Is there some special logic which tries to determine whether the linked text is itself a link which is behind these unexpected behaviors? I would just expect the text to be written as-is -- that's the whole point of explicitly specifying a link as opposed to just writing the URL and having it automatically turned into a link.
The text was updated successfully, but these errors were encountered: