Issue Details (XML | Word | Printable)

Key: MDL-17698
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Helen Foster
Reporter: David Horat
Votes: 0
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Help files (en_utf8) do not comply with XHTML 1.0 Strict

Created: 19/Dec/08 10:47 PM   Updated: 06/May/09 05:49 PM
Component/s: Accessibility
Affects Version/s: 1.9.3
Fix Version/s: 1.9.6

File Attachments: 1. Text File language.log (280 kB)
2. GZip Archive moodle-xhtml-checker-0.1.tar.gz (387 kB)

Issue Links:
Dependency
 

Participants: Daniele Cordella, David Horat, Eloy Lafuente (stronk7), Helen Foster and Koen Roggemans
Security Level: None
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
Help files (at least en_utf8) that do not comply with XHTML 1.0 Strict and the first error found for each file:

127.0.0.1/moodle/help.php?file=reading.html:124:37:3086136980.65:E: document type does not allow element "p" here; missing one of "object", "ins", "del", "map", "button" start-tag
127.0.0.1/moodle/help.php?file=text.html:123:32:3085817492.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=wiki&file=howtowiki.html:118:66:3086960276.108:E: there is no attribute "target"
127.0.0.1/moodle/help.php?module=data&file=usepreset.html:112:95:3087222420.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=data&file=participants.html:112:95:3087009428.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=moodle&file=textformat.html:137:4:3087730324.79:E: end tag for element "ul" which is not open
127.0.0.1/moodle/help.php?module=wiki&file=htmlmode.html:115:3:3087165076.65:E: document type does not allow element "dl" here; missing one of "object", "ins", "del", "map", "button" start-tag
127.0.0.1/moodle/help.php?module=data&file=savepreset.html:112:95:3087554196.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=data&file=fields.html:112:95:3087738516.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?file=participantswithselectedusers.html:113:9:3086415508.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=resource&file=window.html:127:4:3086124692.65:E: document type does not allow element "b" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eloy Lafuente (stronk7) added a comment - 20/Dec/08 01:06 AM
Assigning to Helen... could you, plz, take a look to all those help files and make them to validate properly? TIA!

Daniele Cordella added a comment - 20/Dec/08 02:01 AM
Helen and David
I tried to correct the help files in italian but I noticed that only by changing
'<P ' to '<p '
'</P>' to '</p>'
'align=center' to 'align="center"'
'ALIGN=CENTER' to 'align="center"'
'<FONT' to '<font
'</FONT>' to '</font>
'<B>' to '<b>' or, better, '<strong>'
'</B>' to '</b>' or, better, '</strong>', most of the problems left.
Maybe it can be of help a bulk substitution in all moodledata/lang.
Hoping this may be of help for Moodle. Merry Xmas.

David Horat added a comment - 20/Dec/08 04:06 AM
Hello Daniele,

Thank you very much for your effort. I think that this issue should be check manually for all help files in all languages. The current problem is that we can not automate the process of correcting the file because of several reasons:

  • Using automatic replacement should be avoided because "<P" could be in other contexts, so it should be checked manually.
  • Using automatic html to xhtml apps should be avoided because the code is not complete and it has also some errors

The most common mistakes I have found in help files are:

  • Capitalization of elements and attributes. <P ID="hola"> should be <p id="hola">
  • Use of quotes avoided. <p id=hola> should be <p id="hola">
  • Use of stylistic elements: <b> should not be used but <strong> and <i> should not be used but <em>
  • Not closing tags: in XHTML all tags must be closed. Example: <p>Hello should be <p>Hello</p>
  • Bad closed tags: <p>Hello<p> should be <p>Hello</p>

But probably there are some more out there ...

To make your work easier you can use the W3C Validator:
http://validator.w3.org/#validate_by_input+with_options

Be sure to specify the option "Validate HTML Fragment" to XHTML 1.0


Helen Foster added a comment - 20/Dec/08 08:33 AM
David, thanks for reporting this issue, and Daniele, thanks for your comments

Adding Koen as a watcher for advice on how best to ensure help files in all languages validate.


Koen Roggemans added a comment - 20/Dec/08 07:41 PM
I'm afraid it should be done manually. It's a little bit sad this problem crops up again - I went through the all the language packs somewhere around 1.5 or 1.6 I think. Very time consuming.

David Horat added a comment - 21/Dec/08 03:40 AM
Initial report with all the language help files that do not comply with XHTML 1.0 Strict. It seems that the problem is all around.

Koen Roggemans added a comment - 21/Dec/08 06:30 AM
hm, 7000 problematic files. That's a lot.
Can I ask you how you created the list?

David Horat added a comment - 21/Dec/08 09:44 AM
Yes. I created a bash script that checkouts out all CVS language files from es.cvs.moodle.org/cvsroot/moodle/lang/, for each individual file I reconstruct it as a whole valid XHTML file, adding header(DOCTYPE, html, header, body) and footer(body, html), I parse them with OpenSP (http://openjade.sourceforge.net/) which is the engine behind the W3C Validator (http://validator.w3.org/) and at the end I use sed to make up the final report with all the pages that are not valid.

If you want I could work on it a bit more, wrap all needed things up and upload them here.


David Horat added a comment - 21/Dec/08 09:59 AM - edited
Report with one non-valid help file per line. No extra numbers at the end.

David Horat added a comment - 21/Dec/08 10:22 PM
Hi Koen and all,

Here is the script I did. Give it a try if you want.
You can start by reading the README file.
The scripts is: moodle-xhtml-checker.sh

Regards,
David


Daniele Cordella added a comment - 22/Dec/08 06:29 PM
Ciao David and thanks for your script.
I tried to use it but I fall into:
quit 2 'onsgmls file not found. Please install it from your repository.'

I added:
myStartingFolder=`echo $0 | sed -e "s#^[^/]#\`pwd\`/&#"`
myStartingFolder=`dirname $myStartingFolder`
just after your row 36

and I changed
your row 47 from:
if [ ! -x "/usr/bin/onsgmls" ] && [ ! -x "onsgmls" ]; then
to:
if [ ! -x "/usr/bin/onsgmls" ] && [ ! -x "$myStartingFolder/onsgmls" ]; then

Whay your script is working to your computer and not to mine?
Are there settings I have to set?


Koen Roggemans added a comment - 23/Dec/08 09:28 PM
My ubuntu results with about 15000 times "onsgmls: error while loading shared libraries: libosp.so.5: cannot open shared object file: No such file or directory " in the log-file.

Running "sudo apt-get install libosp5" didn't solve it..

I had a look at the results of the script, looked in the nl_utf8 langpack since I maintain that and found that it will be very hard to fix everything manually. The first file I looked at (survey.html) I don't see anything wrong, the second one, context.html had one </p> to many and missed one </li>...

I think going through all the language files (manually) to fix them, is a useless job unless we find some way to keep them clean afterwards. Some script that validates on saving with the language pack editor may be? There are not that many different tags used in the help files.


Koen Roggemans added a comment - 23/Dec/08 10:30 PM
running apt-get install w3c-dtd-xhtml got me a little bit further. I get now

onsgmls:lang/af_utf8/help/courseformats.html:5:28:E: end tag for element "b" which is not open
onsgmls:I: maximum number of errors (1) reached; change with -E option