#How to wrap the URL in the bibliography part

15 messages · Page 1 of 1 (latest)

blissful arch
#

Does anybody know how to get these URLs to wrap in the bib? It seems to be a problem with it using so many numbers. If I put a letter anywhere after the / it will wrap correctly (but ofcourse that would make the URL incorrect)

gleaming lintel
blissful arch
#

Ah, thank you. Ofcourse I should've checked the github issues ❤️

#

After putting #let mylink(url) = link(url,url.replace("/", "/" + str(sym.zws)).replace("-", "-"+ str(sym.zws)).replace(".", "."+ str(sym.zws)).replace("?", "?"+ str(sym.zws))) in my main it, and putting it in my .bib file it doesn't show the url in the pdf.

gleaming lintel
#

Though I haven't tried

blissful arch
#

Unfortunately the bibliography block doesn't allow to iterate through the entries, or their url's yet. So I think until then a #show argument won't work

fallow epoch
#

Yeah it’s kinda unfortunate

#

I think there should be some sort of bibliography.entry thing

#

Not sure if there is an issue for this already

gleaming lintel
#

you can always add the zero width spaces in the bib file, but then the links would presumably not be clickable anymore, which wouldn't be great

livid blade
#

unless you have really weird names in there, #show regex("https://[^\s]+") might work

blissful arch
#

I think I'm almost there. I'm using this, combining some of the info I found, but it doesn't seem to work:

  link(url.text,url.text.replace("/", "/" + str(sym.zws)).replace("-", "-"+ str(sym.zws)).replace(".", "."+ str(sym.zws)).replace("?", "?"+ str(sym.zws)))
}```
This does add the extra zero width space, afaik. But that doesn't seem to help with breaking the lines.
#

I found the solution. I thought it wasn't working but it was, I just had some non https sources. By adding a second regex operator I fixed it :).

#show regex("http://[^\s]+"): url => {
  link(url.text,url.text.replace("/", "/" + sym.zws).replace("-", "-"+ sym.zws).replace(".", "."+ sym.zws).replace("?", "?"+ sym.zws))
}
#

After some cleaning up, I made this function so it adds a zero width space after every letter. But only for the display text, the url destination stays the same:

#let breaklink(url) = link(url, for c in url [#c.replace(c,c+sym.zws)])

#show regex("https://[^\s]+"): url => {
  breaklink(url.text)
}

#show regex("http://[^\s]+"): url => {
  breaklink(url.text)
}