[l2h] use of html5 attributes

Shigeharu TAKENO shige at iee.niit.ac.jp
Wed Dec 2 04:16:53 CET 2020


shige 12/02 2020
----------------

Christian Mensing wrote:
| Usually I also use the rawhtml environment to define new
| commands. I tried your suggested code, and it works, of course.
| I understand it is too much overhead to consider all the html versions.
| However, I'm surprised how good html5 is implemented so far.
| 
| Thank you and the other contributors for their effort
| 
| Christian Mensing!
| 
| On 12/1/20 12:09 PM, Shigeharu TAKENO wrote:
| >   \begin{rawhtml}
| >     <a id="tex2html1"
| >       href="some_document.pdf" download >download course 1</a>
| >   \end{rawhtml}

Another solution is to modify your versions/html5_0.perl,

===== from here =====
--- versions/html5_0.pl.ORG	2020-12-02 12:02:18.666207000 +0900
+++ versions/html5_0.pl	2020-12-02 12:02:59.334008000 +0900
@@ -199,13 +199,14 @@
 $A_attribs = ",SHAPE,DIR,";
 $A__SHAPE = $shape_type;
 $A__DIR = $dir_type;
-$A_attribs_rx_list = join('',",HREF,NAME,REL,REV,CHARSET,TARGET,ACCESSKEY,COORDS,TABINDEX,ONFOCUS,ONBLUR",$style_attribs);
+$A_attribs_rx_list = join('',",HREF,NAME,REL,REV,CHARSET,TARGET,ACCESSKEY,COORDS,TABINDEX,ONFOCUS,ONBLUR,DOWNLOAD",$style_attribs);
 $A__HREF_rx = $URL_type;
 $A__NAME_rx = $A__REL_rx = $A__REV_rx = $string_type;
 $A__CHARSET_rx = $A__TARGET_rx = $A__ACCESSKEY_rx = $CDATA_type;
 $A__COORDS_rx = $coord_type;
 $A__TABINDEX_rx = $num_type;
 $A__ONFOCUS_rx = $A__ONBLUR_rx = $script_type;
+$A__DOWNLOAD_rx = $URL_type;
 
 $ACRONYM_attribs = ",DIR,";
 $ACRONYM__DIR = $dir_type;
===== to here =====

and to use \HTMLcode command as

 \HTMLcode[href=some_document.pdf,download=file.pdf]{A}{download course 1}

This will translate

 <A DOWNLOAD="file.pdf" HREF="some_document.pdf">download course 1</A>

with above patch.

Well, space separated options 

 \HTMLcode[href=some_document.pdf download=file.pdf]{A}{download course 1}

and "download" without value

 \HTMLcode[href=some_document.pdf,download]{A}{download course 1}

may not be recognized correctly. If specifying null value as

 \HTMLcode[href=some_document.pdf,download=]{A}{download course 1}

it will translate

 <A DOWNLOAD="" HREF="some_document.pdf">download course 1</A>

but I don't know whether it is correct or not for HTML5.

+========================================================+
 Shigeharu TAKENO     NIigata Institute of Technology
                       kashiwazaki,Niigata 945-1195 JAPAN
 shige at iee.niit.ac.jp   TEL(&FAX): +81-257-22-8161
+========================================================+


More information about the latex2html mailing list.