You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/02/19 14:50:38 UTC

[maven-doxia-sitetools] branch DOXIASITETOOLS-291 updated (0e969a2 -> 8969176)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch DOXIASITETOOLS-291
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git


    omit 0e969a2  [DOXIASITETOOLS-291] Add timezone field to site descriptor PublishDate object and pass onto Velocity tools context
     new 8969176  [DOXIASITETOOLS-291] Add timezone field to site descriptor PublishDate object and pass onto Velocity tools context

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (0e969a2)
            \
             N -- N -- N   refs/heads/DOXIASITETOOLS-291 (8969176)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


[maven-doxia-sitetools] 01/01: [DOXIASITETOOLS-291] Add timezone field to site descriptor PublishDate object and pass onto Velocity tools context

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch DOXIASITETOOLS-291
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git

commit 89691765b5a14990db3a32a16af13cdbffa629ba
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Feb 5 00:52:03 2023 +0100

    [DOXIASITETOOLS-291] Add timezone field to site descriptor PublishDate object and pass onto Velocity tools context
    
    This closes #86
---
 doxia-decoration-model/src/main/mdo/decoration.mdo          | 13 +++++++++++++
 .../maven/doxia/siterenderer/DefaultSiteRenderer.java       |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/doxia-decoration-model/src/main/mdo/decoration.mdo b/doxia-decoration-model/src/main/mdo/decoration.mdo
index 76e8c76..a741178 100644
--- a/doxia-decoration-model/src/main/mdo/decoration.mdo
+++ b/doxia-decoration-model/src/main/mdo/decoration.mdo
@@ -394,6 +394,19 @@ under the License.
           <identifier>true</identifier>
           <defaultValue>yyyy-MM-dd</defaultValue>
         </field>
+        <field xml.attribute="true">
+          <name>timezone</name>
+          <description>
+            <![CDATA[
+              The timezone to use. Use <code>system</code> for the default locale for this instance
+              of the Java Virtual Machine. Refer to <code>java.util.TimeZone</code> for details.
+            ]]>
+          </description>
+          <version>2.0.0+</version>
+          <type>String</type>
+          <identifier>true</identifier>
+          <defaultValue>Etc/UTC</defaultValue>
+        </field>
       </fields>
     </class>
 
diff --git a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
index f41d085..6bfd026 100644
--- a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
+++ b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java
@@ -46,6 +46,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
+import java.util.TimeZone;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
@@ -434,6 +435,10 @@ public class DefaultSiteRenderer implements Renderer {
         Locale locale = siteRenderingContext.getLocale();
         String dateFormat =
                 siteRenderingContext.getDecoration().getPublishDate().getFormat();
+        String timeZoneId =
+                siteRenderingContext.getDecoration().getPublishDate().getTimezone();
+        TimeZone timeZone =
+                "system".equalsIgnoreCase(timeZoneId) ? TimeZone.getDefault() : TimeZone.getTimeZone(timeZoneId);
 
         EasyFactoryConfiguration config = new EasyFactoryConfiguration(false);
         config.property("safeMode", Boolean.FALSE);
@@ -448,6 +453,7 @@ public class DefaultSiteRenderer implements Renderer {
                 .tool(ClassTool.class)
                 .tool(ComparisonDateTool.class)
                 .property("format", dateFormat)
+                .property("timezone", timeZone)
                 .tool(ConversionTool.class)
                 .property("dateFormat", dateFormat)
                 .tool(DisplayTool.class)