From c1a6cf843a7604fb35601492b7afb554acdf59ce Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Thu, 29 Jun 2023 16:24:58 +0200 Subject: [PATCH] [MSKINS-237] Rework skin for new site model This closes #56 --- pom.xml | 2 +- src/it/mskins-107/verify.groovy | 2 +- src/it/mskins-28/src/site/site.xml | 12 +- src/it/mskins-76/verify.groovy | 7 +- src/it/mskins-76_topbar/verify.groovy | 7 +- src/it/sidebar/verify.groovy | 8 +- src/it/topbar/verify.groovy | 8 +- .../resources/META-INF/maven/site-macros.vm | 698 +++++++----------- src/main/resources/META-INF/maven/site.vm | 148 ++-- src/main/resources/META-INF/maven/skin.xml | 6 +- 10 files changed, 364 insertions(+), 534 deletions(-) diff --git a/pom.xml b/pom.xml index 2df4ace8..079d602d 100644 --- a/pom.xml +++ b/pom.xml @@ -98,7 +98,7 @@ under the License. 2.3.2 1.11.2 - 4.0.0-M9 + 4.0.0-M10 3.4.5 2023-07-09T19:58:37Z 4.3.1 diff --git a/src/it/mskins-107/verify.groovy b/src/it/mskins-107/verify.groovy index f0073b22..d80feaa5 100644 --- a/src/it/mskins-107/verify.groovy +++ b/src/it/mskins-107/verify.groovy @@ -20,4 +20,4 @@ File index = new File( basedir, "target/site/index.html" ) assert index.exists() -assert index.text.contains("") +assert index.text.contains("") diff --git a/src/it/mskins-28/src/site/site.xml b/src/it/mskins-28/src/site/site.xml index 6a2b8973..6d79639a 100644 --- a/src/it/mskins-28/src/site/site.xml +++ b/src/it/mskins-28/src/site/site.xml @@ -43,13 +43,15 @@ - + - + - - - + + + + + diff --git a/src/it/mskins-76/verify.groovy b/src/it/mskins-76/verify.groovy index 7b6983eb..fbeb7e3c 100644 --- a/src/it/mskins-76/verify.groovy +++ b/src/it/mskins-76/verify.groovy @@ -21,17 +21,16 @@ File index = new File( basedir, "target/site/index.html" ) assert index.exists() String text = index.text.normalize() assert text.contains( '''\ -'''.normalize() ) + '''.normalize() ) assert text.contains( '''\ '''.normalize() ) + Flattr this'''.normalize() ) diff --git a/src/it/mskins-76_topbar/verify.groovy b/src/it/mskins-76_topbar/verify.groovy index 4ea467de..3f0299b4 100644 --- a/src/it/mskins-76_topbar/verify.groovy +++ b/src/it/mskins-76_topbar/verify.groovy @@ -21,17 +21,16 @@ File index = new File( basedir, "target/site/index.html" ) assert index.exists() String text = index.text.normalize() assert text.contains( '''\ -'''.normalize() ) + '''.normalize() ) assert text.contains( '''\ '''.normalize() ) + Flattr this'''.normalize() ) diff --git a/src/it/sidebar/verify.groovy b/src/it/sidebar/verify.groovy index 98b6cab6..2e6dc1c5 100644 --- a/src/it/sidebar/verify.groovy +++ b/src/it/sidebar/verify.groovy @@ -23,9 +23,9 @@ assert index.exists() // MSKINS-130 check that html structure is as clean as possible String html = index.text // active menu -assert html.contains( '
  • About' ) +assert html.contains( '
  • About' ) // inactive menu -assert html.contains( '
  • Summary' ) -assert html.contains( '
  • Plugins
  • ' ) +assert html.contains( '
  • Summary' ) +assert html.contains( '
  • Plugins
  • ' ) // breadcrumb -assert html.contains( '
  • Apache/
  • ' ) +assert html.contains( '
  • Apache/
  • ' ) diff --git a/src/it/topbar/verify.groovy b/src/it/topbar/verify.groovy index 82704fd0..2e3dd0b6 100644 --- a/src/it/topbar/verify.groovy +++ b/src/it/topbar/verify.groovy @@ -23,9 +23,9 @@ assert index.exists() // MSKINS-130 check that html structure is as clean as possible String html = index.text // active menu -assert html.contains( '
  • About
  • ' ) +assert html.contains( '
  • About
  • ' ) // inactive menu -assert html.contains( '
  • Summary
  • ' ) -assert html.contains( '
  • Plugins
  • ' ) +assert html.contains( '
  • Summary
  • ' ) +assert html.contains( '
  • Plugins
  • ' ) // breadcrumb -assert html.contains( '
  • Apache/
  • ' ) +assert html.contains( '
  • Apache/
  • ' ) diff --git a/src/main/resources/META-INF/maven/site-macros.vm b/src/main/resources/META-INF/maven/site-macros.vm index 2f1a073b..98766264 100644 --- a/src/main/resources/META-INF/maven/site-macros.vm +++ b/src/main/resources/META-INF/maven/site-macros.vm @@ -15,31 +15,25 @@ ## specific language governing permissions and limitations ## under the License. ## -#macro ( topMenu $menus ) +#macro( topMenu $menus ) #**##foreach( $menu in $menus ) -#**##if ( $menu.name ) +#**##if( $menu.name )
  • #topLink( $currentItemHref $item.name $item.target )
  • +
  • #topLink( $item )
  • #**##end #end ## -#macro ( link $href $name $target $img $position $alt $border $width $height $icon ) -#**##set ( $linkTitle = ' title="' + $esc.xml( $name ) + '"' ) -#**##if( $target ) -#* *##set ( $linkTarget = ' target="' + $target + '"' ) +#macro( link $link $icon = false $omitImage = false $elemOnEmptyHref = "a" $dotSlashOnEmptyHref = false $imageClass = "imageLink" $elemClass = false ) +#**##if( $link.name ) +#* *##set( $name = $esc.xml( $link.name ) ) #**##else -#* *##set ( $linkTarget = "" ) -#**##end -#**##if ( $decoration.isLink( $href ) ) -#* *##set ( $linkClass = ' class="externalLink"' ) +#* *##set( $name = "" ) +#**##end +#**##if( $link.href || $dotSlashOnEmptyHref == "always" ) +#* *##set( $href = $link.href ) +#* *##if( !$site.isLink( $href ) ) +#* *##set( $href = $PathTool.calculateLink( $href, $relativePath ) ) +#* *##set( $href = $href.replaceAll( '\\', '/' ) ) +#* *##if( $href == "" && ( $dotSlashOnEmptyHref == "set" || $dotSlashOnEmptyHref == "always" ) ) +#* *##set( $href = "./" ) +#* *##end +#* *##set( $class = "" ) +#* *##else +#* *##set( $class = ' class="externalLink"' ) +#* *##end +#* *##if( $link.target ) +#* *##set( $target = ' target="' + $link.target + '"' ) +#* *##else +#* *##set( $target = "" ) +#* *##end +#* *##if( $alignedFileName == $href && $dotSlashOnEmptyHref != "always" ) +#* *##set( $href = "" ) +#* *##set( $target = "" ) +#* *##set( $class = "" ) +#* *##else +#* *##set( $href = ' href="' + $href + '"' ) +#* *##end #**##else -#* *##set ( $linkClass = "" ) +#* *##set( $href = "" ) +#* *##set( $target = "" ) +#* *##set( $class = "" ) #**##end -#**##if( $href ) -#* *##set ( $href = ' href="' + $href + '"' ) -#**##else -#* *##set ( $href = "" ) +## +#**##set( $wrap = $href || !$href && $elemOnEmptyHref ) +#**##set( $wrapElem = "a" ) +#**##if( !$href && $elemOnEmptyHref ) +#* *##set( $wrapElem = $elemOnEmptyHref ) +#**##end +#**##if( $elemClass ) +#* *##set( $class = ' class="' + $elemClass + '"' ) #**##end -#**##if ( $img ) -#* *##if ( $position == "left" ) -#* *##image( $img $alt $border $width $height )$name## +#**##if( $wrap )<$wrapElem#end$href$target$class#if( $wrap )>#end## +#**##if( $link.image && !$omitImage ) +#* *##set( $img = "#image( $link.image $imageClass )" ) +#* *##if( $link.image.position == "left" ) +#* *#$img#if( $name ) $name#end## #* *##else -#* *#$esc.xml( $name ) #image( $img $alt $border $width $height )## +#* *##if( $name )$name #end$img## #* *##end #**##else -#* *### #* *##if( $icon ) #* *### #* *##end -#* *#$esc.xml( $name )## +#* *#$name## +#**##end +#**##if( $wrap )## #**##end #end ## -#macro ( image $img $alt $border $width $height ) -#**##if( $img ) -#* *##if ( !$decoration.isLink( $img ) ) -#* *##set ( $imgSrc = $PathTool.calculateLink( $img, $relativePath ) ) -#* *##set ( $imgSrc = $imgSrc.replaceAll( '\\', '/' ) ) -#* *##set ( $imgSrc = ' src="' + $imgSrc + '"' ) +#macro( topLink $link ) +#**##link ( $link false true ) +#end +## +#macro( image $image $class ) +#* *##if( !$site.isLink( $image.src ) ) +#* *##set( $src = $PathTool.calculateLink( $image.src, $relativePath ) ) +#* *##set( $src = $src.replace( '\\', '/' ) ) +#* *##set( $src = ' src="' + $src + '"' ) #* *##else -#* *##set ( $imgSrc = ' src="' + $img + '"' ) +#* *##set( $src = ' src="' + $image.src + '"' ) #* *##end -#* *##if( $alt ) -#* *##set ( $imgAlt = ' alt="' + $esc.xml( $alt ) + '"' ) +#* *##if( $image.alt ) +#* *##set( $alt = ' alt="' + $esc.xml( $image.alt ) + '"' ) #* *##else -#* *##set ( $imgAlt = "" ) +#* *##set( $alt = "" ) #* *##end -#* *##if( $border ) -#* *##set ( $imgBorder = 'border: ' + $border + '; ' ) +#* *##if( $image.width ) +#* *##set( $width = 'width: ' + $image.width + ';' ) #* *##else -#* *##set ( $imgBorder = "" ) +#* *##set( $width = "" ) #* *##end -#* *##if( $width ) -#* *##set ( $imgWidth = 'width: ' + $width + '; ' ) +#* *##if( $image.height ) +#* *##set( $height = 'height: ' + $image.height + ';' ) #* *##else -#* *##set ( $imgWidth = "" ) +#* *##set( $height = "" ) #* *##end -#* *##if( $height ) -#* *##set ( $imgHeight = 'height: ' + $height + ';' ) +#* *##if( $image.style ) +#* *##set( $style = $image.style ) #* *##else -#* *##set ( $imgHeight = "" ) +#* *##set( $style = "" ) #* *##end -## -#**##end +#* *##set( $style = "$width$height$style" ) +## #end ## -#macro ( banner $banner $id ) -#**##if ( $banner ) -#* *##if( $banner.href ) -#* *##set ( $hrf = $banner.href ) -#* *##if ( !$decoration.isLink( $hrf ) ) -#* *##set ( $hrf = $PathTool.calculateLink( $hrf, $relativePath ) ) -#* *##set ( $hrf = $hrf.replaceAll( '\\', '/' ) ) -#* *##if ( ( $hrf == '' ) ) -#* *##set ( $hrf = './' ) -#* *##end -#* *##end -#* *### -#* *##else -#* *# -#* *##end +#macro( banner $banner $id ) +#**##if( $banner ) +#* *#

    #link( $banner false false false "set" )

    ## #**##end #end ## -#macro ( links $links ) -#**##if ( $links && $links.size() > 0 ) -#* *##set ( $counter = 0 ) +#macro( links $links ) +#**##if( $links && $links.size() > 0 ) +#* *##set( $counter = 0 ) #* *### MSKINS-41 -#* *##set ( $begin = $links.size() - 1 ) +#* *##set( $begin = $links.size() - 1 ) #* *##foreach( $index in [$begin..0] ) -#* *##set ( $item = $links.get( $index ) ) -#* *##set ( $counter = $counter + 1 ) -#* *##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) -#* *##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) +#* *##set( $item = $links.get( $index ) ) +#* *##set( $counter = $counter + 1 ) ##
  • ## -#* *##if ( $counter > 0 && $counter < $links.size() ) +#* *##if( $counter > 0 && $counter < $links.size() ) #* *#| #* *##end -#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false ) +#* *##link( $item ) #* *#
  • #* *##end #**##end #end ## -#macro ( breadcrumbs $breadcrumbs $cssClass ) -#**##set ( $breadcrumbDivider = $decoration.getCustomValue( 'fluidoSkin.breadcrumbDivider', '/' ) ) +#macro( breadcrumbs $breadcrumbs $cssClass ) +#**##set( $breadcrumbDivider = $site.getCustomValue( 'fluidoSkin.breadcrumbDivider', '/' ) ) #**##foreach( $item in $breadcrumbs ) -#* *##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) -#* *##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) -#* *##if ( ( $currentItemHref == '' ) ) -#* *##set ( $currentItemHref = './' ) -#* *##end -## -#* *##if( $cssClass ) -
  • ## -#* *##else -
  • ## -#end -#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false ) + ## +#* *##link( $item false false "a" "always" ) #* *#$breadcrumbDivider## #* *#
  • #**##end #**### add Edit button if content is editable -#**##if( $decoration.edit && $docRenderingContext.editable ) -#* *##set ( $edit = ' ' + $text.get( ' ) +#**##if( $site.edit && $docRenderingContext.editable ) +#* *##set( $edit = ' ' + $text.get( ' ) #**##end -#**##if ( $shortTitle ) -
  • $esc.xml( $shortTitle )$!edit
  • +#**##if( $shortTitle ) +
  • $esc.xml( $shortTitle )$!edit
  • #**##else #* TODO $title can be empty! *# -
  • $esc.xml( $title )$!edit
  • +
  • $esc.xml( $title )$!edit
  • #**##end #end ## -#macro ( displayTree $display $item ) -#**##if ( $item && $item.items && $item.items.size() > 0 ) -#* *##foreach( $subitem in $item.items ) -#* *##set ( $subitemHref = $PathTool.calculateLink( $subitem.href, $relativePath ) ) -#* *##set ( $subitemHref = $subitemHref.replaceAll( '\\', '/' ) ) +#macro( displayTree $item $display ) +#**##if( $item.items && $item.items.size() > 0 ) +#* *##foreach( $subItem in $item.items ) +#* *##set( $subItemHref = $PathTool.calculateLink( $subItem.href, $relativePath ) ) +#* *##set( $subItemHref = $subItemHref.replaceAll( '\\', '/' ) ) ## -#* *##if ( $alignedFileName == $subitemHref ) -#* *##set ( $display = true ) +#* *##if( $alignedFileName == $subItemHref ) +#* *##set( $display = true ) #* *##end ## -#* *##displayTree( $display $subitem ) +#* *##displayTree( $subItem $display ) #* *##end #**##end #end ## -#macro ( menuItem $item $indent ) -#**##set ( $collapseClass = "none" ) -#**##set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) -#**##set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) +#macro( menuItem $item $indent ) +#**##set( $collapseClass = false ) +#**##set( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) ) +#**##set( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) ## -#**##if ( $item && $item.items && $item.items.size() > 0 ) -#* *##if ( $item.collapse == false ) -#* *##set ( $collapseClass = "icon-chevron-down" ) +#**##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" ) +#* *##set( $collapseClass = "icon-chevron-right" ) #* *##end ## -#* *##set ( $display = false ) -#* *##displayTree( $display $item ) +#* *##set( $display = false ) +#* *##displayTree( $item $display ) ## -#* *##if ( $alignedFileName == $currentItemHref || $display ) -#* *##set ( $collapseClass = "icon-chevron-down" ) +#* *##if( $alignedFileName == $currentItemHref || $display ) +#* *##set( $collapseClass = "icon-chevron-down" ) #* *##end #**##end ## -#**##if ( $alignedFileName == $currentItemHref ) +#**##if( $alignedFileName == $currentItemHref ) $indent
  • ## #**##else $indent
  • ## #**##end ## -#**##if ( $item.img ) -#* *##if ( $item.position == "left" ) -#* *##if ( $alignedFileName == $currentItemHref ) -#* *##image( $item.img $item.alt $item.border $item.width $item.height ) $esc.xml( $item.name )## -#* *##else -#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false ) -#* *##end -#* *##else -#* *##if ( $alignedFileName == $currentItemHref ) -#* *#$esc.xml( $item.name ) #image( $item.img $item.alt $item.border $item.width $item.height )## -#* *##else -#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height false ) -#* *##end -#* *##end -#**##else -#* *##if ( $alignedFileName == $currentItemHref ) -#* *#$esc.xml( $item.name )## -#* *##else -#* *##link( $currentItemHref $item.name $item.target $item.img $item.position $item.alt $item.border $item.width $item.height $collapseClass ) -#* *##end -#**##end -#**##if ( $item && $item.items && $item.items.size() > 0 ) -#* *##if ( $collapseClass == "icon-chevron-down" ) +#**##link( $item $collapseClass ) +#**##if( $item.items && $item.items.size() > 0 ) +#* *##if( $collapseClass == "icon-chevron-down" ) $indent ## #* *##end @@ -324,60 +247,13 @@ $indent ## #**#
  • #end ## -#macro ( mainMenu $menus ) +#macro( mainMenu $menus ) ## #end ## -#macro ( copyright ) -#**##if ( $project ) -#* *##set ( $currentYear = ${date.year} ) +#macro( copyright ) +#**##if( $project ) +#* *##set( $currentYear = ${date.year} ) ## -#* *##if ( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) ) +#* *##if( ${project.inceptionYear} && ( ${project.inceptionYear} != ${currentYear.toString()} ) ) ${project.inceptionYear}$esc.unicode( '\u2013' )${currentYear} #* *##else ${currentYear} #* *##end ## -#* *##if ( ${project.organization} ) -#* *##if ( ${project.organization.name} && ${project.organization.url} ) +#* *##if( ${project.organization} ) +#* *##if( ${project.organization.name} && ${project.organization.url} ) #* *#$esc.xml( ${project.organization.name} ) -#* *##elseif ( ${project.organization.name} ) +#* *##elseif( ${project.organization.name} ) #* *#$esc.xml( ${project.organization.name} ) #* *##end #* *##end #**##end #end ## -#macro ( publishDate $position $decorationPublishDate $version ) -#**##if ( $publishDate ) -#* *##set ( $dateValue = $date.format( $publishDate ) ) +#macro( publishDate $position $sitePublishDate $version ) +#**##if( $publishDate ) +#* *##set( $dateValue = $date.format( $publishDate ) ) #**##else -#* *##set ( $dateValue = $date ) +#* *##set( $dateValue = $date ) #**##end ## -#**##set ( $datePosition = $decorationPublishDate.position ) -#**##set ( $versionPosition = $version.position ) +#**##set( $datePosition = $sitePublishDate.position ) +#**##set( $versionPosition = $version.position ) ## -#**##set ( $breadcrumbs = $decoration.body.breadcrumbs ) -#**##set ( $links = $decoration.body.links ) +#**##set( $breadcrumbs = $site.body.breadcrumbs ) +#**##set( $links = $site.body.links ) ## -#**##if ( $datePosition.equalsIgnoreCase( "right" ) && ( $versionPosition.equalsIgnoreCase( "right" ) || !$topBarEnabled - && $decoration.body.links - && $decoration.body.links.size() > 0 ) ) -#* *##set ( $prefix = '| ' ) +#**##if( $datePosition.equalsIgnoreCase( "right" ) && ( $versionPosition.equalsIgnoreCase( "right" ) || !$topBarEnabled + && $site.body.links + && $site.body.links.size() > 0 ) ) +#* *##set( $prefix = '| ' ) #**##else -#* *##set ( $prefix = "" ) +#* *##set( $prefix = "" ) #**##end ## -#**##if ( $datePosition.equalsIgnoreCase( $position ) ) -#* *##if ( ( $datePosition.equalsIgnoreCase( "right" ) ) || ( $datePosition.equalsIgnoreCase( "bottom" ) ) ) +#**##if( $datePosition.equalsIgnoreCase( $position ) ) +#* *##if( $datePosition.equalsIgnoreCase( "right" ) || $datePosition.equalsIgnoreCase( "bottom" ) ) +## FIXME In some languages like French a space must preceed the colon
  • $prefix$text.get( "template.lastpublished" ): $dateValue
  • -#* *##if ( $versionPosition.equalsIgnoreCase( $position ) ) +#* *##if( $versionPosition.equalsIgnoreCase( $position ) )
  • ## -#* *##if ( !$topBarEnabled - && $decoration.body.links - && $decoration.body.links.size() > 0 ) +#* *##if( !$topBarEnabled + && $site.body.links + && $site.body.links.size() > 0 ) #* *#|## #* *##end +## FIXME In some languages like French a space must preceed the colon #* *#$text.get( "template.version" ): ${project.version}## #* *#
  • #* *##end -#* *##elseif ( ( $datePosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $datePosition.equalsIgnoreCase( "navigation-top" ) ) ) +#* *##elseif( $datePosition.equalsIgnoreCase( "navigation-bottom" ) || $datePosition.equalsIgnoreCase( "navigation-top" ) )
    +## FIXME In some languages like French a space must preceed the colon $text.get( "template.lastpublished" ): $dateValue -#* *##if ( $versionPosition.equalsIgnoreCase( $position ) ) +#* *##if( $versionPosition.equalsIgnoreCase( $position ) ) +## FIXME In some languages like French a space must preceed the colon | $text.get( "template.version" ): ${project.version} #* *##end
    -#* *##elseif ( $datePosition.equalsIgnoreCase("left") ) +#* *##elseif( $datePosition.equalsIgnoreCase("left") ) +## FIXME In some languages like French a space must preceed the colon
  • $text.get( "template.lastpublished" ): $dateValue## -#* *##if ( $versionPosition.equalsIgnoreCase( $position ) || $breadcrumbs && $breadcrumbs.size() > 0 ) +#* *##if( $versionPosition.equalsIgnoreCase( $position ) || $breadcrumbs && $breadcrumbs.size() > 0 ) #* *#| #* *##end #* *#
  • -#* *##if ( $versionPosition.equalsIgnoreCase( $position ) ) +#* *##if( $versionPosition.equalsIgnoreCase( $position ) ) +## FIXME In some languages like French a space must preceed the colon
  • $text.get( "template.version" ): ${project.version}## -#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) +#* *##if( $breadcrumbs && $breadcrumbs.size() > 0 ) #* *#|## #* *##end #* *#
  • #* *##end -#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) +#* *##if( $breadcrumbs && $breadcrumbs.size() > 0 ) #* *##breadcrumbs( $breadcrumbs "" ) #* *##end #* *##end -#**##elseif ( $versionPosition.equalsIgnoreCase( $position ) ) -#* *##if ( $versionPosition.equalsIgnoreCase( "right" ) ) +#**##elseif( $versionPosition.equalsIgnoreCase( $position ) ) +#* *##if( $versionPosition.equalsIgnoreCase( "right" ) ) +## FIXME In some languages like French a space must preceed the colon
  • $prefix$text.get( "template.version" ): ${project.version}
  • -#* *##elseif ( $versionPosition.equalsIgnoreCase( "bottom" ) ) +#* *##elseif( $versionPosition.equalsIgnoreCase( "bottom" ) ) +## FIXME In some languages like French a space must preceed the colon $text.get( "template.version" ): ${project.version} -#* *##elseif ( ( $versionPosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $versionPosition.equalsIgnoreCase( "navigation-top" ) ) ) +#* *##elseif( $versionPosition.equalsIgnoreCase( "navigation-bottom" ) || $versionPosition.equalsIgnoreCase( "navigation-top" ) )
    +## FIXME In some languages like French a space must preceed the colon $text.get( "template.version" ): ${project.version}
    -#* *##elseif ( $versionPosition.equalsIgnoreCase("left") ) +#* *##elseif( $versionPosition.equalsIgnoreCase("left") ) +## FIXME In some languages like French a space must preceed the colon
  • $text.get( "template.version" ): ${project.version}## -#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) +#* *##if( $breadcrumbs && $breadcrumbs.size() > 0 ) #* *#|## #* *##end #* *#
  • -#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) +#* *##if( $breadcrumbs && $breadcrumbs.size() > 0 ) #* *##breadcrumbs( $breadcrumbs "") #* *##end #* *##end -#**##elseif ( $position.equalsIgnoreCase( "left" ) ) -#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 ) +#**##elseif( $position.equalsIgnoreCase( "left" ) ) +#* *##if( $breadcrumbs && $breadcrumbs.size() > 0 ) #* *##breadcrumbs( $breadcrumbs "" ) #* *##end #**##end #end ## -#macro ( builtByLogo $poweredBy ) +#macro( builtByLogo $poweredBy ) #**##if( $poweredBy ) -#**##foreach ( $item in $poweredBy ) -#* *##if( $item.href ) -#* *##set ( $href = $PathTool.calculateLink( $item.href, $relativePath ) ) -#* *##set ( $href = $href.replaceAll( '\\', '/' ) ) -#* *##else -#* *##set ( $href="https://maven.apache.org/" ) -#* *##end -## -#* *##if( $item.name ) -#* *##set ( $name = $item.name ) -#* *##else -#* *##set ( $name = $text.get( "template.builtby" ) ) -#* *##set ( $name = "${name} Maven" ) -#* *##end -## -#* *##if( $item.img ) -#* *##set ( $img = $item.img ) -#* *##else -#* *##set ( $img = "images/logos/maven-feather.png" ) -#* *##end -## -#* *##if ( !$decoration.isLink( $img ) ) -#* *##set ( $img = $PathTool.calculateLink( $img, $relativePath ) ) -#* *##set ( $img = $img.replaceAll( '\\', '/' ) ) -#* *##end -## -#* *##if( $item.alt ) -#* *##set ( $alt = ' alt="' + $esc.xml( $item.alt ) + '"' ) -#* *##else -#* *##set ( $alt = ' alt="' + $esc.xml( $name ) + '"' ) -#* *##end -## -#* *##if( $item.border ) -#* *##set ( $border = 'border: ' + $item.border + '; ' ) -#* *##else -#* *##set ( $border = "" ) -#* *##end -## -#* *##if( $item.width ) -#* *##set ( $width = 'width: ' + $item.width + '; ' ) -#* *##else -#* *##set ( $width = "" ) -#* *##end -#* *##if( $item.height ) -#* *##set ( $height = 'height: ' + $item.height + ';' ) -#* *##else -#* *##set ( $height = "" ) -#* *##end -## -#* *### -#* *### -#* *# -#**##end -#**##if( $poweredBy.isEmpty() ) -#* *### -#* *#$text.get( ## -#* *# +#**##foreach( $item in $poweredBy ) +#* *##link( $item false false "span" false "builtBy" "builtBy" ) + #**##end #**##else -#**### +#**### #* *#$text.get( ## #**# #**##end #end ## -#macro ( googleAnalytics ) -#set ( $accountId = $decoration.getCustomValue( 'fluidoSkin.googleAnalytics.accountId' ) ) -#**##if( $accountId && $accountId != "" ) +#macro( googleAnalytics ) +#set( $accountId = $site.getCustomValue( 'fluidoSkin.googleAnalytics.accountId' ) ) +#**##if( $accountId && $accountId.length() > 0 ) #**##end #end -#macro ( matomo ) -#**##if ( $decoration.getCustomValue( 'matomo.url' ) && $decoration.getCustomValue( 'matomo.url' ) != '' -&& $decoration.getCustomValue( 'matomo.siteId' ) && $decoration.getCustomValue( 'matomo.siteId' ) != '') - +#macro( matomo ) +#**##if( $site.getCustomValue( 'matomo.url' ) && $site.getCustomValue( 'matomo.url' ).length() > 0 + && $site.getCustomValue( 'matomo.siteId' ) && $site.getCustomValue( 'matomo.siteId' ).length() > 0 ) + #**##end #end ## -#macro ( facebookLike $sideBarEnabled ) -#**##if ( $decoration.getCustomChild( 'fluidoSkin.facebookLike' ) && $project.url ) +#macro( facebookLike $sideBarEnabled ) +#**##if( $site.getCustomChild( 'fluidoSkin.facebookLike' ) && $project.url ) ## -#* *##set( $layout = 'box_count' ) +#* *##set( $layout = "box_count" ) #* *##if( !$sideBarEnabled ) -#* *##set( $layout = 'button_count' ) +#* *##set( $layout = "button_count" ) #* *##end -#* *##set( $layout = $decoration.getCustomValue( 'fluidoSkin.facebookLike.layout', $layout ) ) +#* *##set( $layout = $site.getCustomValue( 'fluidoSkin.facebookLike.layout', $layout ) ) ## -#* *##set( $action = 'like' ) -#* *##if ( $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.facebookLike.recommend', 'false' ) ) ) -#* *##set( $action = 'recommend' ) +#* *##set( $action = "like" ) +#* *##if( $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.facebookLike.recommend', 'false' ) ) ) +#* *##set( $action = "recommend" ) #* *##end ## -#* *##set( $shareButton = $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.facebookLike.shareButton', 'false' ) ) ) +#* *##set( $shareButton = $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.facebookLike.shareButton', 'false' ) ) ) ##
    #**##end #end ## -#macro ( followTwitter $sideBarEnabled ) -#**##if ( $decoration.getCustomChild( 'fluidoSkin.twitter.user' ) ) -#* *##set( $user = $decoration.getCustomValue( 'fluidoSkin.twitter.user' ) ) -#* *##set( $showUser = $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.twitter.showUser', 'false' ) ) ) -#* *##set( $showFollowers = $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.twitter.showFollowers', 'false' ) ) ) +#macro( followTwitter $sideBarEnabled ) +#**##if( $site.getCustomChild( 'fluidoSkin.twitter.user' ) ) +#* *##set( $user = $site.getCustomValue( 'fluidoSkin.twitter.user' ) ) +#* *##set( $showUser = $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.twitter.showUser', 'false' ) ) ) +#* *##set( $showFollowers = $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.twitter.showFollowers', 'false' ) ) ) ## -#* *##if ( $sideBarEnabled ) +#* *##if( $sideBarEnabled ) #* *##set( $dataSize = "medium" ) #* *##set( $dataAlign = "left" )
    @@ -711,10 +542,10 @@ $indent ##
    #* *##else @@ -722,33 +553,32 @@ $indent ## #**##end #end ## -#macro ( flattrHead ) -#**##if ( $decoration.getCustomChild( 'fluidoSkin.flattr.thing' ) - && ( $decoration.getCustomChild( 'fluidoSkin.flattr.url' ) || $project.url ) ) +#macro( flattrHead ) +#**##if( $site.getCustomChild( 'fluidoSkin.flattr.thing' ) + && ( $site.getCustomChild( 'fluidoSkin.flattr.url' ) || $project.url ) ) + #**##end #end ## -#macro ( flattrBody $sideBarEnabled ) -#**##if ( $decoration.getCustomChild( 'fluidoSkin.flattr.thing' ) - && ( $decoration.getCustomChild( 'fluidoSkin.flattr.url' ) || $project.url ) ) -#* *##set ( $flattrThing = $decoration.getCustomValue( 'fluidoSkin.flattr.thing' ) ) -#* *##set ( $flattrUrl = $decoration.getCustomValue( 'fluidoSkin.flattr.url', $project.url ) ) +#macro( flattrBody $sideBarEnabled ) +#**##if( $site.getCustomChild( 'fluidoSkin.flattr.thing' ) + && ( $site.getCustomChild( 'fluidoSkin.flattr.url' ) || $project.url ) ) +#* *##set( $flattrThing = $site.getCustomValue( 'fluidoSkin.flattr.thing' ) ) +#* *##set( $flattrUrl = $site.getCustomValue( 'fluidoSkin.flattr.url', $project.url ) ) ## -#* *##set ( $styleModifier = '' ) -#* *##if ( $decoration.getCustomValue( 'fluidoSkin.flattr.style', '' ).equalsIgnoreCase( 'compact' ) ) -#* *##set ( $styleModifier = 'rev="flattr;button:compact;"' ) +#* *##set( $styleModifier = "" ) +#* *##if( $site.getCustomValue( 'fluidoSkin.flattr.style', '' ).equalsIgnoreCase( 'compact' ) ) +#* *##set( $styleModifier = 'rev="flattr;button:compact;"' ) #* *##end ## -#* *##if ( $sideBarEnabled ) +#* *##if( $sideBarEnabled )
    #* *##else ## ## + Flattr this ## -#* *##if ( $sideBarEnabled ) +#* *##if( $sideBarEnabled )
    #* *##else diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm index f964a491..aef0d4a8 100644 --- a/src/main/resources/META-INF/maven/site.vm +++ b/src/main/resources/META-INF/maven/site.vm @@ -17,14 +17,14 @@ ## under the License. ## #parse( "site-macros.vm" ) -#set ( $skipGenerationDate = $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.skipGenerationDate', 'false' ) ) ) +#set( $skipGenerationDate = $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.skipGenerationDate', 'false' ) ) ) @@ -38,7 +38,7 @@ #foreach( $author in $authors ) #end -#if ( $documentDate ) +#if( $documentDate ) #end $esc.xml( $title ) @@ -47,8 +47,8 @@ #**##prjProfile() -#**##if( $decoration.body.head ) -#* *#$render.eval( $decoration.body.head ) +#**##if( $site.body.head ) +#* *#$render.eval( $site.body.head ) #**##end #**##if( $headContent )$headContent#end #**##googleAnalytics() @@ -56,8 +56,8 @@ #**##flattrHead() #**##forkMeOnGitHubHead() -#**##set ( $topBarEnabled = $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.topBarEnabled', 'false' ) ) && ! $standalone ) -#**##if ( $topBarEnabled ) +#**##set( $topBarEnabled = $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.topBarEnabled', 'false' ) ) && !$standalone ) +#**##if( $topBarEnabled ) #**##else @@ -65,15 +65,15 @@ #**##forkMeOnGitHub() #**##facebookLoadSDK() ## -#**##set ( $sideBarEnabled = $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.sideBarEnabled', 'true' ) ) && ! $standalone ) -#**##set ( $searchEnabled = $decoration.getCustomChild( 'fluidoSkin.googleSearch' ) - && ( $decoration.getCustomValue( 'fluidoSkin.googleSearch.sitesearch' ) || $project.url ) ) +#**##set( $sideBarEnabled = $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.sideBarEnabled', 'true' ) ) && !$standalone ) +#**##set( $searchEnabled = $site.getCustomChild( 'fluidoSkin.googleSearch' ) + && ( $site.getCustomValue( 'fluidoSkin.googleSearch.sitesearch' ) || $project.url ) ) ## -#**##if ( $topBarEnabled ) -#* *##set ( $navBarStyle = $decoration.getCustomValue( 'fluidoSkin.navBarStyle', '' ) ) +#**##if( $topBarEnabled ) +#* *##set( $navBarStyle = $site.getCustomValue( 'fluidoSkin.navBarStyle', '' ) ) #**##end ## -#**##if ( $sideBarEnabled ) +#**##if( $sideBarEnabled )
    #**##else
    #**##end
    -#* *##set ( $publishDateLeftContent = "#publishDate( 'left' $decoration.publishDate $decoration.version )" ) -#* *##set ( $publishDateRightContent = "#publishDate( 'right' $decoration.publishDate $decoration.version )" ) +#* *##set( $publishDateLeftContent = "#publishDate( 'left' $site.publishDate $site.version )" ) +#* *##set( $publishDateRightContent = "#publishDate( 'right' $site.publishDate $site.version )" ) #* *### MSITE-44 -#* *##if ( !$topBarEnabled ) -#* *##set ( $linksContent = "#links( $decoration.body.links )" ) +#* *##if( !$topBarEnabled ) +#* *##set( $linksContent = "#links( $site.body.links )" ) #* *##end -#* *##if ( $publishDateLeftContent.length() > 0 || $publishDateRightContent.length() > 0 || - ( $linksContent && $linksContent.length() > 0 ) ) +#* *##if( $publishDateLeftContent.length() > 0 || $publishDateRightContent.length() > 0 || + ( $linksContent && $linksContent.length() > 0 ) )
    ## -#* *##if ( $sideBarEnabled ) -#* *##set ( $leftColumnClass = $decoration.getCustomValue( 'fluidoSkin.leftColumnClass', 'span2' ) ) +#* *##if( $sideBarEnabled ) +#* *##set( $leftColumnClass = $site.getCustomValue( 'fluidoSkin.leftColumnClass', 'span2' ) ) ##
    #* *##end ## -#* *##set ( $bodyColumnClass = $decoration.getCustomValue( 'fluidoSkin.bodyColumnClass', 'span10' ) ) +#* *##set( $bodyColumnClass = $site.getCustomValue( 'fluidoSkin.bodyColumnClass', 'span10' ) ) ## -
    -#* *##if ( $convert.toBoolean( $decoration.getCustomValue( 'fluidoSkin.sourceLineNumbersEnabled', 'false' ) ) ) -#* *##set ( $sourceStyle = "prettyprint linenums" ) +
    +#* *##if( $convert.toBoolean( $site.getCustomValue( 'fluidoSkin.sourceLineNumbersEnabled', 'false' ) ) ) +#* *##set( $sourceStyle = "prettyprint linenums" ) #* *##else -#* *##set ( $sourceStyle = "prettyprint" ) +#* *##set( $sourceStyle = "prettyprint" ) #* *##end ## -#* *#$bodyContent.replaceAll( "
    (\r?\n)?
    ", "
    " ).replaceAll( "class=${esc.q}bodyTable${esc.q}", "class=${esc.q}table table-striped${esc.q}" ).replaceAll( "class=${esc.q}bodyTable bodyTableBorder${esc.q}", "class=${esc.q}table table-bordered table-striped${esc.q}" )
    +#*      *#$bodyContent.replaceAll( '
    (\r?\n)?
    ', '
    ' ).replaceAll( 'class="bodyTable"', 'class="table table-striped"' ).replaceAll( 'class="bodyTable bodyTableBorder"', 'class="table table-bordered table-striped"' )
             
    -#* *##if ( $sideBarEnabled ) +#* *##if( $sideBarEnabled )
    #* *##end