Wednesday, June 23, 2010

WebCenter WIKI Macro - Table of Contents

WebCenter WIKI Macro - Table of Contents I was asked to help extending Oracle WebCenter's Wiki server, to add a macro to auto-generate a Table of Contents for a wiki page. It follows the same layout as Wikipedia's table of contents, and also has the ability to hide/show itself.

Description:
The <macro:Toc> will generate a simple Table of Contents, in the forms of Wikipedia's Table of Contents. It will search the wiki page content for all Header tags (!, !!, !!!, !!!!) up to 4h level.
Anchors to the title are automatically generated based text for this title
Example: !Description generates anchor <a name="Description"></a><h1>Description</h1>

Syntax:
#1) simple -- will create TOC with title = "Contents" and no auto numbering:
<macro:Toc>
</macro>

#2) with numbering -- numbers are automatically added to the TOC
<macro:Toc numbering="true">
</macro>

#3) with title & numbering -- the title will be set to the text within the macro tags
<macro:Toc numbering="true">
My Table of Contents
</macro>

If you want to give it a try, get the following files and place them on the location below:
Note: It was tested with WebCenter 11g 11.1.1.3.0
-- $WLS_HOME/user_projects/applications//owc_wiki/tags/toc.vm
-- $WLS_HOME/user_projects/applications//owc_wiki/WEB-INF/classes/org/jzwiki/macros/TocMacro.class
-- $WLS_HOME/user_projects/applications//owc_wiki/WEB-INF/lib/yawiki-engine-2.1.jar - file changed is org.jzonic.yawiki.converter.HeaderConverter.class

Here is a screenshot of the macro in action :


5 comments:

  1. hey man thanks for the info.
    my problem is the webcenters wiki doesnt follow any kind of wikipedia patterns. I need to do anchors but doesnt works. I need to attach images to wiki and attachments disappears... where can i find a complete reference suported by jzwiki ? its not the same of the wikipedia.

    ReplyDelete
  2. J.C.

    the syntax for Oracle Wiki is documented here -- http://download.oracle.com/docs/cd/E15523_01/webcenter.1111/e10149/wiki_blog.htm#WCSUG1680

    In order to get the "Wikipedia-style" TOC, you have to follow the steps above and deploy the 3 files

    BTW - are you also from Brazil ?

    -Rodrigo

    ReplyDelete
  3. @pondrejk - are you asking about this TOC macro? Or installation for PS3?

    For the TOC macro, I'm not sure this current solution would work and, unfortunately, I don't have free time to port it.

    Regarding installation for PS3, I suggest:
    - http://www.yonaweb.be/installing_webcenter_11g_ps3_scratch
    - http://onlineappsdba.com/index.php/2011/04/06/how-to-install-oracle-webcenter-11114-11gr1-ps3/

    ReplyDelete
    Replies
    1. @Rodrigo Lima - Sorry, I meant TOC for PS3:)

      Delete