~ubuntu-branches/ubuntu/trusty/yelp-xsl/trusty

« back to all changes in this revision

Viewing changes to xslt/mallard/html/mal2html-media.xsl

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2013-10-17 00:05:53 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20131017000553-4rje2hk2j69y05w4
Tags: upstream-3.10.1
ImportĀ upstreamĀ versionĀ 3.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    <xsl:attribute name="alt">
66
66
      <xsl:choose>
67
67
        <xsl:when test="$inline">
68
 
          <xsl:value-of select="$node"/>
 
68
          <xsl:variable name="alt">
 
69
            <xsl:apply-templates mode="mal2html.inline.mode" select="$node/node()"/>
 
70
          </xsl:variable>
 
71
          <xsl:value-of select="normalize-space($alt)"/>
69
72
        </xsl:when>
70
73
        <xsl:otherwise>
71
74
          <!-- FIXME: This is not ideal.  Nested block container elements
87
90
  </img>
88
91
</xsl:template>
89
92
 
 
93
 
90
94
<!--**==========================================================================
91
95
mal2html.media.video
92
96
Output a #{video} element for a video.
255
259
 
256
260
<xsl:template mode="mal2html.ttml.mode" match="tt:body">
257
261
  <div>
258
 
    <xsl:attribute name="class">
259
 
      <xsl:text>media-ttml</xsl:text>
260
 
      <xsl:choose>
261
 
        <xsl:when test="@xml:space">
262
 
          <xsl:if test="@xml:space='preserve'">
263
 
            <xsl:text> media-ttml-pre</xsl:text>
264
 
          </xsl:if>
265
 
          <xsl:if test="@xml:space='default'">
266
 
            <xsl:text> media-ttml-nopre</xsl:text>
267
 
          </xsl:if>
268
 
        </xsl:when>
269
 
        <xsl:otherwise>
270
 
          <xsl:if test="../@xml:space='preserve'">
271
 
            <xsl:text> media-ttml-pre</xsl:text>
272
 
          </xsl:if>
273
 
          <xsl:if test="../@xml:space='default'">
274
 
            <xsl:text> media-ttml-nopre</xsl:text>
275
 
          </xsl:if>
276
 
        </xsl:otherwise>
277
 
      </xsl:choose>
278
 
    </xsl:attribute>
 
262
    <xsl:call-template name="html.class.attr">
 
263
      <xsl:with-param name="class">
 
264
        <xsl:text>media-ttml</xsl:text>
 
265
        <xsl:choose>
 
266
          <xsl:when test="@xml:space">
 
267
            <xsl:if test="@xml:space='preserve'">
 
268
              <xsl:text> media-ttml-pre</xsl:text>
 
269
            </xsl:if>
 
270
            <xsl:if test="@xml:space='default'">
 
271
              <xsl:text> media-ttml-nopre</xsl:text>
 
272
            </xsl:if>
 
273
          </xsl:when>
 
274
          <xsl:otherwise>
 
275
            <xsl:if test="../@xml:space='preserve'">
 
276
              <xsl:text> media-ttml-pre</xsl:text>
 
277
            </xsl:if>
 
278
            <xsl:if test="../@xml:space='default'">
 
279
              <xsl:text> media-ttml-nopre</xsl:text>
 
280
            </xsl:if>
 
281
          </xsl:otherwise>
 
282
        </xsl:choose>
 
283
      </xsl:with-param>
 
284
    </xsl:call-template>
279
285
    <xsl:call-template name="html.lang.attrs">
280
286
      <xsl:with-param name="parent" select="../self::tt:tt"/>
281
287
    </xsl:call-template>
295
301
    </xsl:call-template>
296
302
  </xsl:variable>
297
303
  <div>
298
 
    <xsl:attribute name="class">
299
 
      <xsl:text>media-ttml-node media-ttml-div</xsl:text>
300
 
      <xsl:if test="@xml:space='preserve'">
301
 
        <xsl:text> media-ttml-pre</xsl:text>
302
 
      </xsl:if>
303
 
      <xsl:if test="@xml:space='default'">
304
 
        <xsl:text> media-ttml-nopre</xsl:text>
305
 
      </xsl:if>
306
 
    </xsl:attribute>
 
304
    <xsl:call-template name="html.class.attr">
 
