Home Download Buy Blog Forum Support

AutoComplete not xhtml compliant

AutoComplete not xhtml compliant

Postby arktype on Fri Jan 13, 2012 7:30 pm

AutoComplete is a pleasure to use, but it isn't using the correct syntax for the doctype I'm using (or the file extension of xhtml). For example, it is completing an image tag without the trailing slash:
Code: Select all
<img src="">
instead of
Code: Select all
<img src="" />

Also, it isn't putting any alt attribute. Because it is required to validate, it would make sense that a blank one is inserted.

Is there any way I can change this for myself in the settings? I've hunted around here and in the documentation but haven't found anything.
Posts: 3
Joined: Fri Jan 13, 2012 7:11 pm

Re: AutoComplete not xhtml compliant

Postby jshambrook on Wed May 16, 2012 10:22 am

Remembered I saw this when I was looking for an answer, so for future reference here's the way I fixed it.
Navigate to the Packages folder (Preferences > Browse Packages)
Go into HTML folder and open the file named 'html_completions.py'
Hit CTRL+F (cmd+F for Mac), type 'img'. You'll find a small list of tags like the below:

Code: Select all
("br\tTag", "br>"),
("embed\tTag", "embed>"),
("hr\tTag", "hr>"),
("img\tTag", "img src=\"$1\">"),
("input\tTag", "input>"),
("meta\tTag", "meta>"),
("param\tTag", "param name=\"$1\" value=\"$2\">"),

All of these need to have the closing slash added in. Here's mine to copy and paste (be careful what you're replacing! Don't go breaking anything!):

Code: Select all
("br\tTag", "br/>"),
("embed\tTag", "embed/>"),
("hr\tTag", "hr/>"),
("img\tTag", "img src=\"$1\"/>"),
("input\tTag", "input/>"),
("meta\tTag", "meta/>"),
("param\tTag", "param name=\"$1\" value=\"$2\"/>"),

Now with autocomplete, each tag should include the closing slash. To also include the alt attribute inside the img tag, replace the line with following:

Code: Select all
("img\tTag", "img src=\"$1\" alt=\"$2\" />"),

Hope that helps!
Posts: 1
Joined: Wed May 16, 2012 10:13 am
Location: London, UK

Return to Technical Support

Who is online

Users browsing this forum: dyekvar, Exabot [Bot], Yahoo [Bot] and 14 guests