I'd like to share some thoughts about the present behaviour of the <nolink> tag in Moodle (using version 1.5.3 stable).
1- Usefulness of the <nolink> tag
There are a number of reasons why a teacher would want to prevent the "overzealous" automatic linking of Glossary entries in his course resources. It is possible to restrict the automatic linking to one occurrence per page or one per text, by using these lines in \moodle\config.php
$CFG->filtermatchoneperpage = true; //To autolink each term only once per page
$CFG->filtermatchonepertext = true; //To autolink each term once per text block
It is also possible to use either the <nolink></nolink> or the <span class="nolink"></span> tag in passages of HTML documents or whole HTML documents (resources, forums, lessons, quizzes, etc.).
2- Using the "Prevent automatic linking" button in the HTML editor
If you use this button to prevent automatic linking and apply it to a selection of text which contains already formatted passages (i.e. italics, font color, heading, etc.), it will remove all of your formatting when surrounding your selection with the <span class="nolink"></span> tag.
Workaround A: do not format any part of your text if you plan to Prevent automatic linking in some parts (or the whole) of it. Type all of your text, apply the Prevent automatic linking and only then can you format your text as you want.
Workaround B: do not use the Prevent automatic linking button. When you have finished typing your text, click on the Toggle HTML Source button, add <nolink> right at the beginning of the code and </nolink> right at the end. I always do this.
3- Restricted use of the "nolink" class
The <span class="nolink"></span> tag was introduced in version 1.5 (I think) but the former <nolink></nolink> is still valid in current versions. Unfortunately the "class" interpretation has not been implemented to its fullest, I think. At the moment, using the two linking-prevention systems, here is what works (no links) and what does not work (links).
result |
|
1- <span class="nolink"><p>...</p></span> |
no links |
2- <nolink><p>...</p></nolink> | no links |
3- <div class="nolink">...</div> | links |
4- <p class="nolink">...</p> | links |
5- no links-preventing | links |
The way the "nolink" class is implemented at the moment does not conform to strict HTML syntax, as it leads to a) a mixture of tags belonging to different levels in the DOM hierarchy and b) the mere impossibility to use the "nolink" class within HTML tags other than <span>, as shown above. In fact, I do not see what we have gained over the former system with the introduction of the "nolink" class since its use is strictly limited to the <span> tag.
Can we hope to have an implementation more compliant with HTML syntax in further versions of Moodle?
Joseph