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/04 23:53:45 UTC
[maven-doxia-sitetools] branch DOXIASITETOOLS-291 created (now 6b208d3)
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
at 6b208d3 [DOXIASITETOOLS-291] Add timezone field to site descriptor PublishDate object and pass onto Velocity tools context
This branch includes the following new commits:
new 6b208d3 [DOXIASITETOOLS-291] Add timezone field to site descriptor PublishDate object and pass onto Velocity tools context
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.
[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 6b208d33fe76551ad9a356b486d7d99dd725ae4c
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
---
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..9afb364 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> 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..68684e2 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)