Aspell - Displaying of HTML codes fixed maybe?

Aspell - Displaying of HTML codes fixed maybe?

by Dale Davies -
Number of replies: 0
I believe I may have fixed the spell checker so that it does not show HTML tags in the spell check window. I had some complaints of users, even though I understand the HTML perfectly, they thought that this was a bug.

Anyway, Im no great programmer but I managed to follow the code and traced functions back to where they were defined. The problem is that even though Ive got it to work, Im not entirely sure if there will be any problems arising from what I have done.

Im using Moodle 1.8 on a Windows server running Apache (xampp)...

Essentially Ive just commented out the following lines (shown below in red) from function printForHtml() (in the wordWindw.js file)...


// Hack to prevent HTML tags displaying in aspell...

function printForHtml( n ) {
var htmlstr = n;
if( htmlstr.length == 1 ) {
// do simple case statement if it's just one character
// switch ( n ) {
// case "\n":
// htmlstr = '<br/>';
// break;
// case "<":
// htmlstr = '&lt;';
// break;
// case ">":
// htmlstr = '&gt;';
// break;
// }
return htmlstr;
} else {
// htmlstr = htmlstr.replace( /</g, '&lt' );
// htmlstr = htmlstr.replace( />/g, '&gt' );
// htmlstr = htmlstr.replace( /\n/g, '<br/>' );
return htmlstr;
}
}


Also Ive changed a line in the spellchecker.php file. My understanding of this is that it will stop image alt tags from being spell checked. So change this...

$aspell_opts = '-a -H --lang='. $lang .' --encoding=utf-8';

To this (found in another post in this forum)...

$aspell_opts = '-a --lang='. $lang .' --encoding=utf-8 -H --rem-sgml-check=alt';


I hope this might be helpful to someone, if there is anyone out there can better understand the implications of these changes I would love to know. It seems to work, but Im not sure if it will break something else.

Many thanks smile
Average of ratings: -