Skip to content

Commit

Permalink
Add support for title on <audio>, <video>
Browse files Browse the repository at this point in the history
Closes GH-49.

Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
  • Loading branch information
wooorm committed May 25, 2019
1 parent 2b6df07 commit 785b144
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/handlers/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var needed = require('../util/wrap').needed

function media(h, node) {
var nodes = all(h, node)
var title = node.properties.title
var poster = is(node, 'video') ? node.properties.poster : null
var src = node.properties.src
var children = node.children
Expand Down Expand Up @@ -50,7 +51,7 @@ function media(h, node) {
// Link to the media resource.
return {
type: 'link',
title: null,
title: title || null,
url: resolve(h, src),
children: nodes
}
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/audio/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@
<track kind=subtitles src=example.en.vtt srclang=en label=English>
<p><a href=example.ogg>Foxtrot</a>.</p>
</audio>

<p><audio src=example.ogg title=Golf>Hotel</audio></p>
2 changes: 2 additions & 0 deletions test/fixtures/audio/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
[Echo](example.ogg).

[Foxtrot](example.ogg).

[Hotel](example.ogg "Golf")
2 changes: 2 additions & 0 deletions test/fixtures/video/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@
<track kind=subtitles src=example.en.vtt srclang=en label=English>
<p><a href=example.ogv>India</a>.</p>
</video>

<p><video src=example.ogv title=Juliett>Kilo</video></p>
2 changes: 2 additions & 0 deletions test/fixtures/video/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
[Hotel](example.ogv).

[India](example.ogv).

[Kilo](example.ogv "Juliett")

0 comments on commit 785b144

Please sign in to comment.