META-INF.maven.components.layout.vm Maven / Gradle / Ivy
Go to download
Reflow is an Apache Maven site skin built on Twitter Bootstrap.
It allows various structural and stylistic customizations to create
a modern-looking Maven-generated website. Requires Reflow Velocity Tools.
##
## Copyright 2012-2018 Christophe Friederich
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
#parse( "carousel.vm" )##
#parse( "columns.vm" )##
#parse( "thumbnails.vm" )##
#parse( "sidebar.vm" )##
#**
* Partitions the body contents into sections with possibly different representations.
* Available body types, indicated in custom page config `sections` tag:
*
*
* - the main body of the page
* - sidebar (should go after the body)
* x - x-column grid layout for thumbnails (first image is used as thumbnail)
* x - x-column grid layout
* - carousel (spinning images with captions)
*
*#
#macro ( renderBodySections $bodyContent $sectionConfig )#*
## Split everything in the content on the horizontal rule tags
*##set ( $sections = $htmlTool.split( $bodyContent, "hr" ) )#*
*##set ( $sectCount = $sectionConfig.getChildCount() )#*
## Check if sidebar is indicated somewhere in the sections, need to adjust layout accordingly
*##set ( $hasSidebar = $sectionConfig.getChild( 'sidebar' ) )#*
## flag to indicate that last section was a main body section (needs closing for non-body sections)
*##set ( $lastBody = false )#*
## flag to indicate that a body section has already been found (to avoid multiple page-headers)
*##set ( $bodyFound = false )#*
*##set ( $sectIndex = 0 )#*
*##foreach ($section in $sections)#*
## Determine section type from the configuration
*##if ( $sectIndex < $sectCount )#*
*##set ( $sectType = $sectionConfig.getChild($sectIndex).getName() )#*
*##set ( $sectTypeValue = $sectionConfig.getChild($sectIndex).getValue() )#*
*##else#*
*##set ( $sectType = 'body' )#*
*##end#*
*##if ( 'sidebar' == $sectType || 'thumbs' == $sectType || 'columns' == $sectType || 'carousel' == $sectType )#*
## split section into sub-sections for each header (h1, h2, etc tag)
*##set ( $subsections = $htmlTool.splitOnStarts( $section, "h1, h2, h3, h4, h5, h6") )#*
*##else#*
## keep the section
*##set ( $subsections = [ $section ] )#*
*##end#*
*##if ( 'thumbs' == $sectType || 'columns' == $sectType || 'carousel' == $sectType )#*
## for full width layouts, we first need to close the body if it is still open
*##if ( $lastBody )##