After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 155487 - make html tag list xhtml compliant
make html tag list xhtml compliant
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: 2.18.0
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2004-10-15 10:21 UTC by Paolo Borelli
Modified: 2019-03-23 21:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (47.40 KB, patch)
2005-02-12 03:40 UTC, Thierry Moisan
needs-work Details | Review
second patch (47.40 KB, patch)
2005-08-09 22:34 UTC, Thierry Moisan
none Details | Review
New XHTML compliant TagGroup (100.86 KB, patch)
2006-01-26 01:15 UTC, Luis Menina
needs-work Details | Review
Tag name corrected (102.47 KB, patch)
2006-12-03 20:13 UTC, Luis Menina
reviewed Details | Review

Description Paolo Borelli 2004-10-15 10:21:47 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.
Comment 1 Alan Horkan 2004-10-15 15:48:28 UTC
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.  
Comment 2 Thierry Moisan 2005-02-12 03:40:35 UTC
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.
Comment 3 David Dorward 2005-03-11 15:45:53 UTC
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).
Comment 4 Thierry Moisan 2005-03-12 18:38:50 UTC
So is the patch ok?
Comment 5 Paolo Maggi 2005-08-04 16:20:24 UTC
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.

Comment 6 Thierry Moisan 2005-08-09 22:34:17 UTC
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.
Comment 7 Luis Menina 2006-01-19 01:13:35 UTC
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 ?
Comment 8 Paolo Borelli 2006-01-19 08:44:44 UTC
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 :(
Comment 9 Luis Menina 2006-01-19 13:47:22 UTC
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?
Comment 10 Paolo Maggi 2006-01-19 14:08:41 UTC
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.

Comment 11 Paolo Maggi 2006-01-19 14:20:39 UTC
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>&lt;abbr title="</gedit:Begin>
      <gedit:End>"&gt;&lt;/abbr&gt;</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>&lt;acronym title="</gedit:Begin>
      <gedit:End>"&gt;&lt;/acronym&gt;</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>&lt;a href="</gedit:Begin>
      <gedit:End>"&gt;&lt;/a&gt;</gedit:End>
    </gedit:Tag>
 
    <gedit:Tag _name="Anchor">
      <gedit:Begin>&lt;a&gt;</gedit:Begin>
      <gedit:End>&lt;/a&gt;</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>&lt;address&gt;</gedit:Begin>
      <gedit:End>&lt;/address&gt;</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>&lt;bgsound src="</gedit:Begin>
      <gedit:End>"&gt;</gedit:End>
    </gedit:Tag>
 
    <gedit:Tag _name="Bold">
      <gedit:Begin>&lt;b&gt;</gedit:Begin>
      <gedit:End>&lt;/b&gt;</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>&lt;center&gt;</gedit:Begin>
      <gedit:End>&lt;/center&gt;</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>&lt;cite&gt;</gedit:Begin>
      <gedit:End>&lt;/cite&gt;</gedit:End>
    </gedit:Tag>
Comment 12 Luis Menina 2006-01-19 15:37:51 UTC
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.
Comment 13 Luis Menina 2006-01-22 02:30:30 UTC
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...
Comment 14 Luis Menina 2006-01-26 01:15:46 UTC
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
Comment 15 Luis Menina 2006-01-26 12:56:17 UTC
As said in comment #8, I left the description name in case someday GTK supports the tooltips in TreeView elements.
Comment 16 Luis Menina 2006-01-31 16:51:18 UTC
Please review (if still in time for 2.14 ;-) )
Comment 17 Paolo Maggi 2006-01-31 17:45:43 UTC
Sorry, I'm very busy in these days.
Will review ASAP.
Comment 18 Luis Menina 2006-03-14 17:15:16 UTC
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
Comment 19 Steve Frécinaux 2006-03-20 09:53:47 UTC
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 ;-)
Comment 20 Luis Menina 2006-10-10 12:35:12 UTC
Hi there !
Does this will be burried, or will appear on 2.18 (even unsorted) ?
Comment 21 Luis Menina 2006-10-19 17:14:03 UTC
Could someone please apply this or close the bug ? I don't even think this plugin is still used...
Comment 22 Paolo Borelli 2006-10-19 18:57:40 UTC
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.
Comment 23 Luis Menina 2006-10-23 18:03:30 UTC
Thanks paolo, I hope this bug will finally rust in peace ;-)
Comment 24 Paolo Maggi 2006-11-05 18:17:15 UTC
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>&lt;b&gt;</gedit:Begin>
+      <gedit:End>&lt;/b&gt;</gedit:End>
+    </gedit:Tag>

should be

+    <gedit:Tag _name="Bold">
+      <gedit:Begin>&lt;b&gt;</gedit:Begin>
+      <gedit:End>&lt;/b&gt;</gedit:End>
+    </gedit:Tag>

It should be quite easy to do with some python/perl foo.


Comment 25 Luis Menina 2006-11-09 20:29:19 UTC
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.
Comment 26 Luis Menina 2006-11-09 20:44:08 UTC
Forgot to tell something: doing it that way also make the plugin usable for non english users (entries will be sorted by tag name).
Comment 27 Paolo Maggi 2006-11-11 10:58:04 UTC
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.
Comment 28 Luis Menina 2006-12-03 20:13:13 UTC
Created attachment 77597 [details] [review]
Tag name corrected

Corrected according to Paolo comments...
There it goes !
Comment 29 Paolo Maggi 2006-12-07 23:32:30 UTC
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.

Comment 30 Paolo Maggi 2006-12-08 22:38:45 UTC
Fixed in the development version. The fix will be available in the next major release. Thank you for your bug report.