Rct567 / FrequencyMan

An Anki plugin to sort your new cards.
GNU General Public License v3.0
4 stars 0 forks source link

<br> is deleted, leaving no space #6

Closed aleksejrs closed 5 months ago

aleksejrs commented 5 months ago

Fixed by adding "br|" in val = re.sub(r'</?(p|div|blockquote|h[1-6]|ul|ol|li|table|tr|td|th)([^>]*)>', ' ', val, flags=re.IGNORECASE) in text_processing.py.

Rct567 commented 5 months ago

That's expect behavior. <br> is an inline element and should not represent space or be able to divide words.

As someone else mentioned in the other issue you opened, it's best to correct the notes themselves if you're having issues with this.

aleksejrs commented 5 months ago

That's expect behavior. <br> is an inline element and should not represent space or be able to divide words.

What the hell?

These pages suggest using it for poems and addresses (with no extra spaces): https://www.w3.org/TR/2011/WD-html5-author-20110809/the-br-element.html https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br https://www.w3schools.com/tags/tag_br.asp

Pressing Enter in the note editor adds a <br> (at least unless you do after an existing div or an HTML list). movies2anki turns line breaks in subtitles into <br> and/or joins lines with it.

As someone else mentioned in the other issue you opened, it's best to correct the notes themselves if you're having issues with this.

I think mortii just wants to avoid adding even a bit of code: https://github.com/mortii/anki-morphs/issues/142

Rct567 commented 5 months ago

Fair enough. I'll look into it.