zepinglee / citeproc-lua

A Lua implementation of the Citation Style Language (CSL)
MIT License
62 stars 7 forks source link

Prevent hyphenation of urls in references #12

Closed hrv1999 closed 2 years ago

hrv1999 commented 2 years ago

When citeproc-lua with lualatex is used, the url gets hyphenated, which makes them unusable! I have provided a MWE here and can anyone please tell from where did (Original Work Published) come in the output?

\documentclass[12pt,abstract = true,toc = flat,toc = bib]{scrreprt}
\usepackage[english]{babel}
\usepackage[hidelinks]{hyperref}
\usepackage{citation-style-language}
\cslsetup{style = apa}
\addbibresource{example.bib}
\begin{filecontents}{example.bib}
@article{baillie_deliver_2021,
    title = {A Long url},
    url = {https://www.hydrocarbonprocessing.com/magazine/2021/september-2021/catalysts/deliver-high-levels-of-sox-reduction-with-sox-reduction-additive},
    journal = {this url gets hyphenated},
    author = {Test},
    month = march,
    year = {2022},
},
        @article{responsetoukaraniancrisis,
            title = {BAPS Responds to Ukrainian Humanitarian Crisis, Poland},
            url = {https://www.baps.org/Photos/2022/Emergency-Response-in-Rzesz243w-Poland-24266.aspx?mid=226449},
            journal = {BAPS News UK and Europe},
            author = {BAPS},
            month = march,
            year = {2022}
    }

\end{filecontents}
\begin{document}
    \nocite{*}
    \printbibliography
\end{document}

Output (check second reference) 2022-03-06 21_43_20-Greenshot

zepinglee commented 2 years ago

Thanks for your feedback! It seems that the URL is not correctly wrapped in the \url command by the citeproc-lua engine. https://github.com/zepinglee/citeproc-lua/blob/0c17cb4d46be97d5d41d56079c22d5c0faa2b534/citeproc/citeproc-formats.lua#L172-L174

hrv1999 commented 2 years ago

Thanks for your feedback! It seems that the URL is not correctly wrapped in the \url command by the citeproc-lua engine.

https://github.com/zepinglee/citeproc-lua/blob/0c17cb4d46be97d5d41d56079c22d5c0faa2b534/citeproc/citeproc-formats.lua#L172-L174

So, what would i have to do or change in the file? I am not from coding background, i have installed this with citation-style-language package from CTAN through tlmgr in windows 11, i couldn't even successfully install citeproc-lua with l3build. Please tell me what i have to do to fix this url in step by step manner if possible. My report submission deadline is near and i really need this fix. Thank you!

zepinglee commented 2 years ago

So, what would i have to do or change in the file? I am not from coding background, i have installed this with citation-style-language package from CTAN through tlmgr in windows 11, i couldn't even successfully install citeproc-lua with l3build. Please tell me what i have to do to fix this url in step by step manner if possible. My report submission deadline is near and i really need this fix. Thank you!

It is quite complicated. I dug into the internal data structure but have't found the source of this bug yet.

BTW this package is in early development stage at the time being and is not ready for use in serious occasions. I recommend using the biblatex-apa package.

zepinglee commented 2 years ago

It should be fixed in b34ef02b. You may try the issue#12 branch.