All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.maven.site.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.

The newest version!
#*
 * Copyright 2012 Andrius Velykis
 *
 * 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.
 *#


#*


--------------------------------------------------*###
#**
 * Convenience directive to invoke a method and ignore the return value.
 *
 * Usage:
 *	  #call ( $hashtable.put("foo", "bar") )
 *###
#macro ( call $foo )#*
	*##if ($foo)#*
		// do nothing - the 'if' is for ignoring the return value
	*##end##
#end#* /call



--------------------------------------------------*###
#**
 * Checks if the given link is an external one.
 *###
#macro ( checkExtLink $href )#*

	*##set ( $checkExtLink = false )#*
	*##if ( $href && ($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 ( $checkExtLink = true )#*
	*##end##
#end#* /checkExtLink



--------------------------------------------------*###
#**
 * Relativizes the link
 *###
#macro ( relativeLink $href )#*

	*##if ( $href )#*

		*##set ( $relativeLink = $PathTool.calculateLink( $href, $relativePath ) )#*
		*##set ( $relativeLink = $relativeLink.replaceAll( "\\", "/" ) )#*
		*##if ( ( $relativeLink == '' ) )#*
			*##set ( $relativeLink = './' )#*
		*##end#*

		// Attempt to normalise the relative link - this is useful for active link
		// calculations and better relative links for subdirectories.
		//
		// The issue is particularly visible with pages in subdirectories,
		// so that if you are in /dev/index.html, the relative menu link to
		// the _same_ page would likely be ../dev/index.html instead of '' or 'index.html'.
		*##set ( $absoluteLink = $uriTool.toURI( "$currentFileLoc" ).resolve( "$relativeLink" ).normalize().toString() )#*
		*##if ( $currentFileLoc == $absoluteLink )#*
			// for matching link, use empty relative link
			*##set ( $relativeLink = '' )#*
		*##else#*
			// relativize the absolute link based on current directory
			// (uses Maven project link relativization)
			*##set ( $currentFileDir = $PathTool.getDirectoryComponent( $currentFileLoc ) )#*
			*##set ( $relativeLink = $uriTool.relativizeLink( $currentFileDir, $absoluteLink ) )#*
		*##end#*

	*##else#*
		// null $href
		*##set ( $relativeLink = false )#*
	*##end##
#end#* /relativeLink



--------------------------------------------------*###
#**
 * Checks if the given link is an external one. If not, calculates a relative link.
 *###
#macro ( relativeExtLink $href )#*

	*##checkExtLink ( $href )#*
	*##if ( $checkExtLink )#*
		// if external, keep the original
		*##set ( $relativeExtLink = $href )#*
	*##else#*
		// if not external link, calculate an return the relative link
		*##relativeLink ( $href )#*
		*##set ( $relativeExtLink = $relativeLink )#*
	*##end##
#end#* /relativeExtLink



--------------------------------------------------*###
#**
 * Makes the link relative to the project URL, if one is set.
 *###
#macro ( currentFileRelativeLink $href )#*

	*##if ( $project.url && $project.url != '' && $currentFileName )#*
		// if project URL is available, relativize the link using it as a base dir
		// note that the current file can be nested under project URL, so take that into account
		*##set ( $currentFileDir = $uriTool.toURI( "$project.url/" ).resolve( "$currentFileName" ).resolve(".").toString() )#*
		*##set ( $currentFileRelativeLink = $uriTool.relativizeLink( $currentFileDir, $href ) )#*
	*##else#*
		// otherwise just keep the original link
		*##set ( $currentFileRelativeLink = $href )#*
	*##end##
#end#* /currentFileRelativeLink



--------------------------------------------------*###
#**
 * Checks if the given link is the currently active one
 *###
#macro ( activeLink $href )#*

	*##relativeLink ( $href )#*

	*##if ( $href )#*
		// either empty link (pointing to a page), or if the current file is index.html,
		// the link may point to the whole directory
		*##if ( '' == $relativeLink || ( $alignedFileName.endsWith("index.html") && './' == $relativeLink ) )#*
			*##set ( $activeLink = true )#*
			*##set ( $activeClass = 'active' )#*
		*##else#*
			*##set ( $activeLink = false )#*
			*##set ( $activeClass = '' )#*
		*##end#*
	*##else#*
		// null href - disable the link
		*##set ( $activeLink = false )#*
		*##set ( $activeClass = 'disabled' )#*
	*##end##
#end#* /activeLink



--------------------------------------------------*###
#**
 * Creates a class="name" attribute if the given name exists
 *###
#macro ( classAttr $name )#*

	*##if ( $name && '' != $name )#*
		*#class="$name"#*
	*##end##
#end#* /class


--------------------------------------------------*###
#**
 * Creates dropdown menu items
 *###
#macro ( topMenu $menus )#*

	*##foreach ( $menu in $menus )#*

		*##if ( $menu.name )#*
			// check if one of the subtree items is the current one
			*##set ( $displayTree = false )#*
			*##displayTree ( $menu )##
							
#*		*##end#*
	*##end## /foreach $menu
#end#* /topMenu