305
      <xsl:with-param name="class">
 
306
        <xsl:text>media-ttml-node media-ttml-div</xsl:text>
 
307
        <xsl:if test="@xml:space='preserve'">
 
308
          <xsl:text> media-ttml-pre</xsl:text>
 
309
        </xsl:if>
 
310
        <xsl:if test="@xml:space='default'">
 
311
          <xsl:text> media-ttml-nopre</xsl:text>
 
312
        </xsl:if>
 
313
      </xsl:with-param>
 
314
    </xsl:call-template>
307
315
    <xsl:call-template name="html.lang.attrs"/>
308
316
    <xsl:copy-of select="@xml:space"/>
309
317
    <xsl:attribute name="data-ttml-begin">
338
346
    </xsl:call-template>
339
347
  </xsl:variable>
340
348
  <div>
341
 
    <xsl:attribute name="class">
342
 
      <xsl:text>media-ttml-node media-ttml-p</xsl:text>
343
 
      <xsl:if test="@xml:space='preserve'">
344
 
        <xsl:text> media-ttml-pre</xsl:text>
345
 
      </xsl:if>
346
 
      <xsl:if test="@xml:space='default'">
347
 
        <xsl:text> media-ttml-nopre</xsl:text>
348
 
      </xsl:if>
349
 
    </xsl:attribute>
 
349
    <xsl:call-template name="html.class.attr">
 
350
      <xsl:with-param name="class">
 
351
        <xsl:text>media-ttml-node media-ttml-p</xsl:text>
 
352
        <xsl:if test="@xml:space='preserve'">
 
353
          <xsl:text> media-ttml-pre</xsl:text>
 
354
        </xsl:if>
 
355
        <xsl:if test="@xml:space='default'">
 
356
          <xsl:text> media-ttml-nopre</xsl:text>
 
357
        </xsl:if>
 
358
      </xsl:with-param>
 
359
    </xsl:call-template>
350
360
    <xsl:call-template name="html.lang.attrs"/>
351
361
    <xsl:attribute name="data-ttml-begin">
352
362
      <xsl:value-of select="substring-before($beginend, ',')"/>
371
381
    </xsl:call-template>
372
382
  </xsl:variable>
373
383
  <span>
374
 
    <xsl:attribute name="class">
375
 
      <xsl:text>media-ttml-node media-ttml-span</xsl:text>
376
 
      <xsl:if test="@xml:space='preserve'">
377
 
        <xsl:text> media-ttml-pre</xsl:text>
378
 
      </xsl:if>
379
 
      <xsl:if test="@xml:space='default'">
380
 
        <xsl:text> media-ttml-nopre</xsl:text>
381
 
      </xsl:if>
382
 
    </xsl:attribute>
 
384
    <xsl:call-template name="html.class.attr">
 
385
      <xsl:with-param name="class">
 
386
        <xsl:text>media-ttml-node media-ttml-span</xsl:text>
 
387
        <xsl:if test="@xml:space='preserve'">
 
388
          <xsl:text> media-ttml-pre</xsl:text>
 
389
        </xsl:if>
 
390
        <xsl:if test="@xml:space='default'">
 
391
          <xsl:text> media-ttml-nopre</xsl:text>
 
392
        </xsl:if>
 
393
      </xsl:with-param>
 
394
    </xsl:call-template>
383
395
    <xsl:call-template name="html.lang.attrs"/>
384
396
    <xsl:attribute name="data-ttml-begin">
385
397
      <xsl:value-of select="substring-before($beginend, ',')"/>
395
407
</xsl:template>
396
408
 
397
409
<xsl:template mode="mal2html.inline.mode" match="tt:br">
398
 
  <br class="media-ttml-br"/>
 
410
  <br>
 
411
    <xsl:call-template name="html.class.attr">
 
412
      <xsl:with-param name="class" select="'media-ttml-br'"/>
 
413
    </xsl:call-template>
 
414
  </br>
399
415
</xsl:template>
400
416
 
401
417
 
428
444
    <xsl:when test="$if = ''"/>
429
445
    <xsl:when test="@type = 'image' or not(@type)">
430
446
      <div>
431
 
        <xsl:attribute name="class">
432
 
          <xsl:text>media media-image</xsl:text>
