michael-milette / moodle-filter_filtercodes

FilterCodes filter for Moodle enables content creators to easily customize and personalize course and site content using plain text tags (no HTML). For premium support, contact us at https://www.tngconsulting.ca/contact
https://moodle.org/plugins/filter_filtercodes
GNU General Public License v3.0
32 stars 43 forks source link

Interference with Tabs filter plugin? #215

Closed bryy00 closed 2 years ago

bryy00 commented 2 years ago

After installing FilterCodes I noticed an issue with the Book Module. In the Book Module, you create tabs using the {%1} fragment. As you know this is very much look alike the { } FilterCode tags. Moodle does no longer interpret the {%1} in the Book Module, so tabs are not created and worse, the content is displayed as raw html. FilterCodes works properly.

I am not 100% sure this issue wasn't there prior to installing FilterCodes, but just for now I wanted to check whether this behaviour rings a bell? I disabled and later on removed the FilterCodes plugin but both actions did not result in a better Book Module.

All recent versions.

michael-milette commented 2 years ago

Hi @bryy00 ,

I am not sure why FilterCodes would care about a tag called {%1}. It should ignore it completely unless there is another FilterCodes tag that is open before it but is missing its closing tag. If that is the case, it would use this tag's } as its closing tag. I think it unlikely that this is the problem but you never know.

That said, if there is an issue, I would really like to fix it but I would need your help in order to reproduce the issue. I am not familiar with creating tabs in the Book module as you described.

Could you either point me to some documentation on using that feature or upload a small course containing a book module with tabs configured as you described? It doesn't necessarily need to be a real course but should be enough to demonstrate and reproduce the issue you described.

If you disabled or uninstalled FilterCodes and the problem did not resolve itself, the issue will be unrelated to FilterCodes.

Best regards,

Michael

bryy00 commented 2 years ago

Hi Michael

Thank you for your insights. The plugin I referred to is called "Book" (just that) and is part of the standard Moodle. So, you probably have it already. There is some configuration but this is minor and not required.

To use the Book: On a course page, add a resource "Book", call it "Testbook" and click Save & display. Then, name the title "Testtitle" and provide as content: Hello world Click Save. On the course page, click the Testbook and view the result. It should be OK. Now re-open Testbook for editing and change the content into: {%:This is tab} Hello world {%} Save, and click the book. There should be a tab visible now. In my situation, there is no tab and the content is displayed in raw html.

On my side I will try to re-install the Book plugin (for that, have to find out how to do that with a core plugin).

best, Hans

jb-fol commented 2 years ago

“Tabs” is not a feature of the Book activity, it’s a third party plugin - https://moodle.org/plugins/filter_tabs

It may be impacting on/impacted by FilterCodes depending on code and/or the order in which the filters are applied.

Disable one filter but not the other and test. Do it again with the other filter and test. Change the priority and test.

michael-milette commented 2 years ago

That's what I suspected.

@bryy00 , let me know how the testing goes using the instructions @jb-fol recommended.

bryy00 commented 2 years ago

I have done some more testing.

FilterCodes OFF + Tabs OFF = text displayed as expected (no tab, {%} tags visible) FilterCodes ON + Tabs OFF = text disaplayed as expected (no tab, {%} tags visible) FilterCodes OFF + Tabs ON = text incorrectly displayed (tab OK but text in raw html) FilterCodes ON + Tabs ON = text incorrectly displayed (tab OK but text in raw html)

Changed priority of both plugins in the Filter management list. Any combination > makes no change.

In other words, whatever I do, the Tabs plugin does not deliver as it should.

I will have a backup restored from earlier days (prior to any FilterCode installation), and see how that looks.

Op di 17 mei 2022 om 13:57 schreef jb-fol @.***>:

“Tabs” is nota feature of the Book activity, it’s a third party plugin - https://moodle.org/plugins/filter_tabs

It may be impacting on/impacted by FilterCodes depending on code and/or the order in which the filters are applied.

Disable one filter but not the other and test. Do it again with the other filter and test. Change the priority and test.

— Reply to this email directly, view it on GitHub https://github.com/michael-milette/moodle-filter_filtercodes/issues/215#issuecomment-1128778250, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZGCR5KNNZUKRI7GAKDWVILVKOCULANCNFSM5WBUP2QA . You are receiving this because you were mentioned.Message ID: @.*** com>

jb-fol commented 2 years ago

So that suggests that the problem may be with the Tags filter and not FilterCodes.

Final check - uninstall FilterCodes and see if the Tabs filter works as expected.

jb-fol commented 2 years ago

I have installed the Tabs filter on a new 3.11 site with no other plugins installed- and can confirm that the problem is occurring as you describe.

Text without html tags shows the tab and text correctly. Text with html tags is mangled and shows the html code as follows:

<p>Tab text</p>

You need to raise this with the Tabs filter maintainer. It is not a FilterCodes issue.

bryy00 commented 2 years ago

We suspect that in the course of the installation of the other plugin (FilterCodes, for sure unrelated to the issue), on our Moodle 3.11 server, also the Tabs plugin was updated. This meant that the working 3.x version was replaced by a 4.x version which has a bug for 3.x environments. We re-installed the 3.x version of Tabs (using the config file of 4 because we didn't get Moodle so far that it would install an older plugin) and this solved the issue.