ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: Frenzie on April 05, 2016, 06:44:22 am

Title: Footnotes eat newlines when used at the end of a line
Post by: Frenzie on April 05, 2016, 06:44:22 am
Example.[1]

Another paragraph.

A third paragraph.

And here we stick in only one linebreak.[2]
Newline.
Blabla
lala
Title: Re: Footnotes eat newlines when used at the end of a line
Post by: Frenzie on April 21, 2016, 08:26:57 am
Looking into this, setting BLOCK_LEVEL to false removes the problem. I assume it's set to true for nesting reasons or some such? Assuming the block level setting is important, I'd propose changing line 372 (https://github.com/elkarte/Elkarte/blob/6688462a90625a807091a670f04fd8f81a6a9873/sources/subs/BBC/BBCParser.class.php#L372) as follows to resolve the issue:

if ($tag[Codes::ATTR_BLOCK_LEVEL] && $tag[Codes::ATTR_TAG] !== 'footnote' && isset($this->message[$this->pos]) && substr_compare($this->message, '<br />', $this->pos, 6) === 0)
Title: Re: Footnotes eat newlines when used at the end of a line
Post by: Spuds on April 21, 2016, 10:10:50 am
I think that is what will be needed, footnotes are kind of special.

Josh has a good testbed for the parser here: https://github.com/joshuaadickerson/BBC-Parser under the tests area.  We should get in the habit of running that when making changes to the parser just to avoid (even more) unforeseen consequences!
Title: Re: Footnotes eat newlines when used at the end of a line
Post by: Frenzie on April 21, 2016, 11:29:42 am
Unit tests ftw, except I'm not really sure how to run these tests or anything. xD