433
 
          <xsl:value-of select="$class"/>
434
 
          <xsl:if test="$if != 'true'">
435
 
            <xsl:text> if-if </xsl:text>
436
 
            <xsl:value-of select="$if"/>
437
 
          </xsl:if>
438
 
        </xsl:attribute>
 
447
        <xsl:call-template name="html.class.attr">
 
448
          <xsl:with-param name="class">
 
449
            <xsl:text>media media-image</xsl:text>
 
450
            <xsl:value-of select="$class"/>
 
451
            <xsl:if test="$if != 'true'">
 
452
              <xsl:text> if-if </xsl:text>
 
453
              <xsl:value-of select="$if"/>
 
454
            </xsl:if>
 
455
          </xsl:with-param>
 
456
        </xsl:call-template>
439
457
        <div class="inner">
440
458
          <xsl:call-template name="mal2html.media.image"/>
441
459
        </div>
443
461
    </xsl:when>
444
462
    <xsl:when test="@type = 'video'">
445
463
      <div>
446
 
        <xsl:attribute name="class">
447
 
          <xsl:text>media media-video</xsl:text>
448
 
          <xsl:value-of select="$class"/>
449
 
          <xsl:if test="$if != 'true'">
450
 
            <xsl:text> if-if </xsl:text>
451
 
            <xsl:value-of select="$if"/>
452
 
          </xsl:if>
453
 
        </xsl:attribute>
 
464
        <xsl:call-template name="html.class.attr">
 
465
          <xsl:with-param name="class">
 
466
            <xsl:text>media media-video</xsl:text>
 
467
            <xsl:value-of select="$class"/>
 
468
            <xsl:if test="$if != 'true'">
 
469
              <xsl:text> if-if </xsl:text>
 
470
              <xsl:value-of select="$if"/>
 
471
            </xsl:if>
 
472
          </xsl:with-param>
 
473
        </xsl:call-template>
454
474
        <div class="inner">
455
475
          <xsl:call-template name="mal2html.media.video"/>
456
476
        </div>
458
478
    </xsl:when>
459
479
    <xsl:when test="@type = 'audio'">
460
480
      <div>
461
 
        <xsl:attribute name="class">
462
 
          <xsl:text>media media-audio</xsl:text>
463
 
          <xsl:value-of select="$class"/>
464
 
          <xsl:if test="$if != 'true'">
465
 
            <xsl:text> if-if </xsl:text>
466
 
            <xsl:value-of select="$if"/>
467
 
          </xsl:if>
468
 
        </xsl:attribute>
 
481
        <xsl:call-template name="html.class.attr">
 
482
          <xsl:with-param name="class">
 
483
            <xsl:text>media media-audio</xsl:text>
 
484
            <xsl:value-of select="$class"/>
 
485
            <xsl:if test="$if != 'true'">
 
486
              <xsl:text> if-if </xsl:text>
 
487
              <xsl:value-of select="$if"/>
 
488
            </xsl:if>
 
489
          </xsl:with-param>
 
490
        </xsl:call-template>
469
491
        <div class="inner">
470
492
          <xsl:call-template name="mal2html.media.audio"/>
471
493
        </div>
481
503
 
482
504
<!-- = mal2html.inline.mode % media = -->
483
505
<xsl:template mode="mal2html.inline.mode" match="mal:media">
484
 
  <xsl:choose>
485
 
    <xsl:when test="@action | @xref | @href">
486
 
      <a>
487
 
        <xsl:attribute name="href">
488
 
          <xsl:call-template name="mal.link.target"/>
489
 
        </xsl:attribute>
490
 
        <xsl:attribute name="title">
491
 
          <xsl:call-template name="mal.link.tooltip"/>
492
 
        </xsl:attribute>
493
 
        <xsl:apply-templates mode="mal2html.inline.content.mode" select="."/>
494
 
      </a>
495
 
    </xsl:when>
496
 
    <xsl:otherwise>
497
 
      <xsl:apply-templates mode="mal2html.inline.content.mode" select="."/>
498
 
    </xsl:otherwise>
499
 
  </xsl:choose>
 
506
  <xsl:call-template name="mal2html.span"/>
500
507
</xsl:template>
501
508
 
502
509
<xsl:template mode="mal2html.inline.content.mode" match="mal:media">