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

Widow protection doesn't work correctly and doesn't handle links. #167

Open
uandco opened this issue Feb 2, 2023 · 1 comment
Open

Widow protection doesn't work correctly and doesn't handle links. #167

uandco opened this issue Feb 2, 2023 · 1 comment
Assignees
Labels

Comments

@uandco
Copy link

uandco commented Feb 2, 2023

Describe the bug

Widow protection doesn't work correctly and doesn't handle links.

To reproduce

Create content with various word lengths at the end of paragraphs, and links with 2 words at the end of a paragraph.
Set dewidow settings to:

    // enables widow handling
    "set_dewidow" => true,

    // establishes maximum length of a widows that will be protected
    "set_max_dewidow_length" => 10,

    // establishes the maximum number of words considered for dewidowing.
    "set_dewidow_word_number" => 1,

    // establishes maximum length of pulled text to keep widows company
    "set_max_dewidow_pull" => 10,

Only a few paragraphs will be dewidowed correctly

Expected behaviour

Widow protection should be consistent and work in links too.

Screenshots

Original content:

<p>Return the bottom portion of your invoice with a cheque to:</p>
<p>Cheques should be made payable to Urban Utilities.</p>
<p>Testing dewidow thingy with a <a href="https://saslab.docker.amazee.io/services-we-offer#entry:14@1:url">short link</a></p>

Output:

<p>Return the bottom portion of your invoice with a&nbsp;cheque to:</p>
<p>Cheques should be made payable to Urban&nbsp;Utilities.</p>
<p>Testing dewidow thingy with a&nbsp;<a href="https://saslab.docker.amazee.io/services-we-offer">short link</a></p>

As you can see only the second paragraph is correct

@mundschenk-at
Copy link
Owner

Thanks for the detailed report, I'll look into it.

@mundschenk-at mundschenk-at self-assigned this Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants