Added a default and a warning an undefined command
[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 #if ( !$command )
129   #set ( $command = "" )
130   <!-- WARNING: configuration parameter "command" is not set -->
131 #end
132
133 <!-- name: $pages.get($alignedFileName).name -->
134 <!-- title: $title -->
135 <!-- short title: $shortTitle -->
136 <!-- current page: $alignedFileName -->
137 <!-- path: $sitePath -->
138 <!-- crumbs: $siteCrumbs -->
139 <!-- pages: $pages -->
140
141
142 <!--*/-->
143 <html xmlns="http://www.w3.org/1999/xhtml" $command>
144   <head>
145     <title class="title">$title</title>
146     <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
147     <link id="canonical" rel="canonical" href="$canonicalPath$alignedFileName"/>
148   </head>
149   <body>
150     <h1 class="short_title">$shortTitle</h1>
151     <h2>URI</h2>
152     <ul>
153       <li><strong>site:</strong> <code class="site_uri">$sitePath$alignedFileName</code></li>
154       <li><strong>canonical:</strong> <code class="canonical_uri">$canonicalPath$alignedFileName</code></li>
155       <li><strong>relative:</strong> <code class="relative_uri">$alignedFileName</code></li>
156     </ul>
157     <h2>Path</h2>
158     <p>
159       <ol>
160         #foreach($crumb in $pages.get($alignedFileName).crumbs)<li><a href="$crumb.uri">$crumb.name</a></li>#end
161       </ol>
162     </p>
163     <hr />
164     <article class="maincontent">
165       $bodyContent
166     </article>
167     <hr />
168     <h2>Page Structure as JSON</h2>
169     <pre class="json">
170 {
171   "_titles": {#set($sep = "")#foreach($page in $pages)$sep
172     "$sitePath$page.uri": "$page.name"#set($sep = ",")
173 #end
174
175   },
176   "_childs": {#set($sep = "")#foreach($page in $pages)#if(!$page.childs.isEmpty())$sep
177     "$sitePath$page.uri": [#set($csep = "")#foreach($child in $page.childs.entrySet())$csep
178       "$sitePath$child.key"#set($csep = ",")#end
179
180     ]#set($sep = ",")#end#end
181
182   },
183   "_crumbs": {#set($sep = "")#foreach($page in $pages)$sep
184     "$sitePath$page.uri": [
185 #set($csep = "")#if($siteCrumbs)
186       $siteCrumbs#set($csep = ",")#end#set($last = "")#foreach($crumb in $page.crumbs)#if($sitePath+$crumb.uri != $last)$csep
187       "$sitePath$crumb.uri"#set($csep = ",")#set($last = $sitePath+$crumb.uri)#end#end
188
189     ]#set($sep = ",")#end
190
191   }
192 }
193     </pre>
194     <h2>All Pages</h2>
195     <p>
196       <ul>
197         #foreach($page in $pages)<li><a href="$page.uri">$page.name</a></li>#end
198       </ul>
199     </p>
200   </body>
201 </html>