Ari wrote:
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.
I implemented the modifications for "heading liftup". Modifications include: com.xpn.xwiki.render.XWikiWikiBaseRenderer#makeHeading ------------------ public static void makeHeading(StringBuffer stringBuffer, String level, String text, Util util) { // modified 12.06.2008 Integer parsedInt = Integer.parseInt(level); Integer levelInt = Math.max((parsedInt-1), 1); // end of modification String anchor = makeAnchor(text, util); stringBuffer.append("<h"); stringBuffer.append(levelInt); // was: level stringBuffer.append(" id=\""); stringBuffer.append(anchor); stringBuffer.append("\" >"); stringBuffer.append(text); stringBuffer.append("</h"); stringBuffer.append(levelInt); // was: level stringBuffer.append(">"); } ------------------ com.xpn.xwiki.render.filter.XWikiHeadingFilter#handleMatch(MatchResult result, FilterContext context) ------------------ public String handleMatch(MatchResult result, FilterContext context) { String id = null; String title = result.group(0); String level = result.group(1); // old way // int level_i = (level.length() + 3) / 2; // new way (12.06.2008) int level_i = level.replaceAll("\\.", "").length(); ------------------ I'm not sure if the modification to com.xpn.xwiki.render.XWikiWikiBaseRenderer#makeHeading is necessary, but the change for com.xpn.xwiki.render.filter.XWikiHeadingFilter#handleMatch(MatchResult is obvious. This change is compatible with xwiki-core-1.4. I think that the rendering is pretty completely rewritten in 1.5, but hopefully someone finds this useful. Any corrections for possible misintepretations are highly appreciated. Regards, ari PS. Has someone knowledge about the "bug" in the rendering text after list (-, *, #) ? (See rest of the post, PART 2)
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 #.
With Best Regards, ari _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users