pml-lang / pml-companion

Java source code of the 'PML Companion (PMLC)'
https://www.pml-lang.dev
GNU General Public License v2.0
22 stars 1 forks source link

Add Alternative Text for <img> tags #21

Closed celtic-coder closed 3 years ago

celtic-coder commented 3 years ago

Hi Christian (@pml-lang),

I noticed that the online version of the manual was generated by PML 1.2.0 and that one of the differences from the current 1.3.0 version is that tag has a closing "/" character.

As a further enhancement, in terms of accessibility, it is recommended that each image has a text alternative. Even in cases where there is no valid alternative, an empty alt tag is still recommended.

In the PML Reference Manual, in the section for the image node, there are attributes for captions, node title, etc. but nothing for alternative text. Should this be included? Could alt="" be added as a default value for this attribute of the tag?

Kind Regards, Liam

pml-lang commented 3 years ago

The reason for not having a PML alt tag is that alt is specific to HTML. The solution is to use an html_alt tag (e.g. html_alt = "Delicious strawberries"). More information can be found in chapter HTML Attributes of PML's user manual.

I have appended a note in the description of the image node, and added an html_alt attribute in the node's example. Thus it will be more clear in the next version of PML's reference manual.

In a future version PML could possibly auto-create an html_alt attribute (if it's not explicitly defined), based on the values of the title and caption attributes.

celtic-coder commented 3 years ago

Thanks for the clarification!

pxml-lang commented 3 years ago

Update:

The behavior has now been changed (in the new online version 1.4.0) and works as follows (excerpt from online reference manual):

Note about the HTML 'alt' tag: Attribute 'html_alt' can be used to add an explicit 'alt' attribute in the resulting HTML (see example). If no explicit 'html_alt' is provided then the value of the 'title' attribute is used for the 'alt' attribute. If no 'title' attribute is provided then the value of the 'caption' attribute is used.