Skip to main content
Topic: Smiley and footnotes (Read 6069 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Smiley and footnotes

A smiley: :)

A footnote[1]

A smiley after the footnote: :)

The smiley before the footnote renders, the one after no.

BUGZ!
Something
Bugs creator.
Features destroyer.
Template killer.

Re: Smiley and footnotes

Reply #1

moar pain !

Re: Smiley and footnotes

Reply #2

The old problem (that is likely the same this time) was that the parses cuts at \r (IIRC) to identify the blocks to parse and parses any other one (all the odds I think), but when the footnotes is present, in order to... I don't remember why, a \r is added that is not paired with a corresponding one and the counting breaks.
Bugs creator.
Features destroyer.
Template killer.

Re: Smiley and footnotes

Reply #3

I even found the two commits:
https://github.com/elkarte/Elkarte/commit/85b61e1acaa2406645a28cc451c859b81f7f4ea0
https://github.com/elkarte/Elkarte/commit/cef7d23473c1e8e239f9fc5ce2b82323a745d64a
the changes seem to be still there, so it may be some other side-effect.
This parser is (still) pretty fragile... :-\
Bugs creator.
Features destroyer.
Template killer.

Re: Smiley and footnotes

Reply #4

As a test I reverted
https://github.com/elkarte/Elkarte/commit/85b61e1acaa2406645a28cc451c859b81f7f4ea0#diff-77070835a61e61758d87314cb3c2ad65L1205
and
https://github.com/elkarte/Elkarte/commit/85b61e1acaa2406645a28cc451c859b81f7f4ea0#diff-77070835a61e61758d87314cb3c2ad65L1207

And the second smiley rendered correctly.   Were those two changes just for this testcase or are there others that it fixed?


Re: Smiley and footnotes

Reply #6

Ah .. but then a smiley inside of the footnote does not render LOL

Re: Smiley and footnotes

Reply #7

OK .. I think reverting those changes inside of footnoteCallback() and then changing the following code in handleFootnotes() may fix the issue.

Code: (find) [Select]
			$this->message .= '<div class="bbc_footnotes">' . implode('', $this->fn_content) . '</div>';
Code: (replace) [Select]
			$this->message .=  $this->smiley_marker . '<div class="bbc_footnotes">' . implode('', $this->fn_content) . '</div>' . $this->smiley_marker;

Re: Smiley and footnotes

Reply #8

 emanuele feels we need a test as well. :P
Bugs creator.
Features destroyer.
Template killer.

 

Re: Smiley and footnotes

Reply #9

Yeah I'll add one to the parser tests when I make the above PR ... most times when we get a bug we should really add a  coverage test  :(

Re: Smiley and footnotes

Reply #10

Fixed at some point.
Bugs creator.
Features destroyer.
Template killer.

Re: Smiley and footnotes

Reply #11

With a test :D

Re: Smiley and footnotes

Reply #12

Code: [Select]
Footnote directly at the end of line.[footnote]Footnote[/footnote]

Should be an empty line in between.

Footnote directly at the end of line.[1]

Should be an empty line in between.

Traditional workaround:
Code: [Select]
Footnote not directly at the end of line, but with an extra space at the end.[footnote]Footnote[/footnote] 

Should be an empty line in between.

Footnote not directly at the end of line, but with an extra space at the end.[2]

Should be an empty line in between.

Workaround for the sake of testing:
Code: [Select]
Footnote not directly at the end of line, but with an extra [i]thin[/i] space at the end.[footnote]Footnote[/footnote] 

Should be an empty line in between.

Footnote not directly at the end of line, but with an extra thin space at the end.[3]

Should be an empty line in between.

Edit: same problem in the OP btw.
Code: [Select]
A footnote[footnote]Something[/footnote]

A smiley after the footnote: :)

So basically the easy space workaround has been broken. NOOOOO! :P
Footnote
Footnote
Footnote

Re: Smiley and footnotes

Reply #13

I think we should drop footnotes as to hard, can't fix !

Re: Smiley and footnotes

Reply #14

lol, but they're so nice!