`This is a link to example.org`:`This is a link to example.org`,
`This is a link to ftp://example.org`:`This is a link to ftp://example.org`,
`This is a link to www.example.org`:`This is a link to www.example.org`,
`This is a link to http://example.org`:`This is a link to <a href="http://example.org">http://example.org</a>`,
`This is a link to http://example.org, end of sentence.`:`This is a link to <a href="http://example.org">http://example.org</a>, end of sentence.`,
`This is a link to https://example.org`:`This is a link to <a href="https://example.org">https://example.org</a>`,
`This is a link to https://www.example.org/path/to?q=s`:`This is a link to <a href="https://www.example.org/path/to?q=s">https://www.example.org/path/to?q=s</a>`,
`This is a link to https://example.org/index#hash-tag, http://example.org/.`:`This is a link to <a href="https://example.org/index#hash-tag">https://example.org/index#hash-tag</a>, <a href="http://example.org/">http://example.org/</a>.`,
}
forinput,expected:=rangescenarios{
actual:=replaceTextLinks(input)
ifactual!=expected{
t.Errorf(`Unexpected link replacement, got "%s" instead of "%s"`,actual,expected)
description:=`<img src="https://imgs.xkcd.com/comics/thermostat.png" title="Your problem is so terrible, I worry that, if I help you, I risk drawing the attention of whatever god of technology inflicted it on you." alt="Your problem is so terrible, I worry that, if I help you, I risk drawing the attention of whatever god of technology inflicted it on you." />`
expected:=`<figure><img src="https://imgs.xkcd.com/comics/thermostat.png" alt="Your problem is so terrible, I worry that, if I help you, I risk drawing the attention of whatever god of technology inflicted it on you."/><figcaption><p>Your problem is so terrible, I worry that, if I help you, I risk drawing the attention of whatever god of technology inflicted it on you.</p></figcaption></figure>`
ifexpected!=output{
t.Errorf(`Not expected output: got "%s" instead of "%s"`,output,expected)
description:=`<img src="https://imgs.xkcd.com/comics/thermostat.png" alt="Your problem is so terrible, I worry that, if I help you, I risk drawing the attention of whatever god of technology inflicted it on you." />`
<figureclass="ht hu hv hw hx hy cy cz paragraph-image">
<divclass="hz ia ib ic aj">
<divclass="cy cz hs">
<divclass="ii s ib ij">
<divclass="ik il s">
<divclass="id ie t u v if aj bk ig ih">
<imgalt="Image for post"class="t u v if aj im in io"src="https://miro.medium.com/max/60/1*ephLSqSzQYLvb7faDwzRbw.jpeg?q=20"width="1280"height="720"/>
</div>
<imgalt="Image for post"class="id ie t u v if aj c"width="1280"height="720"/>
<noscript>
<imgalt="Image for post"class="t u v if aj"src="https://miro.medium.com/max/2560/1*ephLSqSzQYLvb7faDwzRbw.jpeg"width="1280"height="720"srcSet="https://miro.medium.com/max/552/1*ephLSqSzQYLvb7faDwzRbw.jpeg 276w, https://miro.medium.com/max/1104/1*ephLSqSzQYLvb7faDwzRbw.jpeg 552w, https://miro.medium.com/max/1280/1*ephLSqSzQYLvb7faDwzRbw.jpeg 640w, https://miro.medium.com/max/1400/1*ephLSqSzQYLvb7faDwzRbw.jpeg 700w"sizes="700px"/>
</noscript>
</div>
</div>
</div>
</div>
</figure>
`
expected:=`<img alt="Image for post" class="t u v if aj" src="https://miro.medium.com/max/2560/1*ephLSqSzQYLvb7faDwzRbw.jpeg" width="1280" height="720" srcset="https://miro.medium.com/max/552/1*ephLSqSzQYLvb7faDwzRbw.jpeg 276w, https://miro.medium.com/max/1104/1*ephLSqSzQYLvb7faDwzRbw.jpeg 552w, https://miro.medium.com/max/1280/1*ephLSqSzQYLvb7faDwzRbw.jpeg 640w, https://miro.medium.com/max/1400/1*ephLSqSzQYLvb7faDwzRbw.jpeg 700w" sizes="700px"/>`