Projekt-Seite erstellt: Velocity-Template - parent-Definition überschreibbar
[simple-mapper] / src / site / template.vm
index 29b5cba..2588a09 100644 (file)
@@ -70,6 +70,7 @@
       #set( $siteTitle = $menu.title )
       #set( $siteAlt = $menu.alt )
       #set( $siteImg = $menu.img )
+      #set( $sinkhole = $pages.get("index.html").put("childs", $page.childs) )
     #end
 
   #end
   #set ( $sitePath = "" )
 #end
 #set ( $siteCrumbs = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'crumbs' ).getValue() )
+#set ( $parent = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'parent' ).getValue() )
 
 <!-- title: $title -->
 <!-- short title: $shortTitle -->
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:layout="http://www.thymeleaf.org"
     layout:decorator="templates/layout"
-    th:with="uri='$sitePath$alignedFileName'"
+    th:with="title='$title', uri='$sitePath$alignedFileName'"
     >
   <head>
     <title>juplo - $title</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
+    <!--/*-->
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <link rel="stylesheet/less" type="text/css" href="../../less/base.less"/>
+    <link rel="stylesheet/less" type="text/css" href="../../less/screen.less" media="screen"/>
+    <link rel="stylesheet/less" type="text/css" href="../../less/print.less" media="print"/>
+    <script src="../../js/less-1.7.0.min.js"></script>
+    <!--*/-->
     <link rel="canonical" href="$sitePath$alignedFileName"/>
   </head>
-  <body>
+  <body
+      thymeproxy:variables="merge:{&quot;pages&quot;:{#if($parent)$parent#end#set($sep = "")#foreach($page in $pages)$sep&quot;$sitePath$page.uri&quot;:{&quot;name&quot;:&quot;$page.name&quot;,#if(!$page.childs.isEmpty())&quot;childs&quot;:{#set($csep = "")#foreach($child in $page.childs.entrySet())$csep&quot;$sitePath$child.key&quot;:&quot;$child.value&quot;#set($csep = ",")#end},#end&quot;crumbs&quot;:[#set($csep = "")#if($siteCrumbs)$siteCrumbs#set($csep = ",")#end#foreach($crumb in $page.crumbs)$csep{&quot;uri&quot;:&quot;$sitePath$crumb.uri&quot;,&quot;name&quot;:&quot;$crumb.name&quot;}#set($csep = ",")#end]#if($page.title),&quot;title&quot;:&quot;$page.title&quot;#end#if($page.alt),&quot;alt&quot;:&quot;$page.alt&quot;#end#if($page.img),&quot;img&quot;:&quot;$page.img&quot;#end}#set($sep = ",")#end}#if($siteTitle),&quot;site_title&quot;:&quot;$siteTitle&quot;#end#if($siteAlt),&quot;site_alt&quot;:&quot;$siteAlt&quot;#end#if($siteImg),&quot;site_img&quot;:&quot;$siteImg&quot;#end}"
+      >
     <h2>Path</h2>
     <p>
       <ol>
       </ol>
     </p>
     <hr />
-    <article class="main" layout:fragment="maincontent" juplo:variables='merge:{"pages":{#set($sep = "")#foreach($page in $pages)$sep"$sitePath$page.uri":{"name":"$page.name",#if(!$page.childs.isEmpty())"childs":{#set($csep = "")#foreach($child in $page.childs.entrySet())$csep"$child.key":"$child.value"#set($csep = ",")#end},#end"crumbs":[#set($csep = "")#if($siteCrumbs)$siteCrumbs#set($csep = ",")#end#foreach($crumb in $page.crumbs)$csep{"uri":"$sitePath$crumb.uri","name":"$crumb.name"}#set($csep = ",")#end]#if($page.title),"title":"$page.title"#end#if($page.alt),"alt":"$page.alt"#end#if($page.img),"img":"$page.img"#end}#set($sep = ",")#end}#if($siteTitle),"site_title":"$siteTitle"#end#if($siteAlt),"site_alt":"$siteAlt"#end#if($siteImg),"siet_img":"$siteImg"#end}'>
+    <article class="main" layout:fragment="maincontent">
       <header><h1>$shortTitle</h1></header>
       $bodyContent
     </article>
     <hr />
+    <h2>Common</h2>
+    <ul>
+      <li><strong>Parent</strong>: $parent</li>
+      <li><strong>Title</strong>: $title</li>
+      <li><strong>Short Title</strong>: $shortTitle</li>
+      <li><strong>Current</strong>: $alignedFileName</li>
+      <li><strong>Path</strong>: $sitePath</li>
+      <li><strong>Crumbs</strong>: $siteCrumbs</li>
+      <li><strong><code>title</code></strong>: $siteTitle</li>
+      <li><strong><code>alt</code></strong>: $siteAlt</li>
+      <li><strong><code>img</code></strong>: $siteImg</li>
+    </ul>
     <h2>Pages</h2>
-    <p>
-      <ul>
-        #foreach($page in $pages)<li><a href="$page.uri">$page.name</a></li>#end
-      </ul>
-    </p>
+    <ul>
+      #foreach($page in $pages)
+      <li>
+        <a href="$sitePath$page.uri" title="$page.title">
+          #if($page.img)
+            <img src="$page.img" alt="$page.alt"/>
+          #end
+          $page.name
+        </a>
+        #if($page.title)
+          <code>title</code>=$page.title
+        #end
+        #if($page.img)
+          <code>img</code>=$page.img
+        #end
+        #if($page.alt)
+          <code>alt</code>=$page.alt
+        #end
+        #if(!$page.childs.isEmpty())
+        <br />
+        Childs:
+        <ol>
+          #foreach($child in $page.childs.entrySet())
+          <li><a href="$sitePath$child.key">$child.value</a></li>
+          #end
+        </ol>
+        #end
+      </li>
+      #end
+    </ul>
+    <h2>Crumbs</h2>
+    <ol>
+      #foreach($crumb in $page.crumbs)
+      <li><a href="$sitePath$crumb.uri">$crumb.name</a></li>
+      #end
+    </ol>
   </body>
 </html>