On Jul 21, 2008, at 10:51 PM, Vincent Massol wrote:
On Jul 21, 2008, at 9:53 PM, Sergiu Dumitriu wrote:
Vincent Massol wrote:
Hi,
I'd like to modify our rendering for section titles and use
matching H
tags. For example for "1.1" I'd like to use h2 and not h3 and h1
for
"1".
The main reason for this need (beyond it being more logical) is in
the
new rendering. The XHTML parser I use (the one in wikimodel) will
automatically transform h2 into a level 2 section title.
In addition I'd like the HTML class element to be heading-X (e.g.
heading-1, heading-2, etc) instead of heading-1, heading-1-1,
heading-1-1-1, etc.
I have 2 options here:
1) modify the current code to generate the <h> tag and the matching
heading-X class attribute
2) only add new css definitions for heading-X class attributes (and
thus keep the old heading-1-1-1 ones too)
Option 2) is much simpler since option 1 involves modifying our
wysiwyg editor code too (and I don't know it at all).
+1 for changing the heading levels.
-0 for keeping a class element at all. H1 already means heading,
so I
see no (semantic) need for that class (see also
http://markmail.org/message/5vobm4oxm3c235xd)
I agree. The only case I can see would be to differentiate a h1
generated by the user in a {xhtml} macro vs a wiki syntax level 1
heading but then I don't see why we should differentiate them.
ok I've implemented it locally (51 files modified...) and I'm ready to
commit...
However I have one remaining problem... Whereas before the WYSIWYG
editor was only converting HTML H elements having a class of
heading-1* into section titles, it's now converting any HTML H element
into a section title.
Thus if you have in your page: <h2>hello</h2>
You get: 1.1 Hello
Which in XHTML is rendered as: <h2
id="..."><span>hello</span></h2>
If you have <h2><span>hello</h2>
You get: 1.1 {style:type=span}hello{style}
Which in XHTML is rendered as: <h2 id="..."><span><span
style=""
hello</span></span></h2>
Said differently if you edit in WYSIWYG pages like the Dashboard one
or the WatchList one and you save it you'll get a different result
than before (these pages use H elements in HTML).
The problem is also in the new rendering. Imagine you have an input of
"<h2>hello</h2>".
You run it throught he XHTML parser and you get a SectionBlock with a
level 2 section.
Then if you execute the XHTML Renderer you get: "<h2
id="..."><span>hello</span></h2>"
So I thought about removing the <span> element but I'm told by Laurent
Lunati that we need to keep it as it serves as a CSS hook when we need
to set some styles for IE6 or even with Firefox that cannot be done
using the H element. I didn't fully understand so if anyone knows why
we need to keep it in more details please let me know.
So basically we have no more ways of detecting a H element that is a
wiki syntax heading from one entered by the user (unless we use the
nested <span> as a differentiator).
So, what do we do? Do we leave it like this with the known limitation?
Do we drop the <span> element? Something else?
Ok I've modified the regex in the wysiwyg editor so that only H
elements followed by a span are recognized as headings...
I'm still not sure I like the <span> element and I'd like more details
on why we need it.
Thanks
-Vincent