Skip to content

Commit 785b144

Browse files
authored
Add support for title on <audio>, <video>
Closes GH-49. Reviewed-by: Christian Murphy <[email protected]>
1 parent 2b6df07 commit 785b144

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

lib/handlers/media.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var needed = require('../util/wrap').needed
1111

1212
function media(h, node) {
1313
var nodes = all(h, node)
14+
var title = node.properties.title
1415
var poster = is(node, 'video') ? node.properties.poster : null
1516
var src = node.properties.src
1617
var children = node.children
@@ -50,7 +51,7 @@ function media(h, node) {
5051
// Link to the media resource.
5152
return {
5253
type: 'link',
53-
title: null,
54+
title: title || null,
5455
url: resolve(h, src),
5556
children: nodes
5657
}

test/fixtures/audio/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@
2727
<track kind=subtitles src=example.en.vtt srclang=en label=English>
2828
<p><a href=example.ogg>Foxtrot</a>.</p>
2929
</audio>
30+
31+
<p><audio src=example.ogg title=Golf>Hotel</audio></p>

test/fixtures/audio/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
[Echo](example.ogg).
1010

1111
[Foxtrot](example.ogg).
12+
13+
[Hotel](example.ogg "Golf")

test/fixtures/video/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@
4343
<track kind=subtitles src=example.en.vtt srclang=en label=English>
4444
<p><a href=example.ogv>India</a>.</p>
4545
</video>
46+
47+
<p><video src=example.ogv title=Juliett>Kilo</video></p>

test/fixtures/video/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
[Hotel](example.ogv).
1616

1717
[India](example.ogv).
18+
19+
[Kilo](example.ogv "Juliett")

0 commit comments

Comments
 (0)