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

SVG Map: https://github.com/metanorma/metanorma/issues/160 #778

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions author/itu/topics/markup.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Renders as:
____
|===
h|Editors: |Andreas Reis | E-mail: [email protected]
| |World Health Organization
| |World Health Organization |
| |Sameer Pujari | E-mai: [email protected]
| |World Health Organization
| |World Health Organization |
|===
____

Expand Down Expand Up @@ -263,7 +263,7 @@ e.g.
NOTE: This editorial rule is mandated by the ITU Editorial Team,
but is not described in the ITU-T Author's Guide.

Table titles and column titles are automatically
Table titles and column titles are automatically
capitalised [added in https://github.com/metanorma/isodoc/releases/tag/v2.4.3].
To prevent this, you will need to set the capitalisation of the initial word to "none", using CSS:

Expand Down
78 changes: 78 additions & 0 deletions author/topics/blocks/figures.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,81 @@ image::logo.jpg[]
====
--
======


== SVG: re-mapping hyperlinks

// SVG embedding

Metanorma supports the inclusion of SVG images.

SVGs can include hyperlinks on parts of the image, expressed as `<a href="...">`.
When an SVG image is created independently of the current document, the
hyperlinks may point to arbitrary destinations.

A document author may want to update these hyperlinks to point to anchors within
the document. Metanorma supports the re-mapping of SVG
hyperlinks to have them point to parts of a Metanorma document.

The `svgmap` function supports the re-mapping of SVG
hyperlinks [added in https://github.com/metanorma/metanorma-standoc/releases/tag/v1.8.3].
To use this, the SVG image is wrapped in a figure block with the role attribute
`[.svgmap]` instead of `[figure]`.

The syntax of `svgmap` is as follows.

[source,asciidoc]
----
[.svgmap]
====
image::{filename}.svg[] <1>

* {remapped-link-1}; {original-link-1} <2> <3>
* ...
====
----
<1> `{filename}.svg` is the filename of the SVG image with hyperlinks.
<2> `{remapped-link-1}` is the desired destination that replaces
`{original-link-1}`, it could be a hyperlink or a cross-reference.
<3> `{original-link-1}` is an existing hyperlink (content of the `href`) in the SVG
image. The links are separated by a semicolon.

This allows the author to easily update the hyperlinks within the SVG image to
point to the appropriate locations in the current document.

.Example of `svgmap` usage
======
In this block:

[source,asciidoc]
----
[.svgmap]
====
image::action_schemaexpg1.svg[]

* <<ref1,Computer>>; mn://action_schema
* http://www.example.org[]; http://www.example.com
* <<express:action_schema:action_schema.basic>>; 3
====
----

The image SVG file is `action_schemaexpg1.svg`, and it contains hyperlinks to three destinations:

* `mn://action_schema`
* `http://www.example.com`
* `3`

This block instructs Metanorma to rewrite those hyperlink destinations in the
SVG, expressed as `<a href="...">`, to point to the location of the references
on the left side:

* `mn://action_schema` is rewritten to the location in the document of the
`ref1` anchor (or bibliographic reference); the optional cross-reference text,
`Computer`, is inserted in the SVG hyperlink, replacing whatever text is already
there, and can be used as a mouseover tip.

* `http://www.example.com` is rewritten to `http://www.example.org`.

* `3` is rewritten as the destination of the implicit cross-reference
`<<express:action_schema:action_schema.basic>>`.
======
Loading