Recent Topics

1 Mar 04, 2017 08:47    

when one wish to insert php code that reflects the correct code line number on submit it returns validation errors.

2 Mar 04, 2017 09:00


//Some sample code on line 4216

3 Mar 04, 2017 09:44

@achillis as is briefly mentioned here: http://plugins.b2evolution.net/prism-plugin, that's the expected result when Force valid XHTML is enabled. However, I agree we can clean up a little bit and reduce potential confusions.

The first thing that pop off my head is somehow excluding data-start from the XHTML validation, which is just a non-sense, or at least a contradiction.

A different approach would be, at a plugin level, detect what kind of validation will be applied and don't let the plugin to introduce data-start into the code (as is currently done when we leave line="1"), in order to avoid the validation error.

In addition to that, it would makes sense to warn the user that line numbers won't work due to the currently enabled restrictions (if they set anything different to 1, of course). Maybe something like the message in the screenshot below.

What do you think?

4 Mar 04, 2017 09:53

I guess that makes sense as a last resort, however it is a pity if one can't specify the line number.

5 Mar 04, 2017 10:56

@achillis that's right. The problem is that the data-start attribute used by the Prism plugin, is not valid XHTML.

Well, giving it a second thought, I found a different approach. Prism let developers to implement their own plugins, and the line numbers feature is a plugin itself. By duplicating it we can find a way to pass the line number avoiding the XHTML validation error.

In this sample code I did it including the line number into the title attribute of the <pre> tag (i doesn't mean that's the better attribute, but it does the trick :p): https://github.com/mgsolipa/b2evolution/commit/3da954123b1c36afe91bf55c0113c22bafc1574e

6 Mar 05, 2017 10:40

Looks very clever. Will go take a look. The only thing is that I use this more on b2evolution forums than my personal site.

7 Mar 05, 2017 21:32

@achillis well, it could also eventually end up as a pull request to be integrated into our standard code.


Form is loading...