Sometimes you want to write something with broken lines and you write in the editor:

That’s right I’m Sokka
It’s pronounced with an Okka
Young Ladies, I rocked ya!

But it ends up looking like this:

That’s right I’m Sokka It’s pronounced with an Okka Young Ladies, I rocked ya!

The fix is to add two spaces between the final character and the carriage return.

I don’t understand what the problem is. CR should be easy enough to translate, and the users intentions are clearly confirmed because they’re looking right at what the expect it to look like when they hit submit.

Why does the user have to add two spaces? Why is the universe like this?

Edit: Holy Shit, look, I’m just an idiot typing text expecting WYSIWYG and I don’t see a good reason for why I’m not getting it other than that programmers lack theory of mind.

  • historicaldocuments
    link
    fedilink
    arrow-up
    1
    ·
    6 hours ago

    You could probably get 80% of that process done by learning some python. If you have a string “s”, then replacing double newlines with a single newline is as easy as

    re.sub("\n\n", "\n", s)

    where “\n” is an LF in many programming languages. A CR is often “\r” in the same vein. Just be aware that regular expressions can be very, very frustrating; and every webpage is going to be a new adventure in how it got formatted. If you use something like spyder it’ll allow you to see what the data looks like inside the python process so you get a chance to iterate.