This chapter explains how to add SVG, MathML, audio,
video and Flash animations to your DITA topics and how
ditac
processes this rich media content in the case where
the output format supports rich media (e.g. XHTML 5, EPUB 3) and also in the
case where the output format does not support rich media (e.g. XHTML 1, PDF,
RTF).
<svg-container>
/<svgref>
element pointing to an SVG file to include it by reference.
Example:<p><svg-container><svgref href="media/graphic.svg"/></svg-container></p>
<image>
element pointing to
an SVG file to include it by reference. Example:<p><image href="media/graphic.svg"/></p>
<svg-container>
element.
Example:<p><svg-container> <svg:svg height="64.710144" version="1.1" viewBox="0 0 104.28986 51.768115" width="130.36232" xmlns:svg="http://www.w3.org/2000/svg"> ... </svg:svg> </svg-container></p>
<image>
element rather then
<svg-container>
/<svgref>
.
The <image>
element has useful attributes
(@width
, @height
,
@scale
, @scalefit
) allowing to adjust
the dimension of the image. Moreover this elements permits on the fly
conversion between image formats.<mathml>
/<mathmlref>
element
pointing to a MathML file to include it by reference.
Example:<p><mathml><mathmlref href="media/math.mml"/></mathml></p>
<mathml>
element. Example:<p><mathml> <m:math display="block" xmlns:m="http://www.w3.org/1998/Math/MathML"> <m:row> ... </m:mrow> </m:math> </mathml></p>
<mathml>
into the following equation elements:
<equation-inline>
,
<equation-block>
,
<equation-figure>
.<equation-figure>
elements having a
<title>
. Example:
<equation-block>
elements containing a empty <equation-number>
are automatically numbered. Example:(8-1) |
<equation-figure>
elements having a
<title>
and the counter used to number
<equation-block>
elements containing an empty
<equation-number>
are different. Therefore
mixing numbered <equation-figure>
s and numbered
<equation-block>
s in the same DITA document may
result in a hard to understand equation numbering.<p><object data="media/audio.mp3" type="audio/mpeg"> <param name="source" value="media/audio.ogg" valuetype="ref" type="audio/ogg"/> <param name="source" value="media/audio.m4a" valuetype="ref" type="audio/mp4"/> <param name="source" value="media/audio.wav" valuetype="ref" type="audio/wav"/> <param name="controls" value="true"/> </object></p>
@data
and @type
attributes are
required. The value of the @type
attribute must start
with "audio/".<audio>
element, vary in their support of audio
formats. This is done by adding <param>
child
elements to the <object>
element. Such
<param>
elements must have a
name="source" attribute, a valuetype="ref"
attribute, a @value
attribute referencing an audio
file and preferably, a @type
attribute specifying the
media type of the audio file.<param>
elements
corresponding to the attributes supported by the HTML 5 audio element
(<crossorigin>
,
<preload>
, <autoplay>
,
<mediagroup>
, <loop>
,
<muted>
, <controls>
). In
the above example, we have added a <param>
element corresponding to the @controls
HTML 5
attribute. Note that in the case of HTML 5 boolean attributes
(<autoplay>
, <loop>
,
<muted>
, <controls>
),
the @value
attribute of a
<param>
is not significant. For example, in the
case of the above example, you could have specified "yes",
"on", "1", etc, instead of "true".<object>
element has a
<desc>
child element, then this
<desc>
element is used to generate fallback
content in case audio is not supported. If the object element has no
<desc>
child element, then a simple fallback
content is automatically generated by ditac. This automatic fallback
content basically consists in a link allowing to download the audio
file.<audio>
element, so there is no need to use an
<object>
element. The equivalent of the above
<object>
example would be:
<audio> <media-controls value="true"/> <media-source value="media/audio.mp3"/> <media-source value="media/audio.ogg"/> <media-source value="media/audio.m4a"/> <media-source value="media/audio.wav"/> </audio>
<p><object data="media/video.mp4" type="video/mp4"> <param name="source" value="media/video.ogv" valuetype="ref" type='video/ogg; codecs="theora, vorbis"'/> <param name="source" value="media/video.webm" valuetype="ref" type="video/webm"/> <param name="width" value="320"/> <param name="controls" value="yes"/> <param name="poster" value="media/video_poster.jpg" valuetype="ref"/> </object></p>
@data
and @type
attributes are
required. The value of the @type
attribute must start
with "video/".<video>
element, vary in their support of video
formats. This is done by adding <param>
child
elements to the <object>
element. Such
<param>
elements must have a
name="source" attribute, a valuetype="ref"
attribute, a @value
attribute referencing a video file
and preferably, a @type
attribute specifying the media
type of the video file.<param>
elements corresponding to the
attributes supported by the HTML 5 <video>
element (<crossorigin>
,
<poster>
, <preload>
,
<autoplay>
,
<mediagroup>
, <loop>
,
<muted>
, <controls>
,
<width>
, <height>
). In
the above example, we have added a <param>
element corresponding to the <width>
,
<controls>
and <poster>
HTML 5 attributes. Note that in the case of HTML 5 boolean
attributes (<autoplay>
,
<loop>
, <muted>
,
<controls>
), the @value
attribute of a <param>
is not significant. For
example, in the case of the above example, you could have specified
"true", "on", "1", etc, instead of
"yes".<object>
element has a
<desc>
child element, then this
<desc>
element is used to generate fallback
content in case video is not supported. If the object element has no
<desc>
child element, then a simple fallback
content is automatically generated by ditac. This automatic fallback
content basically consists in a link allowing to download the video
file. The <param>
element corresponding to the
<poster>
HTML 5 attribute, if present, is used
to generate a nicer automatic fallback content.<video>
element, so there is no need to use an
<object>
element. The equivalent of the above
<object>
example would be:
<video width="320"> <video-poster value="media/video_poster.jpg"/> <media-controls value="true"/> <media-source value="media/video.mp4"/> <media-source value="media/video.ogv"/> <media-source value="media/video.webm"/> </video>
<p><object data="animation.swf" type="application/x-shockwave-flash" width="431" height="123"> <param name="movie" value="animation.swf" valuetype="ref" type="application/x-shockwave-flash"/> <param name="menu" value="true"/> <param name="quality" value="low"/> </object></p>
@data
, @type
,
@width
and @height
attributes are
required. The param name=movie child element having the same
value as attribute @data
is required too.<param>
child element
supported by the Flash object. In the above example, you'll find
menu and quality in addition to required
movie.<object>
element has a
<desc>
child element, then this
<desc>
element is used to generate fallback
content in case Flash is not supported. If the object element has no
<desc>
child element, then a simple fallback
content is automatically generated by ditac. This automatic fallback
content basically consists in a link allowing to download the
.swf file.<object>
element<object>
DITA element may be used
to add audio, video and Adobe® Flash® animations to your DITA topics. In
any case other than those described in previous sections, the
<object>
DITA element is converted to the
equivalent <object>
XHTML element. For example, if
you want to add a YouTube
video to your DITA topics, simply do it in
DITA as you would do it in XHTML using the <object>
element.<p><object data="https://www.youtube.com/embed/C0DPdy98e4c" width="640" height="360"> <desc><image href="media/youtube_icon.png"/> Watch this <xref format="html" href="https://youtu.be/C0DPdy98e4c" scope="external">test video</xref> on YouTube.</desc> </object></p>
<object>
element has a
<desc>
child element, then this
<desc>
element is used to generate fallback
content in case the media object is not supported. If the object
element has no <desc>
child element, then a
simple fallback content is automatically generated by ditac. This
automatic fallback content basically consists in a link allowing to
download the media file.