This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
commit f995acbecbacd70c149da86ec10250d8105a67f6 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Sat Oct 31 19:55:09 2026 +0000 Make the resource conditions render true and link the packaged ribbon stylesheet A condition is copied only when it renders "true"; the plain expressions never did, and ${anchorjs.version} is not filtered in skin.xml. The ribbon stylesheet is packaged as gh-fork-ribbon.min.css and is now linked only when a GitHub project is configured. --- src/it/mskins-16/verify.groovy | 8 ++++++++ src/it/{mskins-16 => mskins-22}/verify.groovy | 10 +++++----- src/it/mskins-226-anchorjs-options/verify.groovy | 4 ++++ src/it/{mskins-16 => mskins-23}/verify.groovy | 12 +++++++----- src/main/resources/META-INF/maven/site-macros.vm | 5 +++-- src/main/resources/META-INF/maven/skin.xml | 13 +++++++------ 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/it/mskins-16/verify.groovy b/src/it/mskins-16/verify.groovy index 2f25c0b..557eb33 100644 --- a/src/it/mskins-16/verify.groovy +++ b/src/it/mskins-16/verify.groovy @@ -22,3 +22,11 @@ String html = new File( basedir, "target/site/index.html" ).text // no search, social buttons or poweredBy configured: only the menu box, no empty one below it assert ( html =~ /class="well sidebar-nav"/ ).size() == 1 assert !html.contains( 'id="poweredBy"' ) + +// no GitHub ribbon and no profile configured: their resources are neither linked nor copied +File site = new File( basedir, "target/site" ) +assert !html.contains( 'gh-fork-ribbon' ) +assert !new File( site, "css/gh-fork-ribbon.min.css" ).exists() +for ( String profile : [ 'pre-release', 'retired', 'sandbox' ] ) { + assert !new File( site, "images/profiles/${profile}.png" ).exists() +} diff --git a/src/it/mskins-16/verify.groovy b/src/it/mskins-22/verify.groovy similarity index 70% copy from src/it/mskins-16/verify.groovy copy to src/it/mskins-22/verify.groovy index 2f25c0b..89c99ed 100644 --- a/src/it/mskins-16/verify.groovy +++ b/src/it/mskins-22/verify.groovy @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ +File site = new File( basedir, "target/site" ) +String html = new File( site, "index.html" ).text -String html = new File( basedir, "target/site/index.html" ).text - -// no search, social buttons or poweredBy configured: only the menu box, no empty one below it -assert ( html =~ /class="well sidebar-nav"/ ).size() == 1 -assert !html.contains( 'id="poweredBy"' ) +// the ribbon stylesheet is linked and copied because a GitHub project is configured +assert html.contains( '<link rel="stylesheet" href="./css/gh-fork-ribbon.min.css" />' ) +assert new File( site, "css/gh-fork-ribbon.min.css" ).exists() diff --git a/src/it/mskins-226-anchorjs-options/verify.groovy b/src/it/mskins-226-anchorjs-options/verify.groovy index a7ea7a7..e97e7a6 100644 --- a/src/it/mskins-226-anchorjs-options/verify.groovy +++ b/src/it/mskins-226-anchorjs-options/verify.groovy @@ -22,3 +22,7 @@ assert index.exists() assert index.text.contains( 'anchors.add("h1, h2, h3, h4, h5")') assert index.text.contains( 'anchors.options.class = ".anchor"') assert index.text.contains( 'anchors.options.titleText = "foo"') + +// anchor.js is linked and copied because anchorJs is configured +assert index.text.contains( '<script src="./js/anchor-' ) +assert new File( basedir, "target/site/js" ).list().any { it ==~ /anchor-.*\.min\.js/ } diff --git a/src/it/mskins-16/verify.groovy b/src/it/mskins-23/verify.groovy similarity index 66% copy from src/it/mskins-16/verify.groovy copy to src/it/mskins-23/verify.groovy index 2f25c0b..e5341dc 100644 --- a/src/it/mskins-16/verify.groovy +++ b/src/it/mskins-23/verify.groovy @@ -16,9 +16,11 @@ * specific language governing permissions and limitations * under the License. */ +File site = new File( basedir, "target/site" ) +String html = new File( site, "index.html" ).text -String html = new File( basedir, "target/site/index.html" ).text - -// no search, social buttons or poweredBy configured: only the menu box, no empty one below it -assert ( html =~ /class="well sidebar-nav"/ ).size() == 1 -assert !html.contains( 'id="poweredBy"' ) +// only the image of the configured profile is copied +assert html.contains( "url('./images/profiles/retired.png')" ) +assert new File( site, "images/profiles/retired.png" ).exists() +assert !new File( site, "images/profiles/sandbox.png" ).exists() +assert !new File( site, "images/profiles/pre-release.png" ).exists() diff --git a/src/main/resources/META-INF/maven/site-macros.vm b/src/main/resources/META-INF/maven/site-macros.vm index 4d870c7..1197c7c 100644 --- a/src/main/resources/META-INF/maven/site-macros.vm +++ b/src/main/resources/META-INF/maven/site-macros.vm @@ -453,8 +453,8 @@ $indent </ul>## #end ## #macro( forkMeOnGitHubHead ) -## - <link rel="stylesheet" href="$relativePath/css/gh-fork-ribbon.css" /> +#**##if( $site.getCustomChild( 'fluidoSkin.gitHub.projectId' ) ) + <link rel="stylesheet" href="$relativePath/css/gh-fork-ribbon.min.css" /> #* *##set( $ribbonColor = "red" ) #* *##set( $definedRibbonColor = $site.getCustomChild( 'fluidoSkin.gitHub.ribbonColor' ) ) ## @@ -466,6 +466,7 @@ $indent </ul>## #* *##set( $ribbonColor = $definedRibbonColor.getValue().toLowerCase() ) <style>.github-fork-ribbon:before { background-color: $ribbonColor; }</style> #* *##end +#**##end #end ## #macro( forkMeOnGitHub ) diff --git a/src/main/resources/META-INF/maven/skin.xml b/src/main/resources/META-INF/maven/skin.xml index 7be53fb..76dd38c 100644 --- a/src/main/resources/META-INF/maven/skin.xml +++ b/src/main/resources/META-INF/maven/skin.xml @@ -24,26 +24,27 @@ under the License. <prerequisites> <doxia-sitetools>2.1.0</doxia-sitetools> </prerequisites> + <!-- each condition must render "true" for the resource to be copied --> <resource-conditions> <resource-condition> - <resource-name>js/anchor-${anchorjs.version}.min.js</resource-name> - <vtl-condition>custom.fluidoSkin.anchorJs</vtl-condition> + <resource-name>js/[email protected][email protected]</resource-name> + <vtl-condition><![CDATA[#if( $site.getCustomChild( 'fluidoSkin.anchorJs' ) )true#end]]></vtl-condition> </resource-condition> <resource-condition> <resource-name>css/gh-fork-ribbon.min.css</resource-name> - <vtl-condition>custom.fluidoSkin.gitHub</vtl-condition> + <vtl-condition><![CDATA[#if( $site.getCustomChild( 'fluidoSkin.gitHub.projectId' ) )true#end]]></vtl-condition> </resource-condition> <resource-condition> <resource-name>images/profiles/pre-release.png</resource-name> - <vtl-condition>custom.fluidoSkin.profile == 'pre-release'</vtl-condition> + <vtl-condition><![CDATA[#if( $site.getCustomValue( 'fluidoSkin.profile', '' ).equalsIgnoreCase( 'pre-release' ) )true#end]]></vtl-condition> </resource-condition> <resource-condition> <resource-name>images/profiles/retired.png</resource-name> - <vtl-condition>custom.fluidoSkin.profile == 'retired'</vtl-condition> + <vtl-condition><![CDATA[#if( $site.getCustomValue( 'fluidoSkin.profile', '' ).equalsIgnoreCase( 'retired' ) )true#end]]></vtl-condition> </resource-condition> <resource-condition> <resource-name>images/profiles/sandbox.png</resource-name> - <vtl-condition>custom.fluidoSkin.profile == 'sandbox'</vtl-condition> + <vtl-condition><![CDATA[#if( $site.getCustomValue( 'fluidoSkin.profile', '' ).equalsIgnoreCase( 'sandbox' ) )true#end]]></vtl-condition> </resource-condition> </resource-conditions> </skin>
