kwin commented on code in PR #610:
URL: 
https://github.com/apache/maven-doxia-sitetools/pull/610#discussion_r2793445067


##########
doxia-skin-model/src/main/mdo/skin.mdo:
##########
@@ -97,5 +107,32 @@ under the License.
         </field>
       </fields>
     </class>
+    <class java.clone="deep">
+      <name>ResourceCondition</name>
+      <version>2.1.0+</version>
+      <description>Describes the condition for including a specific Skin 
resource.</description>
+      <fields>
+        <field xml.tagName="resource-name">
+          <name>resourceName</name>
+          <version>2.1.0+</version>
+          <type>String</type>
+          <description><![CDATA[
+            The name of the resource to which this condition applies. Refers 
to the path within the JAR (i.e. must always use "/" as separator and must not 
start with a slash).
+            ]]>
+          </description>
+          <required>true</required>

Review Comment:
   Done in 
https://github.com/apache/maven-doxia-sitetools/pull/610/commits/e8ec7e0b1a887e096328fae9b1fd278fff9795e2.



##########
doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java:
##########
@@ -862,6 +870,37 @@ public void copyResources(SiteRenderingContext 
siteRenderingContext, File output
         }
     }
 
+    private boolean isResourceRelevant(String name, Context velocityContext, 
Map<String, String> resourceConditions) {
+        if (resourceConditions == null || 
!resourceConditions.containsKey(name)) {
+            LOGGER.debug("No condition for resource: " + name);
+        } else {
+            String condition = resourceConditions.get(name);
+            LOGGER.debug("Evaluating condition for resource: " + name + " with 
condition: " + condition);
+            StringWriter writer = new StringWriter();
+            Velocity.evaluate(velocityContext, writer, 
"conditional-resource-evaluation", condition);
+            String result = writer.toString().trim();
+            LOGGER.debug("Condition evaluation result: " + result);
+            if (!Boolean.parseBoolean(result)) {
+                LOGGER.debug("Excluding resource: " + name);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private Map<String, String> createResourceConditionsMap(SkinModel 
skinModel) {
+        Map<String, String> resourceConditions = new HashMap<>();
+        if (skinModel != null && skinModel.getResourceConditions() != null) {

Review Comment:
   Done in 
https://github.com/apache/maven-doxia-sitetools/pull/610/commits/e8ec7e0b1a887e096328fae9b1fd278fff9795e2.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to