On Mon, Jun 8, 2015 at 11:11 AM, Gerritjan Koekkoek <gerrit...@cdlsworld.org> wrote: > From: users <users-boun...@xwiki.org> on behalf of Thomas Mortagne > <thomas.morta...@xwiki.com> > Sent: 08 June 2015 11:00 > To: XWiki Users > Subject: Re: [xwiki-users] Get parts of a page... > > On Mon, Jun 8, 2015 at 10:52 AM, Gerritjan Koekkoek > <gerrit...@cdlsworld.org> wrote: >> From: users <users-boun...@xwiki.org> on behalf of Thomas Mortagne >> <thomas.morta...@xwiki.com> >> Sent: 08 June 2015 10:46 >> To: XWiki Users >> Subject: Re: [xwiki-users] Get parts of a page... >> >> On Mon, Jun 8, 2015 at 10:28 AM, Gerritjan Koekkoek >> <gerrit...@cdlsworld.org> wrote: >>> Hi, >>> >>> this indeed looks very useful... >>> We run XWiki version 6.4 > > Is this functionality very costly from a performance perspective? > The loop i'm running will give me approx 25 pages > Now I have added the loop through all the Headerblocks and the server crashed > (503 service not available) > Now retrying and the page load is very slow: Wating for many minutes now?
Loading 25 pages is slow whatever you do with them, then they are in cache and it should be OK. I don't see how reading a XDOM could cause a crash, you should look at the log and see what this 503 really mean. > >>> ________________________________________ >>> From: users <users-boun...@xwiki.org> on behalf of Thomas Mortagne >>> <thomas.morta...@xwiki.com> >>> Sent: 08 June 2015 10:17 >>> To: XWiki Users >>> Subject: Re: [xwiki-users] Get parts of a page... >>> >>> In your macro you could get the document and then use something like >>> what is described in >>> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki61RC1#HAccesstoBlockMatchersfromvelocityscripts >>> to extract the GroupBlock you want (i.e. the one with a parameter >>> "class" equals to "lead" from what I understood). >>> >>> My script is: >>> #foreach($topicDefenitionDoc in $topicDefenitionDocs) >>> #set($topicDefenitionDocument=$xwiki.getDocument($topicDefenitionDoc)) >>> >>> #set($topicDefenitionObject=$topicDefenitionDocument.getObject($classDefenitionName)) >>> == >>> $topicDefenitionDocument.display('topicTitle','view',$topicDefenitionObject) >>> == >>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", >>> "DESCENDANT") >> I understand above line should be changed in: >> #foreach($headerBlock in >> $topicDefenitionDocument.getXDOM().getBlocks("class:HeaderBlock", >> "DESCENDANT")) >> But how do is then inspect if the block has the 'class="lead" ? > > Note that HeaderBlock is for headers and what you have in your example > in your first mail is a GroupBlock. > > Now for the parameters I talked about see > http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/rendering/xwiki-rendering-api/6.4.4/xwiki-rendering-api-6.4.4-javadoc.jar/!/org/xwiki/rendering/block/Block.html#getParameter%28java.lang.String%29 > > When you have the block you can as for the value of "class" parameter > using $headerBlock.getParameter('class') > >> ... >> #end >>> #end >>> >>> But the output I get is: >>> == Behavior == >>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT") >>> == Early Intervention / Education == >>> $topicDefenitionDocument.getXDOM().getBlocks("class:lead", "DESCENDANT") >>> >>> ... >>> What am I missing? >> >> the "class" in $topicDefenitionDocument.getXDOM().getBlocks("class:lead", >> "DESCENDANT") has nothing to do with css. This is the Java class of >> the block you want to find so you are supposed to put GroupBlock there >> as I suggested and then select the one in the list having the >> parameter "class" equals to "lead". >> >>> I also tried: >>> $topicDefenitionDocument..getDocument().getXDOM().getBlocks("class:lead", >>> "DESCENDANT") >>> Same result, as if methods/functions are not available? >>> >>> On Mon, Jun 8, 2015 at 9:31 AM, Gerritjan Koekkoek >>> <gerrit...@cdlsworld.org> wrote: >>>> I know wiki has a nice macro to select a part of a page based on headers. >>>> >>>> But headers can be changed and when you translate the page the page >>>> holding the macro wil have a ugly error. >>>> >>>> >>>> {{include reference="DocumentToInclude" section="HMySection"}} >>>> >>>> >>>> How could I do it based on the following wiki syntax: >>>> >>>> >>>> (%class="lead")((( >>>> >>>> Text to be included >>>> >>>> ))) >>>> >>>> Text to be excluded >>>> >>>> >>>> 'Text to be included' and 'text to be excluded' can have any wiki-markup >>>> >>>> >>>> I would like to create a macro that would look like >>>> >>>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="true"}} >>>> >>>> >>>> I could get the whole page by >>>> >>>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false"}} >>>> >>>> >>>> I could get only 'Text to be excluded' by >>>> >>>> {{myGetSectionMacro reference="DocumentToInclude" onlyLeadText="false" >>>> onlyRestText="true"}} >>>> >>>> Any suggestion is welcome >>>> Note that the used Class is a bootstrap class that will add markup to the >>>> section that will show it as a INTRO text... >>>> >>>> >>>> Gerritjan Koekkoek >>>> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS >>>> Visit our website<http://www.cdlsworld.org> >>>> Facebook<https://www.facebook.com/gerritjan.koekkoek> >>>> email<gerrit...@cdlsworld.org> >>>> >>>> >>>> >>>> _______________________________________________ >>>> users mailing list >>>> users@xwiki.org >>>> http://lists.xwiki.org/mailman/listinfo/users >>> >>> >>> >>> -- >>> Thomas Mortagne >>> _______________________________________________ >>> users mailing list >>> users@xwiki.org >>> http://lists.xwiki.org/mailman/listinfo/users >>> _______________________________________________ >>> users mailing list >>> users@xwiki.org >>> http://lists.xwiki.org/mailman/listinfo/users >> >> >> >> -- >> Thomas Mortagne >> _______________________________________________ >> users mailing list >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> _______________________________________________ >> users mailing list >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users > > > > -- > Thomas Mortagne > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users