2014-04-26 21 views
3

這是HTML音頻標籤:如何在Ruby Slim中格式化音頻標籤?

<audio controls autoplay loop muted> 
<source src="horse.ogg" type="audio/ogg"> 
<source src="horse.mp3" type="audio/mpeg"> 
Your browser does not support the audio tag. 
</audio> 

這是怎麼寫的修身代碼,包括控制,自動播放和循環屬性?

回答

5

您可以在Slim中獲得boolean attributes的空屬性。我猜你的HTML片段轉換爲這樣的事情:

audio controls=true autoplay=true loop=true muted=true 
    source src="horse.ogg" type="audio/ogg" 
    source src="horse.mp3" type="audio/mpeg" 

    | Your browser does not support the audio tag. 

或更短

audio(controls autoplay loop muted) 
    …