X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fsite%2Ftemplate.vm;fp=src%2Fsite%2Ftemplate.vm;h=5f586296a6e751e934bf85dc0f16e839f0cafc12;hp=0000000000000000000000000000000000000000;hb=a275df25c52fdb7b5b4275fcf9a359194f7b9116;hpb=e8263ad80b1651b812618c964fb02f7e5ddf3d7e diff --git a/src/site/template.vm b/src/site/template.vm new file mode 100644 index 00000000..5f586296 --- /dev/null +++ b/src/site/template.vm @@ -0,0 +1,334 @@ + + +## Datenstrukturen für die Navigation (Breadcrumbs und Menü) vorbereiten +#set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() ) +#set ( $parents = $project.getClass().forName('java.util.LinkedList').newInstance() ) +#set ( $active = 'index.html' ) +#set ( $skiplist = [ 'index.html' ] ) +#macro ( searchBreadcrumbTrail $items ) + #if ( $breadcrumbs ) + ## Der zuerst gefundene Pfad gilt (denn dieser liegt im selbst erzeugten Menü) + #else + #foreach ( $item in $items ) + #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) + #if ( $alignedFileName == $currentItemHref ) + ## Sonderfall abfangen :/ + #if ( $alignedFileName == 'index.html' ) + #set ( $breadcrumbs = [] ) + #set ( $path = [ 'index.html' ] ) + #else + #set ( $breadcrumbs = $crumbs.clone() ) + ## Den Titel der Seite korrigieren! + #set ( $title = "$project.name - $item.name" ) + #set ( $shortTitle = $item.name ) + ## Pfad für die Identifizierung sichtbarer Menüeinträge aufbauen + #set ( $path = [ 'index.html' ] ) + #foreach ( $crumb in $crumbs ) + #set ( $currentItemHref = $PathTool.calculateLink( $crumb.href, $relativePath ) ) + #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) + #set ( $sinkhole = $path.add( $currentItemHref ) ) + #end + #set ( $sinkhole = $path.add( $alignedFileName ) ) + #end + #else + #if ( !$item.items.empty ) + #set ( $sinkhole = $crumbs.push( $item ) ) + #searchBreadcrumbTrail ( $item.items ) + #set ( $sinkhole = $crumbs.pop() ) + #end + #end + #end + #end +#end +#macro ( buildSkiplist $item ) + #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $sinkhole = $skiplist.add( $currentItemHref.replaceAll( '\\', '/' ) ) ) + #foreach ( $item in $item.items ) + #buildSkiplist ( $item ) + #end +#end +#macro ( findActive $item $skip) + #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) + #set ( $doskip = false ) + #if ( $skip ) + #foreach ( $toskip in $skiplist ) + #if ( $currentItemHref == $toskip ) + #set ( $doskip = true ) + #end + #end + #end + #if ( !$doskip ) + #if ( $alignedFileName == $currentItemHref ) + #if ( $item.items.size() > 0 ) + #set ( $active = $alignedFileName ) + #else + #set ( $active = $parents.peek() ) + #end + #end + #set ( $sinkhole = $parents.push( $currentItemHref ) ) + #foreach ( $item in $item.items ) + #findActive ( $item $skip ) + #end + #set ( $sinkhole = $parents.pop() ) + #end +#end +#foreach ( $menu in $decoration.body.menus ) + ## Breadcrumb-Pfad suchen + #searchBreadcrumbTrail ( $menu.items ) + ## Bestimmen, welche Pfade in dem selbst definierten Menü liegen + #set ( $sinkhole = $parents.push( 'index.html' ) ) + #if ( !$menu.name ) + #foreach ( $item in $menu.items ) + #buildSkiplist( $item ) + #end + ## Aktives (Unter-)Menü bestimmen (und dabei nichts überspringen) + #foreach ( $item in $menu.items ) + #findActive( $item false) + #end + #else + ## Aktives (Unter-)Menü bestimmen (und dabei Einträge aus dem selbst + ## definierten Menü überspringen) + #foreach ( $item in $menu.items ) + #findActive( $item true) + #end + #end + #set ( $sinkhole = $parents.pop() ) + ## Sonderbehandlung der Einträge im selbst angelegten Menü + ## Das Menü wird daran erkannt, das der Name leer ist! +#end + + + + +## +#macro ( link $href $name $class ) + #set ( $linkTitle = ' title="' + $name + '"' ) + #if ( $href.toLowerCase().startsWith("http:/") || $href.toLowerCase().startsWith("https:/") || + $href.toLowerCase().startsWith("ftp:/") || $href.toLowerCase().startsWith("mailto:") || + $href.toLowerCase().startsWith("file:/") || ($href.toLowerCase().indexOf("://") != -1) ) + #set ( $linkClass = ' class="external ' + $class + '"' ) + #else + #set ( $linkClass = ' class="' + $class + '"' ) + #end + $name +#end +## +#macro ( menuItem $item $parent $skip) + #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) + #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) + #set ( $doskip = false ) + #if ( $skip ) + #foreach ( $toskip in $skiplist ) + #if ( $currentItemHref == $toskip ) + #set ( $doskip = true ) + #end + #end + #end +## + #if ( !$doskip ) + #set ( $onPath = false ) + #set ( $parentActive = false ) + #set ( $off = '' ) + #set ( $sub = '' ) + #set ( $cssClass = 's' ) + #foreach ( $entry in $path ) + #if ( $entry == $currentItemHref ) + #set ( $onPath = true ) + #set ( $cssClass = 's selected' ) + #end + #if ( $entry == $parent && $parent == $active ) + #set ( $parentActive = true ) + #end + #end + #if ( $item.items.size() > 0 ) + #set ( $sub = ' sub' ) + #end + #if ( !$onPath && !$parentActive ) + #set ( $off = ' off' ) + #end +