GNOME Bugzilla – Bug 155487
make html tag list xhtml compliant
Last modified: 2019-03-23 21:02:39 UTC
The current html tag list is not xhtml compliant: - the tags must be lower case - single tags must end with "/>" (e.g. <br/>) - probably other issues I don't know about It may also be worth cosidering removing the extra blank spaces (for instance now you get "<A> foo </A>" while I'd like to see <a>foo</a>) PS: Alan, I cc'ed you since I seem to recall that the other day on irc you said you were interested in this issue: if you want to provide a patch great, otherwise sorry for the spam.
Rather than change the HTML to XHTML I was thinking of creating a seperate sheet. even if it is a bad idea those who write their HTML by hand might still want to use uppercase tags. I guess whoever implements it first gets to decide. (I'm not rushing to implement this, because putting custom tags in .gedit/plugins/taglist/ doesn't seem to work) > - single tags must end with "/>" (e.g. <br/>) better to use <br /> the space enables older parsers to ignore the / as an unknown parameter instead of recognising br/ as an unknown tag.
Created attachment 37382 [details] [review] proposed patch I tried my best to fix everything correctly. If there's anything wrong, I'll do the changes. I based my single tags changes choices on http://www.w3schools.com/xhtml/xhtml_reference.asp where every tag with "/>" at the end is a single tag. I didn't created a seperated sheet (in fact I had no idea how to do it anyway). I puted one extra space after single tags like Alan Horkan said.
The space before the "/" is required by the HTML compatability guidelines, and the Media Type notes say that XHTML documents which conform to those guidelines MAY be served as text/html (it doesn't say that for documents which don't). (And lets face it - most XHTML is going to be served as HTML).
So is the patch ok?
Sorry for the very late reply. The patch looks very good to me and I'd like to include it in gedit 2.12.0. It still needs a bit of work. In particular: - resolving conflicts with the current CVS version of the file (it should be very easy, only very few changes have been made= - double checking it for errors. For example I have seen some errors like: * "a HREF=" instead of "a href=" * "clospan" instead of "colspan" * "adress" instead of "address" * etc. It would be very cool if you or some gnome-loves could complete this simple task.
Created attachment 50487 [details] [review] second patch This patch fix all the typos error I have seen checking the last patch (and I've checked it all so it should be ok). It doesn't solve all the conflicts with the new CVS version, since I don't know how to fix that. If someone wants to show me how, I'd really like to fix that.
I've tried to write a patch for this plugin, but the plugin itself seems obsolete to me... 1.The tags are sorted in the side panel using their "long description name". But the sorting is done using the english name, meaning there's no logical order for me when displayed in french... 2. There's no preview of what tag/attribut/whatever to show what the description refers to. To test it, I have to double click the entry, see that's not the good tag, delete it, retry... We should IMHO show instead the tags/attributes/whatever and maybe a tooltip on these with the long description, or do what is done for xslt elements: have the tag name instead of a long descrition. 3. Even worse, some elements have the same long description: I can't know what I will insert into the document until I tried... Maybe replacing the long description by something more meaningful, and displayin the long description in a tooltip would be a better solution ? That way the HTML section of the extension could be useful... Opinions about this ?
If the sorting is done on the untraslated name it's definately a bug. Regarding tooltips we definately agree, but tooltips on TeeeView's rows are not yet supported by gtk :(
ok, so what can I do for now? I personnaly think the best is to: 1.Create a new gedit:TagGroup for XHTML tags 2.Convert the html tags to lowercase and remove those pesky spaces 3.Copy of the corrected TagGroup for HTML to XHTML with some improvements: - Keep XHTML tags/attributes only (lowercase) - Use the tag/attribute as the description (the name of the tag), but keeping commented the current long description, in the eventuality of a GTK+ improvement in showing tooltips in a treeview The problem that will remain is about the sorting order, but it should be ok for XHTML if the description is the tag content, as it should not be translated... Will remains however for HTML. Some memory issues about creating a new TagGroup? Some remarks? Do you think HTML is worth keeping it?
You should try to reduce the string changes (i.e. avoid to change the name of the tags if possible and create new tag) since we are already late in the dev cycle and I don't want to create problems to translators. I already started to fix this bug last year, I will attach my half-finished patch here (if I found it). The problems you reported about the tag plugin should be put in a different bug report since they are not related to this specific bug report and we nedd to address them in same way.
Please, check all the tags using the XHTML reference at http://www.w3schools.com/tags/default.asp and removed the ones that are not cited in the above reference. You can use the Thierry's patch at comment #11 as a starting point. Here the part of the file I have already revised: <?xml version="1.0"?> <gedit:TagList xmlns:gedit="http://gedit.sourceforge.net/some-location"> <gedit:TagGroup _name="HTML - Tags"> <gedit:Tag _name="Abbreviated form"> <gedit:Begin><abbr title="</gedit:Begin> <gedit:End>"></abbr></gedit:End> </gedit:Tag> <gedit:Tag _name="Accessibility key character"> <gedit:Begin>accesskey="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Acronym"> <gedit:Begin><acronym title="</gedit:Begin> <gedit:End>"></acronym></gedit:End> </gedit:Tag> <gedit:Tag _name="Align"> <gedit:Begin>align="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Alignment character"> <gedit:Begin>char="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Alternative"> <gedit:Begin>alt="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Anchor URI"> <gedit:Begin><a href="</gedit:Begin> <gedit:End>"></a></gedit:End> </gedit:Tag> <gedit:Tag _name="Anchor"> <gedit:Begin><a></gedit:Begin> <gedit:End></a></gedit:End> </gedit:Tag> <gedit:Tag _name="Applet class file code"> <gedit:Begin>code="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Associated information"> <gedit:Begin>content="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Author info"> <gedit:Begin><address></gedit:Begin> <gedit:End></address></gedit:End> </gedit:Tag> <gedit:Tag _name="Axis related headers"> <gedit:Begin>axis="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Background color"> <gedit:Begin>bgcolor="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Background texture tile"> <gedit:Begin>background="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Base URI"> <gedit:Begin>codebase="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="BGSound"> <gedit:Begin><bgsound src="</gedit:Begin> <gedit:End>"></gedit:End> </gedit:Tag> <gedit:Tag _name="Bold"> <gedit:Begin><b></gedit:Begin> <gedit:End></b></gedit:End> </gedit:Tag> <gedit:Tag _name="Border"> <gedit:Begin>border="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Cell rowspan"> <gedit:Begin>rowspan="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Center"> <gedit:Begin><center></gedit:Begin> <gedit:End></center></gedit:End> </gedit:Tag> <gedit:Tag _name="Character encoding of linked resource"> <gedit:Begin>charset="</gedit:Begin> <gedit:End>"</gedit:End> </gedit:Tag> <gedit:Tag _name="Checked (state)"> <gedit:Begin>checked="checked"</gedit:Begin> </gedit:Tag> <gedit:Tag _name="Citation"> <gedit:Begin><cite></gedit:Begin> <gedit:End></cite></gedit:End> </gedit:Tag>
I haven't used the patch of comment #6 for a simple reason: Thierry changed the names by hand, causing some extra types errors, while I've done the work using uppercase to lowercase function of vi (guw in command mode). I've removed extra whitespace in an automated way also, so the HTML tags should be clean. He also did some mistakes as putting DOCTYPE in lowercase. As for comment #1, I also think it's better to separate HTML and XHTML for now, just to avoid some regression problems. Therefore I will not change names in the HTML TagGroup (no translation problem, as all strings remain). But for the XHTML TagGroup, I will define the _name to the content of the tag. A tag doesn't need to be translated, so this avoids translation issues just before string freeze on February 13th. The only translation to add will be for the name of the "XHTML - Tags". Your patch gives me a good indication on how to well form the XHTML tags/attributes. http://www.w3schools.com/tags/default.asp is also the website I use as a reference, but there's one problem: the tags are all referenced on a page, but not the attributes, you need to click on each tag to see the specific attributes. I'm trying to find a better source, will give another look to w3c.org.
The entries are displayed in the order of the xml file. That's why translated versions are not sorted, wich makes this extension useless... The workaround is to always display the tag name, and reorder the entries in the xml, not by description name but by tag/attribute name... I've also seen some IE. only or Netscape only tags, which have been squached, and I think I will do it for the HTML section TagGroup, not just for the XHTML one. Posting a patch soon...
Created attachment 58133 [details] [review] New XHTML compliant TagGroup * New XHTML compliant TagGroup * XHTML elements name is the tag/element name instead of its description * Converted HTML to lowercase * Removed in-tags spaces * Removed a few HTML nonstandard tags (ie. browser specific - we're not in stoneage anymore) Translation status: only the new TagGroup name and the elements marqued as "deprecated" need some translating, unless the "deprecated" mention in the tag name is removed for now, and only the associated comment is kept (for possible translation in another release) Note: Elements are not sorted by name, this is another bug. Ideally the element should be sorted by name in the xml file, but after poking on 1600 lines, it's enough for me... a simple patch to order the entries in the list should be enough, and would resolve the unsorted list issue with non-english languages (items order is the order of the entries in the file, which was sorted for english language - nobody complained, so I suppose nobody uses this f*cking plugin :-p ) That patch totally blowed my mind for something nobody will use... Hope next one will be more useful, because that's my second useless patch :-p
As said in comment #8, I left the description name in case someday GTK supports the tooltips in TreeView elements.
Please review (if still in time for 2.14 ;-) )
Sorry, I'm very busy in these days. Will review ASAP.
May I hope it will be part of 2.16 ? ;-) Didn't want to rant before for such a useless feature, but if someone requested it, and I did it, hey, better using it, no ? :-D
I think it's too late for 2.14.x because it may break string freeze. (In reply to comment #13) > The entries are displayed in the order of the xml file. That's why translated > versions are not sorted, wich makes this extension useless... You may implement some runtime sorting stuff in the tag list ;-)
Hi there ! Does this will be burried, or will appear on 2.18 (even unsorted) ?
Could someone please apply this or close the bug ? I don't even think this plugin is still used...
Wow... this bug seems doomed, I am really sorry about that. Part of the problem is that as time constrained as we are, reviewing such a big string change always gets postponed and we get stuck between a string freeze and another... All I can say is that we'll try to finally look at it as soon as we branch (we are still string frozen now since we have not branched yet). I am putting this one the 2.18 milestone.
Thanks paolo, I hope this bug will finally rust in peace ;-)
Hi Luis, finally I had review the patch... sorry for the very very late reply. The patch looks good, I have only a last comment before committing. Could you please, use as _name for the XHTML tags the one you put in the comment. i.e. +<!-- _name="Bold" --> + <gedit:Tag _name="b"> + <gedit:Begin><b></gedit:Begin> + <gedit:End></b></gedit:End> + </gedit:Tag> should be + <gedit:Tag _name="Bold"> + <gedit:Begin><b></gedit:Begin> + <gedit:End></b></gedit:End> + </gedit:Tag> It should be quite easy to do with some python/perl foo.
Well, I did that because I think that almost nobody will know wich full name to search... and as I said in comment #13 this plugin is at the moment broken for non-english languages (entries are not sorted using the translated name). So uing the tag name allows everyone to use esily the tags, and in a coherent order. The plain text describing the tag should be IMHO in a list tooltip, wich still doesn't exist.
Forgot to tell something: doing it that way also make the plugin usable for non english users (entries will be sorted by tag name).
We will fix the sorting of tags according to name. I'd also like to add a preview at the bottom of the list showing the selected tag.
Created attachment 77597 [details] [review] Tag name corrected Corrected according to Paolo comments... There it goes !
Luis: thanks for the patch, I will commit it as soon as I will have implemented sorting of tags according to name. Note for me: remember to remove the <!-- _name="..." --> comments before committing.
Fixed in the development version. The fix will be available in the next major release. Thank you for your bug report.