--------------------------------------------------*###
#**
 * Outputs a list of links
 *###
#macro ( links $links )#*

	*##foreach ( $item in $links )#*
		*##activeLink ( $item.href )##
							
  • #link ( $relativeLink $item.name $item.target )
  • #* *##end## #end#* /links --------------------------------------------------*### #** * Shortcut to display a basic hyperlink *### #macro ( link $href $name $target )#* *##fullLink ( $href $name $target false false false false false false false )## #end#* /link --------------------------------------------------*### #** * Outputs a hyperlink with image and other attributes *### #macro ( fullLink $href $name $target $img $position $alt $border $width $height $icon)#* // The opening tag *### #* *##if ( $img && $position == "left" )#* // Image on the left side of the name *##image ($img $alt $border $width $height)$name#* *##elseif ( $img )#* // Image on the right side of the name *#${name}#if ($img) #image ($img $alt $border $width $height)#end#* *##else#* // No image - optional icon though on the right of the name *#${name}#if ($icon) #end#* *##end#* // Close *### ## #end#* /fullLink --------------------------------------------------*### #** * Outputs an image with attributes *### #macro ( image $img $alt $border $width $height )#* *##if ( $img )#* *#"#* *##end## #end#* /image --------------------------------------------------*### #** * Outputs a list of breadcrumbs *### #macro ( breadcrumbs $breadcrumbs )#* *##foreach ( $item in $breadcrumbs )#* *##relativeLink ( $item.href )##
  • #fullLink ( $relativeLink $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false )
  • /
  • #* *##end##
  • #if ( $shortTitle )$shortTitle#else$title#end
  • #end#* /breadcrumbs --------------------------------------------------*### #** * Outputs the top Table of Contents ( subnav ) *### #macro ( topToc $topItems )#* // read the top ToC max config to get the number of items to show *##if ( $config.tocTopMax )#* *##set ( $tocMax = $convert.toNumber($config.tocTopMax.getValue()) )#* *##else#* *##set ( $tocMax = -1 )#* *##end#* // check if we flatten the first 2 levels of ToC: *##set ( $flattenConfig = $config.tocTopFlatten )#* *##if ( !$flattenConfig )#* // flatten config not available - calculate if need flattening: // only flatten if the top level has not more than 2 elements *##set ( $topItemsCount = $topItems.size() )#* *##set ( $flattenLevel2 = $topItemsCount <= 2 )#* *##elseif ( "true" == $flattenConfig.getValue() )#* *##set ( $flattenLevel2 = true )#* *##else#* *##set ( $flattenLevel2 = false )#* *##end#* // count items at top and the next level that will be displayed in the ToC bar *##set ( $tocBarItems = [] )#* *##set ( $tocBarMaxItems = [] )#* *##set ( $tocCount = 0 )#* *##foreach ( $topItem in $topItems )#* *##if ( ($tocCount < $tocMax) || ($tocMax < 0) )#* // only add items if not after the maximum *##call ( $tocBarItems.add( $topItem ) )#* *##set ( $topInMax = false )#* *##else#* *##call ( $tocBarMaxItems.add( $topItem ) )#* *##set ( $topInMax = true )#* *##end#* *##set ( $tocCount = $tocCount + 1 )#* // if level 2 is flattened, traverse for subitems *##if ( $flattenLevel2 )#* *##foreach ( $item in $topItem.items )#* *##if ( ($tocCount < $tocMax) || ($tocMax < 0) )#* // only add subitems if not after the maximum *##call ( $tocBarItems.add( $item ) )#* *##elseif ( !$topInMax )#* // top is not in the max - so add these directly to the max *##call ( $tocBarMaxItems.add( $item ) )#* *##end#* *##set ( $tocCount = $tocCount + 1 )#* *##end#* /foreach $item *##end#* *##end#* /foreach $topItem // count items at top and the next level that will be displayed in the ToC bar *##set ( $tocCount = 0 )#* *##set ( $tocDivider = false )#* *##foreach ( $topItem in $tocBarItems )#* *##if ( $topItems.contains( $topItem ) && $tocDivider )##
  • #* *##end#* *##if ( $topItem.items.isEmpty() )##
  • $topItem.text
  • #* *##elseif ( $topItems.contains( $topItem ) && $flattenLevel2 )#* // top level item, but flattened: put it as a link, because its children are also in top bar *###
  • $topItem.text
  • #* *##else## #* *##end#* *##set ( $tocDivider = true )#* *##end#* /foreach $topItem *##if ( $tocBarMaxItems.size() > 0 )#* // put the max items into an extra dropdown *###
  • #* *##end## #end#* /topToc --------------------------------------------------*### #** * Recursively outputs the contents of top bar ToC dropdown item *### #macro ( topTocDropdown $items )#* *##foreach ( $subitem in $items )#* *##if ($subitem.items.isEmpty())##
  • $subitem.text
  • #* *##else## #* *##end#* *##end## /foreach $subitem #end#* /topTocOpenRemaining --------------------------------------------------*### #** * Outputs Table of Contents into a list menu *### #macro ( listToc $menus )## ## #end#* /listToc --------------------------------------------------*### #** * Recursively outputs ToC item and its children *### #macro ( listTocItem $item )#* *##if ( $item.items.size() > 0 )## #* *##else##
  • $item.text #* *##set ( $addedDivider = false )## #* *##end## #end#* /listTocItem --------------------------------------------------*### #** * Outputs the top banner contents *### #macro ( banner $banner $id )#* *##if ( $banner )#* *##if ( $banner.href )#* *##relativeExtLink ( $banner.href )## #* *##else## #* *##end#* // add slogan to correct position *##if ( $config.slogan && $config.slogan != '' )#* // read slogan position - if not set, use 'bannerLeft' as default *##if ( $config.slogan.getAttribute("position") )#* *##set ( $sloganPos = $config.slogan.getAttribute("position") )#* *##else#* *##set ( $sloganPos = "bannerLeft" )#* *##end#* *##if ( $id == $sloganPos )##

    $config.slogan.getValue()

    #* *##end#* *##end#* /slogan *##end## #end#* /banner --------------------------------------------------*### #** * 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 ( bodySections $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 )##
  • #* // check if need to add explicit ToC sidebar // (if ToC sidebar is needed, but no sidebar is defined) *##if ( $tocSidebar && !$hasSidebar )#* *##tocSidebar () #* *##end## #* *##end#* // Print the subsections into columns *##if ( 'thumbs' == $sectType )#* *##thumbs ( $sectTypeValue $subsections )#* *##elseif ( 'columns' == $sectType )#* *##columns ( $sectTypeValue $subsections )#* *##else#* *##carousel ( $subsections )#* *##end#* // mark that last one was not a body *##set ( $lastBody = false )#* *##elseif ( 'sidebar' == $sectType )#* // for sidebar, close the body if needed but not body row - then add the sidebar *##if ( $lastBody )## #* *##else##
    #* *##end##
    #* *##if ( $tocSidebar )#* *##tocSidebarContent () #* *##end##
    #* *##set ( $lastBody = false )#* *##else#* // handle all other cases as 'body' type *##if ( !$lastBody )##
    #* *##if ( $hasSidebar || $tocSidebar )#* // has a sidebar - take part width *#
    #* *##else#* // no sidebar - take full width *#
    #* *##end##
    #* *##else#* // reinstate the horizontal rule for continuing body *#
    #* *##end#* // set the contents *##foreach ( $subsection in $subsections )#* // if first body section, output with page-header *##if ( !$bodyFound )## #bodyWithHeader ( $subsection ) #* *##else## $subsection #* *##end#* *##set ( $bodyFound = true )#* #* *##end#* *##set ( $lastBody = true )#* *##end#* // increment the section counter (need to advance through the types) *##set ( $sectIndex = $sectIndex + 1 )#* *##end#* // After the loop, check if body section still needs closing (if it was the last section) *##if ( $lastBody )##
    #* // check if need to add explicit ToC sidebar // (if ToC sidebar is needed, but no sidebar is defined) *##if ( $tocSidebar && !$hasSidebar )#* *##tocSidebar () #* *##end##
    #* *##end## ## #end#* /bodySections --------------------------------------------------*### #** * Outputs subsections as thumbnail grid. Also rearranges the images to come on top. *### #macro ( thumbs $colCount $subsections )##
    #* *##set ( $colCount = $convert.toNumber($colCount) )##
      #* *##set ( $colSpan = 12 / $colCount )#* *##foreach ( $subsection in $subsections )##
    • #* // bring the first image (possibly with a link) to the top of the subsection // (to have a thumbnail with leading image) *##set ( $thumbnailContent = $htmlTool.reorderToTop( $subsection, "a:has(img), img", 1, '
      ' ) )#* *##if ( $thumbnailContent == $subsection )#* // no image found, so at least wrap into a caption *###
      #stripEmptyP ( $thumbnailContent )
      #* *##else## #stripEmptyP ( $thumbnailContent ) #* *##end##
    • #* *##end## /foreach $subsection
    #end#* /thumbs --------------------------------------------------*### #** * Outputs subsections into a column grid *### #macro ( columns $colCount $subsections )#* *##set ( $colCount = $convert.toNumber($colCount) )##
    #* *##set ( $colSpan = 12 / $colCount )#* *##set ( $i = 1 )#* *##foreach ( $subsection in $subsections )##
    $subsection
    #* *##set ( $mod = $i % $colCount )#* *##if ( $mod == 0 )#* //new row *###
    #* *##end#* *##set ( $i = $i + 1 )#* *##end## /foreach $subsection
    #end#* /columns --------------------------------------------------*### #** * Outputs subsections into a sidebar one after another *### #macro ( sidebar $subsections )#* *##foreach ( $subsection in $subsections )## $subsection #* *##end## #end#* /sidebar --------------------------------------------------*### #** * Outputs subsections into a carousel. Also rearranges the layout to fit carousel. *### #macro ( carousel $subsections )#* *##if ( !$carouselCounter )#* *##set ( $carouselCounter = 0 )#* *##else#* *##set ( $carouselCounter = $carouselCounter + 1 )#* *##end#* *##set ( $carouselId = "carousel$carouselCounter" )## #end#* /carousel --------------------------------------------------*### #** * Outputs a sidebar containing ToC only. * Does not do anything if ToC sidebar has already been added. *### #macro ( tocSidebar )#* *##if ( !$tocSidebarAdded )##
    #* *##tocSidebarContent ()
    #* *##end## #end#* /tocSidebar --------------------------------------------------*### #** * Outputs ToC sidebar contents. * Does not do anything if ToC sidebar has already been added. *### #macro ( tocSidebarContent )#* *##if ( !$tocSidebarAdded )##
    #* // do not set as scroll target - works weird with grid section headers
    *###
    #* *##listToc ( $tocItems )
    #* *##set ( $tocSidebarAdded = true )#* *##end## #end#* /tocSidebarContent --------------------------------------------------*### #** * Renders copyright year (inception-currentDate) and organization. *### #macro ( copyright )#* *##if ( $project )#* *##set ( $currentYear = ${currentDate.year} + 1900 )#* *##if ( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) )#* *#${project.inceptionYear}-${currentYear}#* *##else#* *#${currentYear}#* *##end#* *##if ( ${project.organization} && ${project.organization.name} )#* *##if ( ${project.organization.url} )#* *# ${project.organization.name}#* *##else#* *# ${project.organization.name}#* *##end#* *##end#* *##end## #end#* /copyright --------------------------------------------------*### #** * Recursively checks if any of the submenu items is the current one *### #macro ( displayTree $item )#* *##if ( $item && $item.items && $item.items.size() > 0 )#* *##foreach ( $subitem in $item.items )#* *##activeLink ( $subitem.href )#* *##if ( $activeLink )#* *##set ( $displayTree = true )#* *##end#* *##displayTree ( $subitem )#* *##end#* /foreach $subitem *##end## #end#* /displayTree --------------------------------------------------*### #** * Recursively outputs menu item and its children *### #macro ( menuItem $item )#* *##set ( $collapseClass = false )#* *##activeLink ( $item.href )#* // store value (if active) for later *##set ( $active = $activeLink )#* *##if ( $active )#* *##set ( $currentLink = "#" )#* *##else#* *##set ( $currentLink = $relativeLink )#* *##end#* *##if ( $item.items && $item.items.size() > 0 )#* *##if ( $item.collapse == false )#* *##set ( $collapseClass = "icon-chevron-down" )#* *##else#* // By default collapsed *##set ( $collapseClass = "icon-chevron-right" )#* *##end#* // check if one of the subtree items is the current one, if so, autoexpand *##set ( $displayTree = false )#displayTree ( $item )#* *##if ( $active || $displayTree )#* *##set ( $collapseClass = "icon-chevron-down" )#* *##end#* *##end## /item with children ##
  • ## #fullLink ( $currentLink $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $collapseClass) #* *##if ( $item.items && $item.items.size() > 0 && $collapseClass == "icon-chevron-down" )## #* *##end##
  • #end#* /menuItem --------------------------------------------------*### #** * Creates a list menu with submenus *### #macro ( listMenu $menus )## ## #end#* /listMenu --------------------------------------------------*### #** * Filters menus by their ref or name, and returns the matching results. * The regex is used to check the match *### #macro ( filterMenus $menus $filterRegex )#* *##set ( $filterMenus = [] )#* *##foreach ($menu in $menus)#* *##if ( ( $menu.ref && $menu.ref.matches($filterRegex) ) || ( $menu.name && $menu.name.matches($filterRegex) ) )#* *##call ( $filterMenus.add( $menu ) )#* *##end#* *##end## /foreach $menu #end#* /filterMenus --------------------------------------------------*### #** * Outputs bottom navigation columns. The menus can be split into columns to be * placed in the bottom navigation. This is done with the `bottomNav` config option: * * - maximum span is indicated in the attribute (default =9) * regex - indicates to add a column with the indicated regex filter * regex - ... * regex - ... * * * (The above produces a 3-column navigation with `span2` for each column (because max is 8)). *### #macro ( bottomNav )#* // by default, max span for bottom navigation is 9 *##set ( $maxNavSpan = 9 )#* *##if ( $config.bottomNav && $config.bottomNav.getChildCount() > 0 )#* // Bottom navigation config is available - filter menus for each column and collect *##set ( $menuColumns = [] )#* *##foreach ( $bottomNavCol in $config.bottomNav.getChildren() )#* *##filterMenus ( $decoration.body.menus, $bottomNavCol.getValue() )#* *##call ( $menuColumns.add( $filterMenus ) )#* *##end#* // read max span for bottom navigation from the config *##if ( $config.bottomNav.getAttribute("maxSpan") )#* *##set ( $maxNavSpanStr = $config.bottomNav.getAttribute("maxSpan") )#* *##set ( $maxNavSpan = $convert.toNumber($maxNavSpanStr) )#* *##end#* *##else#* // No bottom navigation config - just use all menus in a single column *##set ( $menuColumns = [ $decoration.body.menus ] )#* *##end#* *##if ( $maxNavSpan > 12 )#* *##set ( $maxNavSpan = 12 )#* *##end#* // Determine the column widths (aim for max span of 9 (default), and max width of 4) *##set ( $navSpan = $maxNavSpan / $menuColumns.size() )#* *##if ( $navSpan > 4 )#* *##set ( $navSpan = 4 )#* *##end#* *##if ( $navSpan <= 0 )#* *##set ( $navSpan = 1 )#* *##end#* *##if ( $maxNavSpan <= 0 )#* *##set ( $maxNavSpan = $navSpan * $menuColumns.size() )#* *##end#* // mark total span taken by the bottomNav (needed to add other components to the footer) *##set ( $lastNavSpan = $maxNavSpan - ($navSpan * ($menuColumns.size() - 1)) )#* *##set ( $totalNavSpan = $maxNavSpan )#* *##set ( $navColIndex = 0 )#* *##foreach ( $menuCol in $menuColumns )#* *##if ( $navColIndex == $menuColumns.size() - 1 )#* *##set ( $navSpan = $lastNavSpan )#* *##end##
    #* *##listMenu ( $menuCol )
    #* *##set ( $navColIndex = $navColIndex + 1 )#* *##end## #end#* /bottomNav --------------------------------------------------*### #** * Displays a 'Last published' date message. *### #macro ( publishDate )#* *##if ( $decoration.publishDate.format )#* *##set ( $format = $decoration.publishDate.format )#* *##else#* *##set ( $format = "yyyy-MM-dd" )#* *##end#* *#$dateFormat.applyPattern( $format )#* *##if ( $publishDate )#* *##set ( $dateValue = $dateFormat.format( $publishDate ) )#* *##elseif ( $config.publishDate )#* *##set ( $dateValue = $config.publishDate.getValue() )#* *##else#* *##set ( $dateValue = $dateFormat.format( $currentDate ) )#* *##end#* // render with internationalization support *#$i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateValue## #end#* /publishDate --------------------------------------------------*### #** * Displays a site version message. *### #macro ( version )#* // render with internationalization support *#$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}## #end#* /version --------------------------------------------------*### #** * Outputs XML DOM objects as html elements into the rendered document. * Taken from maven-fluido-skin. *### #macro ( htmlContent $items )#* *##foreach ( $item in $items )#* *##set ( $itemHtml = $item.toString().trim() )#* *##set ( $documentHeader = '' )#* *##if ( $item.name == "script" )#* *##set ( $itemHtml = $StringUtils.replace( $item.toUnescapedString(), $documentHeader, "" ) )#* *##else#* *##set ( $itemHtml = $StringUtils.replace( $item.toString(), $documentHeader, "" ) )#* *##end#* // eval the HTML - this will allow users to specify Velocity variables *##evaluate ( $itemHtml )#* *##end## #end#* /htmlContent --------------------------------------------------*### #** * Marks the first header inside the content as page header, by wrapping it into * a div with `page-header` class *### #macro ( bodyWithHeader $content )#* *##if ( $config.not( "markPageHeader" ) )#* // do not mark page header, just print the content *##set ( $bodyWithHeader = $content )#* *##else#* // try marking the header *##set ( $bodyWithHeader = $htmlTool.wrap($content, "h1", '', 1) )#* *##if ( $bodyWithHeader == $content )#* // nothing's changed - try with h2 *##set ( $bodyWithHeader = $htmlTool.wrap($content, "h2", '', 1) )#* *##end#* *##end#* *#$bodyWithHeader #end#* /bodyWithHeader --------------------------------------------------*### #** * Strips empty paragraphs

    from the content and outputs the result *### #macro ( stripEmptyP $content )#* // use CSS selector for paragraphs that have no text content (only whitespace - \s), // neither nested elements *#$htmlTool.remove($content, "p:matchesOwn(^${esc.backslash}s*$):not(*:has(*))") #end#* /stripEmptyP --------------------------------------------------*### #** * Adds Google analytics tracker with the given account ID *### #macro ( googleAnalytics $accountId )#* *##if( $accountId && $accountId != "" )## #end #end#* /googleAnalytics --------------------------------------------------*### #** * Fixes info collapse for Dependencies report. * * Uses Javascript toggle for "more information" in the dependency tree. *### #macro ( depsCollapse )#* *##set( $collapseCalls = $htmlTool.getAttr( $bodyContent, 'img[onclick^=toggleDependencyDetail]', "onclick") )#* *##set( $iconReplacements = {} )#* *##set( $collapseSelector = "" )#* *##foreach ( $collapseCall in $collapseCalls )#* *##set ( $funSplit = $collapseCall.split("'") )#* *##if ( $funSplit.size() >= 4 )#* *##set ( $divId = $funSplit.get(1) )#* *##set ( $imgId = $funSplit.get(3) )#* *##set ( $replBefore = '' )#* *##call ( $iconReplacements.put("#$imgId", "$replBefore$divId$replAfter") )#* *##set ( $collapseSelector = "${collapseSelector}, #$divId" )#* *##end#* *##end#* *##if ( $iconReplacements.size() > 0 )#* *##set ( $bodyContent = $htmlTool.replaceAll( $bodyContent, $iconReplacements ) )#* *##set ( $bodyContent = $htmlTool.addClass( $bodyContent, $collapseSelector, "collapse" ) )#* *##set ( $bodyContent = $htmlTool.setAttr( $bodyContent, $collapseSelector, "style", "" ) )#* *##end## #end#* /depsCollapse -------------------------------------------------- -------------------------------------------------- The page HTML -------------------------------------------------- -------------------------------------------------- *### #* *##if ( $project.name && $project.name != '' )#* *##set ( $defaultProjectName = $project.name )#* *##else#* *##set ( $defaultProjectName = $project.artifactId )#* *##end#* // resolve date position, or set the default otherwise (bottom) // Note, that currently we do not support "navigation-top" position for either publishDate or version. *##set ( $datePosition = "bottom" )#* *##if ( $decoration.publishDate.position )#* *##set ( $datePosition = $decoration.publishDate.position )#* *##end#* // resolve version position, or set the default otherwise (bottom) *##set ( $versionPosition = "bottom" )#* *##if ( $decoration.version.position )#* *##set ( $versionPosition = $decoration.version.position )#* *##end#* *##if ( $decoration.publishDate.position )#* *##set ( $datePosition = $decoration.publishDate.position )#* *##else#* *##set ( $datePosition = "bottom" )#* *##end#* // Try resolving site URL from the POM. // This can help with resolution of relative links, needed for 'active' link calculations, // e.g. to normalise the relative links in menus. *##if ( $project.url && $project.url != '' )#* *##set ( $projectSiteLoc = $project.url )#* *##if ( !$projectSiteLoc.endsWith("/") )#* // ensure that the directory is uniform *##set ( $projectSiteLoc = "$projectSiteLoc/" )#* *##end#* *##else#* // dummy project URL is used to provide a good base to resolve relative links with ../ *##set ( $projectSiteLoc = "http://dummy.parent.url/" )#* *##end#* // absolute location of the current file *##set ( $currentFileLoc = $uriTool.toURI( "$projectSiteLoc" ).resolve( "$currentFileName" ).toString() )#* // Check if is set on the page or globally, then display Table of Contents *##if ( $config.isValue( "toc", "top" ) )#* *##set ( $tocTop = true )#* *##else#* *##set ( $tocTop = false )#* *##end#* *##if ( $config.isValue( "toc", "sidebar" ) )#* *##set ( $tocSidebar = true )#* *##else#* *##set ( $tocSidebar = false )#* *##end#* *##if ( !$config.not( "imgLightbox" ) )#* // lightbox is enabled by default, so check for false and negate // TODO explain more? *##set ( $bodyContent = $htmlTool.setAttr( $bodyContent, "a[href$=jpg], a[href$=JPG], a[href$=jpeg], a[href$=JPEG], a[href$=png], a[href$=gif], a[href$=bmp]:has(img)", "data-lightbox", "page" ))#* *##end#* *##if ( !$config.not( "html5Anchor" ) )#* // HTML5-style anchors are enabled by default, so check for false and negate *##set ( $bodyContent = $htmlTool.headingAnchorToId( $bodyContent ) )#* *##end#* *##if ( !$config.not( "bootstrapCss" ) )#* // Bootstrap CSS class conversion is enabled by default, so check for false and negate *##set ( $bodyContent = $htmlTool.addClass( $bodyContent, "table.bodyTable", ["table", "table-striped", "table-hover"] ) )#* *##set ( $bodyContent = $htmlTool.fixTableHeads( $bodyContent ) )#* *##end#* *##if ( !$config.not( "bootstrapIcons" ) )#* // Bootstrap Icons are enabled by default, so check for false and negate *##depsCollapse ()#* *##set ( $iconReplacements = { 'img[src$=images/add.gif]' : '', 'img[src$=images/remove.gif]' : '', 'img[src$=images/fix.gif]' : '', 'img[src$=images/update.gif]' : '', 'img[src$=images/icon_help_sml.gif]' : '', 'img[src$=images/icon_success_sml.gif]' : '', 'img[src$=images/icon_warning_sml.gif]' : '', 'img[src$=images/icon_error_sml.gif]' : '', 'img[src$=images/icon_info_sml.gif]' : '' } )#* *##set ( $bodyContent = $htmlTool.replaceAll( $bodyContent, $iconReplacements ) )#* *##end#* *##if ( $tocTop || $tocSidebar )#* // Ensure IDs on all headings to refer to them in TOC *##set ( $bodyContent = $htmlTool.ensureHeadingIds( $bodyContent, "_" ) )#* *##set ( $tocItems = $htmlTool.headingTree( $bodyContent ) )#* *##end#* // generate a short title if one does not exist or is specified explicitly // if specified explicitly, use that *##set ( $shortTitleGenerated = false )#* *##if ( !$config.not( "shortTitle" ) && ( !$shortTitle || $shortTitle == '' || ($config.shortTitle && !$config.isValue("shortTitle", "generate") && !$config.isValue("shortTitle", "true") ) ) )#* // Page title generation is enabled by default, so check for false and negate *##if ( $config.shortTitle && !$config.isValue("shortTitle", "generate") && !$config.isValue("shortTitle", "true") )#* // Use explicitly specified title *##set ( $shortTitle = $config.shortTitle.getValue() )#* *##set ( $shortTitleGenerated = true )#* *##else#* // Generate the title. // To generate the title, we take the contents of the first h1 tag in the document. // If it does not exist, we take the contents of the first h2 tag. *##set ( $hTexts = $htmlTool.text( $bodyContent, "h1" ) )#* *##if ( $hTexts.size() == 0 )#* *##set ( $hTexts = $htmlTool.text( $bodyContent, "h2" ) )#* *##end#* *##if ( $hTexts.size() > 0 )#* *##set ( $shortTitle = $hTexts.get(0) )#* *##set ( $shortTitleGenerated = true )#* *##end#* *##end#* *##end#* // If title template is provided, use it to generate title. // Also regenerate title if a new short title was generated. *##if ( $config.titleTemplate || $shortTitleGenerated )#* // read the title template from configuration *##if ( $config.titleTemplate )#* *##set ( $titleTemplate = $config.titleTemplate.getValue() )#* *##else#* // default template is "projectName - shortTitle" *##set ( $titleTemplate = "%1${esc.d}s - %2${esc.d}s" )#* *##end#* // the company/project name is retrieved from decoration ( ) // or from the project itself *##if ( $decoration.name )#* *##set ( $titleProjectName = $decoration.name )#* *##elseif ( $project.name )#* *##set ( $titleProjectName = $project.name )#* *##else#* *##set ( $titleProjectName = "" )#* *##end#* // use String.format() to create new title *##set ( $title = $titleTemplate.format( $titleTemplate, $titleProjectName, $shortTitle ) )#* *##end#* *### $title #* *##foreach ( $author in $authors )## #* *##end#* *##if ( $locale )## #* *##end#* // Use protocol relative URLs: http://paulirish.com/2010/the-protocol-relative-url/ // So we need a workaround for local file:// URLs // Use config option true *##if ( $config.is( "protocolRelativeURLs" ) )#* *##set ( $protocol = "" )#* *##else#* *##set ( $protocol = "http:" )#* *##end#* // Use config option http://mysite.com/ *##if ( $config.absoluteResourceURL && $config.absoluteResourceURL.getValue() != '' )#* *##currentFileRelativeLink ( $config.absoluteResourceURL.getValue() ) #* *##set ( $resourcePath = $currentFileRelativeLink )#* *##else#* *##set ( $resourcePath = $relativePath )#* *##end#* // Config option true to force CDN-less Bootstrap & jQuery *##if ( $config.is( "localResources" ) )#* *##set ( $localResources = true )#* *##else#* *##set ( $localResources = false )#* *##end#* // for 'site' theme, use local CSS/Javascript. This allows users to use their own Bootstrap configs. // Otherwise, load the default or Bootswatch themes from BootstrapCDN *##if ( $localResources || ( $config.theme && "site" == $config.theme.getValue() ) )#* *##set ( $bootstrapCssPath = "$resourcePath/css" )#* *##set ( $bootstrapCssResponsivePath = $bootstrapCssPath )#* *##set ( $bootstrapCssCombined = false )#* *##set ( $bootstrapJsPath = "$resourcePath/js" )#* *##else#* *##set ( $bootstrapVersion = "2.3.2" )#* *##set ( $bootswatchVersion = "2.3.2" )#* // use Bootstrap theme from BootstrapCDN (loaded over network) *##if ( $config.theme && $config.theme.getValue().startsWith("bootswatch-") )#* *##set ( $bootswatchTheme = $config.theme.getValue().substring(11) )#* *##else#* *##set ( $bootswatchTheme = false )#* *##end#* *##if ( $bootswatchTheme )#* *##set ( $bootstrapCssPath = "$protocol//netdna.bootstrapcdn.com/bootswatch/${bootswatchVersion}/$bootswatchTheme" )#* // use Bootstrap 2.3.1 for responsive CDN, because 2.3.2 is not available (CSS did not change 2.3.1 -> 2.3.2) *##set ( $bootstrapCssResponsivePath = "$protocol//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css" )#* *##set ( $bootstrapCssCombined = false )#* *##else#* *##set ( $bootstrapCssPath = "$protocol//netdna.bootstrapcdn.com/twitter-bootstrap/${bootstrapVersion}/css" )#* // since Bootstrap 2.3.2, the CDN hosts a combined version of default Bootstrap *##set ( $bootstrapCssCombined = true )#* *##end#* *##set ( $bootstrapJsPath = "$protocol//netdna.bootstrapcdn.com/twitter-bootstrap/${bootstrapVersion}/js" )#* *##end## #* *##if ( !$bootstrapCssCombined )#* // if Bootstrap CSS is not combined, add bootstrap-responsive CSS *### #* *##end#* *##if ( $bootswatchTheme )#* // for Bootswatch themes, add bootswatch.css *### #* *##else## #* *##end## #* // disable CDN-loaded highlightJs altogether if `localResources` is selected. // it will need to be added manually *##if ( !$localResources && $config.is( "highlightJs" ) )#* *##set ( $highlightJs = true )#* *##else#* *##set ( $highlightJs = false )#* *##end#* *##set ( $highlightJsVersion = "7.5" )#* #* *##if ( $highlightJs )#* // get the configured theme, or use default if not explicitly specified *##if ( $config.highlightJsTheme )#* *##set ( $highlightJsTheme = $config.highlightJsTheme.getValue() )#* *##else#* *##set ( $highlightJsTheme = 'default' )#* *##end#* // use a hosted version of highlight.js for syntax highlighting *### #* *##end## #* *##if ( !$config.not( "imgLightbox" ) )#* // if not disabled, include lightbox for showing images *### #* *##end## #* *##if ( $decoration.body.head )## #* *#$render.eval( $decoration.body.head ) #* *##end#* *##if( $headContent )#* *#$headContent #* *##end#* *##googleAnalytics( $decoration.googleAnalyticsAccountId ) ## ## // put page and project slugs as classes to the . This allows page-specific CSS customizations.
    #* *##if ( ($decoration.bannerLeft.name && $decoration.bannerLeft.name != $project.name || $decoration.bannerLeft.src || $decoration.bannerLeft.href ) || $decoration.bannerRight )#* *##set ( $hasBanner = true )#* *##else#* *##set ( $hasBanner = false )#* *##end##
    #* *##if ( $hasBanner )##
    #* *##end#* // add a 'breadcrumbs' bar for breadcrumbs, version and publish date (left/right) option *##if ( !$config.not( "breadcrumbs" ) && (( $decoration.body.breadcrumbs && $decoration.body.breadcrumbs.size() > 0) || $datePosition == "left" || $versionPosition == "left" || $datePosition == "right" || $versionPosition == "right") )##
    #* *##end#* *##if ( $tocTop )##
    #* // read top offset for fixed ToC bar from the config *##if ( $config.toc.getAttribute("offsetTop") )#* *##set ( $tocOffsetTop = $config.toc.getAttribute("offsetTop") )#* *##else#* *##set ( $tocOffsetTop = "250" )#* *##end#* *### #* *##end##
    #* *##if ( $config.sections )#* *##bodySections ( $bodyContent $config.sections ) #* *##else#* // non-sectioned body - just output it all *###
    #* *##if ( $tocSidebar )##
    #* *##else##
    #* *##end##
    #* *##bodyWithHeader ( $bodyContent )
    #* *##if ( $tocSidebar )#* *##tocSidebar () #* *##end##
    #* *##end##
    #* *##if( $decoration.body.menus )#* // if menus are available, display bottom navigation *##bottomNav ()#* *##else#* *##set ( $totalNavSpan = 0 )#* *##end#* *##if ( $config.bottomDescription )#* *##set ( $bottomSpanRemainder = 12 - $totalNavSpan )#* *##if ( $bottomSpanRemainder < 0 )#* *##set ( $bottomSpanRemainder = 1 )#* *##end##
    #* *##if ( $config.bottomDescription.getChildCount() > 0 )## #htmlContent ( $config.bottomDescription.getChildren() ) #* *##elseif ( $config.bottomDescription.getAttribute("quote") && 'false' == $config.bottomDescription.getAttribute("quote") )#* // no quote *### $config.bottomDescription.getValue() #* *##else##
    $config.bottomDescription.getValue()
    #* *##end#* // add version and publish date if the position is "navigation-bottom" // (note that 'bottomDescription' needs to be enabled) *##if ( $datePosition == "navigation-bottom" || $versionPosition == "navigation-bottom" )##
    #* *##if ( $versionPosition == "navigation-bottom" )#* *##version ()#* // add a line break if date is also displayed here *##if ( $datePosition == "navigation-bottom" )#* *#
    #* *##end#* *##end#* // now add the date *##if ( $datePosition == "navigation-bottom" )#* *##publishDate ()#* *##end
    #* *##end##
    #* *##end#* *###

    Back to top

    #* *##if ( $datePosition == "bottom" || $versionPosition == "bottom" )##

    #* *##if ( $versionPosition == "bottom" )#version (). #end#* *##if ( $datePosition == "bottom" )#publishDate (). #end#* *#

    #* *##end#* #* *##if ( !$config.not("skinAttribution") )##

    Reflow Maven skin.

    #* *##end#* *##if ( $decoration.body.footer )## $render.eval( $decoration.body.footer ) #* *##end#* *###
    #* *##if ( $localResources )## #* *##else## #* *##end## #* *##if ( !$config.not( "imgLightbox" ) )#* // if not disabled, include lightbox for showing images *### #* *##end#* *##if ( !$config.not( "smoothScroll" ) )#* // if not disabled, include smooth scrolling *### #* *##end#* *##if ( $highlightJs )#* // use a hosted version of highlight.js for syntax highlighting *### #* *##end#* *##if ( $config.endContent )#* // custom HTML (e.g. JavaScript) to place at the end of the document before *### #htmlContent ( $config.endContent.getChildren() ) #* *##end##