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

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

There is a newer version: 2.4.0-beta2
Show newest version
##
## Copyright 2012-2018 Christophe Friederich
##
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements.  See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership.  The ASF licenses this file
## to you 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##
##
#**
 *
 * Creates a class="name" attribute if the given name exists
 *
 *###
#macro ( classAttr $name )##
#*  *##if ( $name && '' != $name )##
#*      *# class="$name" ##
#*  *##end##
#end##
#**
 *
 * Shortcut to display a basic hyperlink
 *
 *###
#macro ( link $href $name $target $className)##
#*  *##fullLink ( $href $name $target false false false false false false false $className)##
#end##
##
#**
 *
 * Outputs a hyperlink with image and other attributes
 *
 *###
#macro ( fullLink $href $name $target $img $position $alt $border $width $height $icon $className)##
##
## 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##
##
##
#end##
#**
 *
 * Outputs an image with attributes
 *
 *###
#macro ( image $img $alt $border $width $height )##
#*  *##if ( $img )##
#*      *#"##
#*  *##end##
#end##
##
#**
 * 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##
##
#**
 * Displays a site version message.
 *
 *###
#macro ( version )##
#*  *### render with internationalization support
#*  *#$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}##
#end##
##
#**
 * 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##
##
#**
 * 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##
##
#**
 * 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## ## #** * Adds Google analytics tracker with the given account ID * *### #macro ( googleAnalytics $accountId )## #* *##if( $accountId && $accountId != "" )## #* *##end## #end## ## #** * Add Edit button if content is editable *### #macro ( renderFeedbackLink )## #end##




© 2015 - 2024 Weber Informatics LLC | Privacy Policy