Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(packages): URLs are allowed many more breakpoints #1233

Merged
merged 1 commit into from
Sep 20, 2021

Conversation

Omikhleia
Copy link
Member

@Omikhleia Omikhleia commented Sep 18, 2021

Here is my proposal for #1229 - Compared to the ticket, I have ended up adding a bit more flexibility. Sounds good to me in all my tests so far (but I can't have a test submitted, as the url package needs the pdf package which needs the libtexpdf backend, not the debug backend - If I am not mistaken).

Besides a brute force test (see below), looks decent too in my "test" article:

image

(I would have preferred the _ tto have a break after it, not before, but toying with the penalty settings, it was not much better with a very dense line, so I think they are quite OK finally... But of course the default penalties are at best a wild guess)

The brute force test, if one wants to play with it - 12 pages of URLs 😸 - the decent scenario being of course the last.

\begin[papersize=6in x 9in]{document}
\script[src=packages/url]

\language[main=en]

1. Check the undocumented href is not broken

\href{https://my.site.org/proposition;2021/sile/test_url?name=Jack&age=50#hash-my-anchor}

2. Test url without language (default)

\script{
    local url = "https://my.site.org/proposition;2021/sile/test_url?name=John%20Doe&age=50#hash-my-anchor"
    for i = 7, 74 do
      SILE.typesetter:leaveHmode()
      for j = 1, i do
         SILE.typesetter:typeset("x")
      end 
      SILE.typesetter:typeset(" ")
      SILE.call("url", {}, { url }) 
    end
}

3a. test url with a language (English)

\script{
    local url = "https://my.site.org/proposition;2021/sile/test_url?name=John%20Doe&age=50#hash-my-anchor"
    for i = 7, 74 do
      SILE.typesetter:leaveHmode()
      for j = 1, i do
         SILE.typesetter:typeset("x")
      end 
      SILE.typesetter:typeset(" ")
      SILE.call("url", { language = "en" }, { url }) 
    end
}

\language[main=fr]

3b. test url with French: punctuation spacing rules should be disabled; except in this line!

\script{
    local url = "https://my.site.org/proposition;2021/sile/test_url?name=John%20Doe&age=50#hash-my-anchor"
    for i = 7, 74 do
      SILE.typesetter:leaveHmode()
      for j = 1, i do
         SILE.typesetter:typeset("x")
      end 
      SILE.typesetter:typeset(" ")
      SILE.call("url", { language = "fr" }, { url }) 
    end
}

\language[main=en]

4. test url with some flexible text content

\script{
    local url = "https://my.site.org/proposition;2021/sile/test_url?name=John%20Doe&age=50#hash-my-anchor"
    for i = 4, 44 do
      SILE.typesetter:leaveHmode()
      for j = 1, i do
         SILE.typesetter:typeset("x ")
      end 
      SILE.typesetter:typeset(" ")
      SILE.call("url", {}, { url }) 
    end
}

\end{document}

@alerque alerque added this to the v0.11.2 milestone Sep 18, 2021
@alerque alerque self-requested a review September 18, 2021 13:46
@alerque alerque added enhancement Software improvement or feature request modules:packages Issue relates to core or 3rd party packages labels Sep 18, 2021
Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The substance of what this does looks great, thanks for the contribution. Lets just shuffle the documentation around a little bit.

packages/url.lua Outdated Show resolved Hide resolved
packages/url.lua Outdated Show resolved Hide resolved
packages/url.lua Outdated Show resolved Hide resolved
packages/url.lua Show resolved Hide resolved
packages/url.lua Show resolved Hide resolved
@alerque alerque merged commit b145605 into sile-typesetter:master Sep 20, 2021
This was referenced Sep 20, 2021
@Omikhleia Omikhleia deleted the 1229-url-breakpoints branch June 18, 2022 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request modules:packages Issue relates to core or 3rd party packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants