Ari wrote:
Hello. My question / suggestion goes with two part.
PART 1
I've tried to figure out why the XWiki renders xwiki-headings as it
does. E.g "1 Title One" is rendered as '<h2
class="heading-1">Title
One</h2>'. I would like to change this to be h1-element instead of
h2-element.
That was my decision, as in a document there is already a first-level heading, the
document title.
Having other elements as level 1 headings would mean that they have the same significance
as the
document title, which I think is wrong. Still, this should be configurable, and since the
heading
syntax is not yet finalized (
http://jira.xwiki.org/jira/browse/XWIKI-1247) it can be
changed.
At first I suspected that this change would require
only small
modification in some velocity template. It seems that I was wrong. My
current guess is that this rendering is done somewhere in java (from
xwiki.hbm.xml I tracked the doc.XWikiDocument and with that my guess is
DefaultXWikiRenderingEngine.java). However, I don't know how/where I
should change the code.
Look at com.xpn.xwiki.render.filter.XWikiHeadingFilter
Is there a flow-chart or something to describe the
render-phase?
As the description of this list goes: I would suggest that the xwiki
rendering should be done in a straightforward way where syntax 1 would
be h1, 1.1 h2, 1.1.1 h3 and so on.
PART 2
Another suggestion is that minor fix would be implemented in rendering.
An example text and the rendered result:
------------------
this is text before list.
* this
* is
* list
this is text after list.
------------------
<p>this is text before list.</p>
<ul class="star">
<li>this</li>
<li>is</li>
<li>list</li>
</ul>this is text after list.
------------------
Also "this is text after list" should be rendered as paragraph. A
workaround is to write:
------------------
this is text before list.
* this
* is
* list
<span>
this is text after list.
------------------
<p>this is text before list.</p>
<ul class="star">
<li>this</li>
<li>is</li>
<li>list</li>
</ul><span>
<p>this is text after list.</p>
------------------
Same goes with lists with - * and #.
Radeox makes this extremely hard to do. Since it works with independent regular
expressions, and not
with grammars or state machines or something else that could know what a paragraph is, you
can't
write a regular expression that matches only the right things. The new rendering engine
could solve
this issue.
You are somehow wrong in your example, as the actual rendering is:
<p/>this is text before list.
<ul class="star"> ...
Not even the first line of text is actually a paragraph, but because the page is not sent
as valid
XML, but html, the browser takes the freedom to actually put that line inside the
paragraph, because
it knows that an empty paragraph element is wrong and absurd.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/