Made the thymeleaf-command that decorates the template configurable
[maven-thymeleaf-skin] / src / main / resources / META-INF / maven / site.vm
1 <!DOCTYPE html>
2 <!--/*-->
3 <!-- Generated by Apache Maven Doxia Site Renderer#if( $doxiaSiteRendererVersion ) $doxiaSiteRendererVersion#end at $dateFormat.format( $currentDate ) -->
4
5
6 #set ( $pages = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
7 #set ( $stack = $project.getClass().forName('java.util.LinkedList').newInstance() )
8 #macro ( buildPages $menu )
9
10   #if ( $menu.href )
11     #set ( $currentItemHref = $PathTool.calculateLink( $menu.href, $relativePath ) )
12   #else
13     #set ( $currentItemHref = '' )
14   #end
15   #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
16
17   #set ( $seen = false )
18   #foreach ( $entry in $stack )
19     #if ( $entry.uri == $currentItemHref )
20       #set ( $seen = true )
21     #end
22   #end
23
24   #if ( !$seen )
25     #if ($currentItemHref)
26       #set( $sinkhole = $stack.peek().childs.put($currentItemHref, $menu.name) )
27     #end
28
29     #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
30     #set ( $sinkhole = $page.put("name", $menu.name) )
31     #set ( $sinkhole = $page.put("uri", $currentItemHref) )
32     #set ( $sinkhole = $page.put("childs", $project.getClass().forName('java.util.LinkedHashMap').newInstance()) )
33     #set ( $sinkhole = $stack.push( $page ) )
34
35     #if ($menu.title)
36       #set( $sinkhole = $page.put("title", $menu.title) )
37     #end
38     #if ($menu.alt)
39       #set( $sinkhole = $page.put("alt", $menu.alt) )
40     #end
41     #if ($menu.img)
42       #set( $sinkhole = $page.put("img", $menu.img) )
43     #end
44
45     #foreach ( $item in $menu.items )
46       #buildPages ( $item )
47     #end
48
49     #set ( $page = $stack.pop() )
50     #if ( $page.uri != "" )
51
52       #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() )
53       #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
54       #set ( $sinkhole = $crumb.put("uri", $page.uri) )
55       #set ( $sinkhole = $crumb.put("name", $page.name) )
56       #set ( $sinkhole = $crumbs.push($crumb) )
57       #foreach ( $entry in $stack )
58         #if ( $entry.uri != "" )
59           #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
60           #set ( $sinkhole = $crumb.put("uri", $entry.uri) )
61           #set ( $sinkhole = $crumb.put("name", $entry.name) )
62           #set ( $sinkhole = $crumbs.push($crumb) )
63         #end
64       #end
65       #set ( $sinkhole = $page.put("crumbs", $crumbs) )
66
67       #if ( $pages.containsKey($page.uri) )
68         #set ( $childs = $pages.get($page.uri).childs )
69         #set ( $sinkhole = $page.put("childs", $childs) )
70
71         <!-- OVERWRITING PAGE - uri: $page.uri / name: $page.name -->
72       #else
73
74         <!-- NEW PAGE - - - - - uri: $page.uri / name: $page.name -->
75       #end
76
77       #set ( $sinkhole = $pages.put($page.uri, $page) )
78
79     #else
80
81       <!-- DONE WITH MENUE -  - #if($page.name)$page.name-->#else(no name)-->
82         #set( $siteTitle = $menu.title )
83         #set( $siteAlt = $menu.alt )
84         #set( $siteImg = $menu.img )
85         #set( $sinkhole = $pages.get("index.html").put("childs", $page.childs) )
86       #end
87
88     #end
89   #else
90     <!-- Skipping already seen entry: uri=$currentItemHref, name=$menu.name -->
91   #end
92 #end
93
94
95 ## Seiten einlesen
96 #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
97 #set ( $sinkhole = $page.put("uri", "index.html") )
98 #set ( $sinkhole = $page.put("name", "$project.name") )
99 #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() )
100 #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
101 #set ( $sinkhole = $crumb.put("uri", $page.uri) )
102 #set ( $sinkhole = $crumb.put("name", $page.name) )
103 #set ( $sinkhole = $crumbs.push( $crumb ) )
104 #set ( $sinkhole = $page.put("crumbs", $crumbs ) )
105 #set ( $sinkhole = $pages.put($page.uri, $page) )
106 #set ( $sinkhole = $stack.push($page) )
107 #foreach ( $menu in $decoration.body.menus )
108   ## Nur benannte Menüs werden berücksichtigt
109   #if ($menu.name)
110     #buildPages ( $menu )
111   #end
112 #end
113 #foreach ( $menu in $decoration.body.menus )
114   ## Nur unbenannte Menüs werden berücksichtigt
115   #if (!($menu.name))
116     #buildPages ( $menu )
117   #end
118 #end
119
120 ## Custom Variablen einlesen
121 #set ( $canonicalPath = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'path' ).getValue() )
122 #if ( !$canonicalPath )
123   #set ( $canonicalPath = "" )
124 #end
125 #set ( $sitePath = $canonicalPath + $project.version + "/" )
126 #set ( $siteCrumbs = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'crumbs' ).getValue() )
127 #set ( $command = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'command' ).getValue() )
128
129 <!-- name: $pages.get($alignedFileName).name -->
130 <!-- title: $title -->
131 <!-- short title: $shortTitle -->
132 <!-- current page: $alignedFileName -->
133 <!-- path: $sitePath -->
134 <!-- crumbs: $siteCrumbs -->
135 <!-- pages: $pages -->
136
137
138 <!--*/-->
139 <html xmlns="http://www.w3.org/1999/xhtml" $command>
140   <head>
141     <title class="title">$title</title>
142     <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
143     <link id="canonical" rel="canonical" href="$canonicalPath$alignedFileName"/>
144   </head>
145   <body>
146     <h1 class="short_title">$shortTitle</h1>
147     <h2>URI</h2>
148     <ul>
149       <li><strong>site:</strong> <code class="site_uri">$sitePath$alignedFileName</code></li>
150       <li><strong>canonical:</strong> <code class="canonical_uri">$canonicalPath$alignedFileName</code></li>
151       <li><strong>relative:</strong> <code class="relative_uri">$alignedFileName</code></li>
152     </ul>
153     <h2>Path</h2>
154     <p>
155       <ol>
156         #foreach($crumb in $pages.get($alignedFileName).crumbs)<li><a href="$crumb.uri">$crumb.name</a></li>#end
157       </ol>
158     </p>
159     <hr />
160     <article class="maincontent">
161       $bodyContent
162     </article>
163     <hr />
164     <h2>Page Structure as JSON</h2>
165     <pre class="json">
166 {
167   "_titles": {#set($sep = "")#foreach($page in $pages)$sep
168     "$sitePath$page.uri": "$page.name"#set($sep = ",")
169 #end
170
171   },
172   "_childs": {#set($sep = "")#foreach($page in $pages)#if(!$page.childs.isEmpty())$sep
173     "$sitePath$page.uri": [#set($csep = "")#foreach($child in $page.childs.entrySet())$csep
174       "$sitePath$child.key"#set($csep = ",")#end
175
176     ]#set($sep = ",")#end#end
177
178   },
179   "_crumbs": {#set($sep = "")#foreach($page in $pages)$sep
180     "$sitePath$page.uri": [
181 #set($csep = "")#if($siteCrumbs)
182       $siteCrumbs#set($csep = ",")#end#set($last = "")#foreach($crumb in $page.crumbs)#if($sitePath+$crumb.uri != $last)$csep
183       "$sitePath$crumb.uri"#set($csep = ",")#set($last = $sitePath+$crumb.uri)#end#end
184
185     ]#set($sep = ",")#end
186
187   }
188 }
189     </pre>
190     <h2>All Pages</h2>
191     <p>
192       <ul>
193         #foreach($page in $pages)<li><a href="$page.uri">$page.name</a></li>#end
194       </ul>
195     </p>
196   </body>
197 </html>