[Duplicate] MyCode problem since 1.8.15
#21
I've done some testing and the problem is because images are now parsed before custom MyCode.

There are a couple of options that way work:
  • Change your custom MyCode to just the following:

    \[img_noresize\](.*?)\[/img_noresize\]
    

    You'd also obviously need to update existing posts in the database. If you're using MariaDB or MySQL 8+, you should be able to do this with a query something like the following (untested, as I only have Postgres installed locally and not MySQL...):

    UPDATE mybb_posts SET message = REGEX_REPLACE(message, '\\[img_noresize\\]\\[img\\](.*?)\\[\\/img\\]\\[/img_noresize\\]', '[img_noresize]\\1[/img_noresize]');
    

  • We'd need to alter the MyBB core to add a new custom MyCode option to allow certain custom MyCodes to be parsed before all other built in custom MyCodes. This would be a big change, and would need quite a lot of testing - as you've seen, the parser is very fragile and extremely easy to break completely. We're also planning on implementing a completely new parser fairly soon, so I'm not sure how wise it would be to spend development time on a change of this magnitude...
Reply
#22
Hi Euan T,

Thank you your feedback. However, your proposal does work for images only and not for attachments ([attachmend=xy]) as it did before.

(2018-12-01, 03:47 PM)Euan T Wrote: There are a couple of options that way work:
One working option would really be enough.... Wink

(2018-12-01, 03:47 PM)Euan T Wrote: ....as you've seen, the parser is very fragile and extremely easy to break completely.
I fully understand and that's the reason why it is really difficult to understand why the parser have been changed with MyBB 1.8.15. If we would talk about an big upgrade like from MyBB 1.6 to 1.8 or 1.8 to 1.9 I could agree on doing such grave changes. But within a small MyBB upgrade it is really a mess.... Sad
My Plugins on MyBBoard.de
(english descriptions included)
Reply
#23
The change was introduced here: https://github.com/mybb/mybb/commit/dfc2...816df068ac

That change was made to fix an issue caused by another change here: https://github.com/mybb/mybb/pull/2968

That change was necessary to ensure URLs are properly parsed in more cases.

The fact your original MyCode worked seems to have been a complete coincidence unfortunately. Would it be possible to alter the MyCode to instead just match:

\[img_noresize\](.*?)\[/img_noresize\]

And have the replacement be something like:

<div class="no_resize">$1</div>

You'd likely have to alter your CSS a little (eg: to match something like ".no_resize img"), but it should allow you to achieve what you need.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)