0
現在,這是我的html:如何使用nokogiri在文本中嵌入元素?
<div class="cardtextbox"><i>(<img src="/Handlers/Image.ashx?size=small&name=BR&type=symbol" alt="Black or Red" align="absbottom" /> can be paid with either <img src="/Handlers/Image.ashx?size=small&name=B&type=symbol" alt="Black" align="absbottom" /> or <img src="/Handlers/Image.ashx?size=small&name=R&type=symbol" alt="Red" align="absbottom" />.)</i></div><div class="cardtextbox"><img src="/Handlers/Image.ashx?size=small&name=3&type=symbol" alt="3" align="absbottom" /><img src="/Handlers/Image.ashx?size=small&name=B&type=symbol" alt="Black" align="absbottom" />, Discard a card: Target creature gets -2/-2 until end of turn.</div><div class="cardtextbox"><img src="/Handlers/Image.ashx?size=small&name=3&type=symbol" alt="3" align="absbottom" /><img src="/Handlers/Image.ashx?size=small&name=R&type=symbol" alt="Red" align="absbottom" />: Put a 2/1 red Goblin creature token with haste onto the battlefield. Exile it at the beginning of the next end step.</div></div>
而我想獲得:從紅色=> R
[
["(B/R can be paid with either B or R.)"],
["3 B, Discard a card", "Target creature gets -2/-2 until end of turn"],
["3 R", "Put a 2/1 red Goblin creature token with haste onto the battlefield. Exile it at the beginning of the next end step."]
]
映射經由colorhash
完成。紅色來自img
標記,alt
屬性。