Dokuwiki: Section edit changes produce invalid HTML in Wrap plugin

Created on 8 Apr 2018  路  6Comments  路  Source: splitbrain/dokuwiki

Since the section edit changes (#2220), the Wrap plugin now produces invalid HTML. When using the syntax example page there are 2 unclosed divs and another div is missing.

I'm not 100% sure if the method in question is just used wrongly by the plugin or if it's an issue in the core. Although after playing around a bit, I suspect it's in the core. And I am 100% sure it was caused by that change as it is fine in the parent commit.
See https://github.com/selfthinker/dokuwiki_plugin_wrap/issues/163 for more info.

Bug

All 6 comments

I will check it a.s.a.p..

I think in inc/html.php the code section

if (!defined('SEC_EDIT_PATTERN')) {
    define('SEC_EDIT_PATTERN', '#<!-- EDIT({.*?}) -->#');
}

has to be replaced with

if (!defined('SEC_EDIT_PATTERN')) {
    define('SEC_EDIT_PATTERN', '#<!-- EDIT({.*?}) -->#');
}

to make the pattern not greedy. Fixed at least unclosed elements with this wrap code:

<WRAP group>
<WRAP third column>
=== Widthsfdgh1 ===

You can set any valid widths (but only on divs): ''%, px, em, rem, ex, ch, vw, vh, pt, pc, cm, mm, in'', but most of the time you'd only want either

^type^e.g.^note^
^''%''|''30%''|makes sense in most cases|
^''px''|''420px''|makes sense if your container contains images with a certain width|
^''em''|''20em''|makes sense if you like your wrap container to grow and shrink with the font size|

</WRAP>
</WRAP>

Nested sections were not working due to the greedy pattern. Haven't got more time today. Will do more testing with the complete wrap example page in the next days.

I did not notice it before but in the bad case the edit button for the table (from plugin edittable) was missing because it was nested in a wrap section.

btw, to reduce eventually confusion, the first code example has a typo:
https://github.com/splitbrain/dokuwiki/blob/ec57f1190eb6df5ddeba76bb2c35b46d65d31561/inc/html.php#L11-L13

@Klap-in: aaargh, yes copy-and-paste. Thanks :thumbsup: (I guess I was tired)

@selfthinker: should be fixed now.

@splitbrain: sorry, accidentally pushed to master directly. That wasn't my intention - forgot git checkout issue2304.

Thanks @LarsGit223, I can confirm everything is valid again.

@splitbrain, GitHub has the option to protect branches, i.e. the master branch could be protected from pushing to without a PR (that can include or exclude administrators). I think it's generally worth having.

Was this page helpful?
0 / 5 - 0 ratings