欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

velocity宏命令定义

程序员文章站 2022-05-02 20:28:16
...

 

#macro(includeChilds $page $withPageBreaks)
  #includeChildren($page $withPageBreaks)
#end
## Macro to include children at multiple levels
#macro(includeChildren $page $withPageBreaks)
 #if($clevel!=0)
  #foreach($childDocName in $xwiki.searchDocuments("where doc.parent='$page' order by doc.creationDate"))
    #set($childDoc = $xwiki.getDocument($childDocName))
    #if(($childDoc)&&($childDoc.getSpace()!="Panels")&&($childDoc.getSpace()!="XWiki"))
     #if($withPageBreaks)
     #pagebreak()
     #end
     $childDoc.getRenderedContent()
     #set($clevel = $xwiki.add($clevel,-1))
     #includeChildren($childDocName $withPageBreaks)
     #set($clevel = $xwiki.add($clevel,1))
    #end
  #end
 #end
#end


调用方式:
#includeChilds('page' 'withPageBreaks')
相关标签: velocity