[xwiki-users] xwiki rendering questions / suggestions

Ari ari at dicode.fi
Fri Jun 13 10:53:52 CEST 2008


Vincent Massol wrote:
> Hi Ari,
> 
> Would be great if you could open a jira issue for this and send us a  
> real patch. Don't forget that you'll need to modify all CSS files for  
> the various skins too.

Done:
  http://jira.xwiki.org/jira/browse/XWIKI-2464
  http://jira.xwiki.org/jira/browse/XWIKI-2465

> 
> I'm also worried this might break  several custom skins done by users.  
> WDYT?

I think that this does not break anything. The CSS-files contain the
header info in general way (i.e. instead of H1 and H2 there is styles
for .heading-1, .heading-1-1, and so on.

I grepped recursively the installation I have (1.4) and even though few
files (see list below) contain some hard-coded values for headers, this
is IMHO irrelevant because they contain the similar (.heading-1) styles.

- skins/albatross/scripts/table/tablefilterNsort.js
- templates/viewattachrev.vm
- templates/passwd.vm
- templates/importinline.vm
- templates/renameStep1.vm
- templates/exportinline.vm
- templates/changemyavatar.vm
- wiki_editor/plugins/core.js

Regards,
ari


> 
> Thanks
> -Vincent
> 
> On Jun 13, 2008, at 5:57 AM, Ari wrote:
> 
>> 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
> users at xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users



More information about the users mailing list