mukuldang08 / gwtwiki

Automatically exported from code.google.com/p/gwtwiki
0 stars 0 forks source link

toc generate not valid anchor #154

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
if the section is not start with a letter [a-zA-Z] will generate a not valid 
html dom id

{

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by 
any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons 
(":"), and periods (".").

}

example the Chinese section will generate a anchor

[第一章], [.E7.AC.AC.E4.B8.80.E7.AB.A0]

when use jquery to select this anchor cause a Synatax error:

{
Error: Syntax error, unrecognized expression: #.E7.AC.AC.E4.B8.80.E7.AB.A0
}

maybe we can make a default prefix when the anchor not start with the letter, 
"head" or "h" for example?

Thanks

Original issue reported on code.google.com by Rory...@gmail.com on 10 Jan 2014 at 9:35

GoogleCodeExporter commented 8 years ago
If you look into chinese wikipedia, they don't add a special character?
Example:
http://zh.wikipedia.org/wiki/%E4%B8%8A%E6%B5%B7%E5%B8%82

Nethertheless I've attached a patch to this issue, which you could try for your 
purposes.

Original comment by axelclk@gmail.com on 11 Jan 2014 at 10:52

Attachments:

GoogleCodeExporter commented 8 years ago
Ok, Thanks axelclk, I found this too.But I don't understand why the wikipedia 
use a invalid ID as anchor.

BTW: this patch will not in trunk, right?

Original comment by Rory...@gmail.com on 13 Jan 2014 at 2:12

GoogleCodeExporter commented 8 years ago
Hi, axelclk, I learn from w3c.org that in HTML5 the ID attribute start with "." 
is valid. so no problem in HTML5 page.

{{{

3.2.5.1 The id attribute

The id attribute specifies its element's unique identifier (ID). [DOM]

The value must be unique amongst all the IDs in the element's home subtree and 
must contain at least one character. The value must not contain any space 
characters.
}}}

BTW:Thanks your patch.

Original comment by Rory...@gmail.com on 13 Jan 2014 at 10:01