justinhunt / moodle-filter_generico

Generic Filter
9 stars 11 forks source link

@@AUTOID@@ not consistant #44

Open mattgig opened 1 year ago

mattgig commented 1 year ago

When you add an @@AUTOID@@ to the "body of template X" section and again to the "End tags (template X") section in Moodle 4.2, two different strings are generated.

image

The above template results in two different AUTOIDs:

image

This is contrary to what you would expect, namely the AUTOID to be consistant within the filter area. And it makes selecting corresponding DOM elements very difficult.

Is this the intended behaviour or a bug?

justinhunt commented 1 year ago

Yes you are correct that it is inconsistent. It should not be this way, but I have not yet figured out how to implement it. This is because the start and close tags are treated as two separate filter strings, witjh two separate passes of the filter processing script.

In practice I just do all the processing that requires the @@AUTOID@@ in the start tag or js, and leave only static html in the end tag. But sometimes that really does make it hard.