[tex4ht] [bug #387] New commands for semantic elements
Michal Hoftich
michal.h21 at gmail.com
Wed Feb 7 14:45:13 CET 2018
URL:
<http://puszcza.gnu.org.ua/bugs/?387>
Summary: New commands for semantic elements
Project: tex4ht
Submitted by: michal_h21
Submitted on: Wed 07 Feb 2018 03:45:13 PM EET
Category: None
Priority: 5 - Normal
Severity: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I've created some alternative commands to \HCode or \Tg. The idea is to define
semantic names for logical elements of the document, such as titles, authors,
sections etc. It is possible to assign HTML elements and attributes to these
logical elements. There are commands for inline and block level elements,
which should eliminate the need for constructs like \ifvmode\IgnorePar\fi\EndP
etc.
I think it will be best to show some concrete examples:
\NewLogicalBlock{textit}
\SetBlockProperty{textit}{class}{textit}
\NewLogicalBlock{maketitle}
\SetTag{maketitle}{header}
\NewLogicalBlock{titlehead}
\SetTag{titlehead}{h1}
\SetBlockProperty{titlehead}{class}{titleHead}
\Configure{textit}
{\NoFonts\InlineElementStart{textit}{}}
{\InlineElementEnd{textit}\EndNoFonts}
\Configure{maketitle}{%
{\Configure{maketitle}{}{}{}{}%
\Tag{TITLE+}{\@title}}
\BlockElementStart{maketitle}{}}
{\BlockElementEnd{maketitle}}
{\NoFonts\BlockElementStart{titlehead}{}}
{\BlockElementEnd{titlehead}\EndNoFonts}
The \NewLogicalBlock creates a new logical element. The used tag is configured
using \SetTag, the attributes are set using \SetBlockProperty. The blocks are
inserted to the document using \InlineElementStart ... \InlineElementEnd or
\BlockElementStart ... \BlockElementEnd pairs. The start commands take two
parameters, first is the logical block name, the second can be local
parameters which shouldn't be used for the given logical block globally.
The main idea behind this mechanism is to allow easy work with new HTML5
elements and attributes for WAI-ARIA or Schema.org properties. I hope that
this should allow us to make somehow more clear configurations for basic
document building blocks.
_______________________________________________________
Reply to this item at:
<http://puszcza.gnu.org.ua/bugs/?387>
_______________________________________________
Message sent via/by Puszcza
http://puszcza.gnu.org.ua/
More information about the tex4ht
mailing list