And here's the one line of code I had to add to my filter to fix the problem (preceded by a five-line comment explaining what it's for and why it works):
1 while ($value =~ s/\n([^ \t])/\n $1/g);
Yes, it's written in #Perl. I still write stuff in Perl when it's the right tool for the job. Simple tasks that revolve around text processing are more easily done in Perl than any other language, IMO.
A 🏆 to the first person who can explain why the fix is a loop instead of a single search/replace.
=> More informations about this toot | View the thread | More toots from jik@federate.social
=> View perl tag This content has been proxied by September (ba2dc).Proxy Information
text/gemini