incubator-jspwiki-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "lgilardoni61@gmail.com" <lgilardon...@gmail.com>
Subject Re: Building a Printable Version
Date Tue, 23 Mar 2010 18:03:27 GMT
Well, it make some sense.
I'm doing it a bit differently, made a WikiBook.jsp cloning Wiki.jsp and 
including a ViewBook.jsp template. Then, in ViewBook.jsp:

<%
     // start from passed page
     // get links and follow them - 1 level
     // collapse
     try {
     WikiContext wikiContext = WikiContext.findContext( pageContext );
     WikiEngine wikiEngine = wikiContext.getEngine();
     String pagereq = wikiContext.getName();

     String htmlPage = wikiEngine.getHTML(pagereq);
     WikiPage wikiPage = wikiContext.getPage();
     Collection wikiLinks = 
wikiEngine.scanWikiLinks(wikiPage,wikiEngine.getPureText(wikiPage));

     %><h1><%=pagereq%></h1><%=htmlPage%><%
     Iterator wikiLinkIterator = wikiLinks.iterator();
     for (; wikiLinkIterator.hasNext();) {
         String wikiLink  = (String) wikiLinkIterator.next();
         String htmlLinkPage = wikiEngine.getHTML(wikiLink);
         %><h1><%=wikiLink%></h1><%=htmlLinkPage%><%
            }
     } catch (Exception ex) {out.println(ex);}
%>

Obtaining more or less the same. Obviously I could go down recursively - 
assuming the structure is reasonable.
This way also you can control overall page structure ... and you can use 
the h1 for first level headings (and build the toc outside).
I'll post were i will end up

On 3/23/2010 6:47 PM, Robert FORBES wrote:
> I haven't gone down this path a lot, but what I did (when I did traverse it)
> is to use the InsertPage plug in, prefaced by a !!! title
> So that I could also build a table of contents, so it might have looked like
> this:
>
> [{TableOfContents }]
>
> !!!FIRST PAGE INFO
> [{InsertPage page='FIRST PAGE INFO'}]
>
> !!!SECOND PAGE
> [{InsertPage page= 'SECOND PAGE'}]
>
> !!!AND YET A THIRD
> [{InsertPage page='THIRD PAGE'}]
>
> Etc
>
>
> -----Original Message-----
> From: lgilardoni61@gmail.com [mailto:lgilardoni61@gmail.com]
> Sent: March-22-10 1:51 PM
> To: jspwiki-user@incubator.apache.org
> Subject: Building a
>
> Hi I was looking at producing a printable version of a *set* of pages.
>
> My first idea was to have a page index, and from that recurring to
> subpages to get their content.
> To start with I had a look at the Referred Pages Plugin, to get the
> subpages; problem is while original version went to parse the page,
> current version (2.8.x) use the referencemanager, whcih is surely faster
> but seems to return subpages *always* ordered (lexicographically),
> which is what I do NOT want.
>
> So questions ..
> 1) should i fall back to original parsepage approach or is there any way
> to obtain links from refManager not sorted (I suspect not but ...)?
> 2) anyone already went this path .. to avoid duplicating effort?
>
> Any hint appreciated
>
> Luca
>
>
>    


Mime
View raw message