Moodle Community Sites
  1. Moodle Community Sites
  2. MDLSITE-564

Small problem with moodledocs filter (now disabled)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Component/s: moodle.org
    • Labels:
      None
    • Rank:
      25427

      Description

      The moodledocs filter was messing with some of the emoticons:

      eg this page (http://moodle.org/mod/forum/discuss.php?d=91667) had this fragment at the bottom:

      Cheers and let's get working on Moodle 2.0 (ok, wait until tomorrow <img alt="wink" width="15" height="15" src="http://moodle.org/pix/s/wink.gif" />)<br /><br />Martin <img alt="<a href="http://docs.moodle.org/en/martin" title="Moodle Docs: martin">martin</a>" width="15" height="15" src="http://moodle.org/pix/s/martin.gif" />

      Notice that "martin" got converted and "wink" did not - I don't know why.

      I disabled the filter until you can look at it, Eloy. Thanks!

      1. weblib.php.patch.txt
        0.7 kB
        Eloy Lafuente (stronk7)

        Activity

        Hide
        Eloy Lafuente (stronk7) added a comment -

        Yup, moodledocs filter is messing those emoticons because emoticons use to have one alt text based in lang string... and some of the emoticons haven't such corresponding lang string (for example: "martin").

        So [[martin]] is returned by get_string() and, anything between double square brackets is processed by the moodledocs filter.

        Solutions:

        1) Tweak the filter to exclude links, tags and other exceptions. Will cause the filter to be really slower. -1
        2) Make the [[docs:xxxx]] prefix mandatory. That way we won't have conflicts at all. MD votes -1 here (yes, I know) :-P
        3) Complete the lang strings for all those emoticons not having it. +1
        4) Tweak the replace_smilies() function to clean those opening and closing double square brackets so this won't happen in the future if some string is missing. +1 (1-line patch attached).

        Adding Helen here because we were guessing (and blaming :-P ) the responsible for the MoodleDocs filter to be disabled in moodle.org! LOL!

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Yup, moodledocs filter is messing those emoticons because emoticons use to have one alt text based in lang string... and some of the emoticons haven't such corresponding lang string (for example: "martin"). So [ [martin] ] is returned by get_string() and, anything between double square brackets is processed by the moodledocs filter. Solutions: 1) Tweak the filter to exclude links, tags and other exceptions. Will cause the filter to be really slower. -1 2) Make the [ [docs:xxxx] ] prefix mandatory. That way we won't have conflicts at all. MD votes -1 here (yes, I know) :-P 3) Complete the lang strings for all those emoticons not having it. +1 4) Tweak the replace_smilies() function to clean those opening and closing double square brackets so this won't happen in the future if some string is missing. +1 (1-line patch attached). Adding Helen here because we were guessing (and blaming :-P ) the responsible for the MoodleDocs filter to be disabled in moodle.org! LOL! Ciao
        Hide
        Martin Dougiamas added a comment -

        Great, thanks Eloy! Sorry Helen, I should have added you here.

        I implemented the patch (4) in 1.9 and HEAD to help all sites with custom icons.

        Show
        Martin Dougiamas added a comment - Great, thanks Eloy! Sorry Helen, I should have added you here. I implemented the patch (4) in 1.9 and HEAD to help all sites with custom icons.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development