You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/12 06:46:30 UTC
[maven-doxia-sitetools] branch master updated (96b97ef -> 280fff9)
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git.
from 96b97ef [DOXIASITETOOLS-181] added docRenderingContext to template Velocity ctx
new 9059489 updated version to 1.8-SNAPSHOT
new 280fff9 [DOXIASITETOOLS-182] created DocumentContent interface
The 2 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:
doxia-decoration-model/pom.xml | 2 +-
doxia-doc-renderer/pom.xml | 2 +-
doxia-integration-tools/pom.xml | 2 +-
doxia-site-renderer/pom.xml | 2 +-
.../doxia/siterenderer/DefaultSiteRenderer.java | 36 ++++---
...iaModuleReference.java => DocumentContent.java} | 56 ++++++-----
.../apache/maven/doxia/siterenderer/Renderer.java | 14 +++
.../doxia/siterenderer/sink/SiteRendererSink.java | 110 ++++++++-------------
doxia-skin-model/pom.xml | 2 +-
pom.xml | 2 +-
10 files changed, 113 insertions(+), 115 deletions(-)
copy doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/{ExtraDoxiaModuleReference.java => DocumentContent.java} (52%)
--
To stop receiving notification emails like this one, please contact
['"commits@maven.apache.org" <co...@maven.apache.org>'].
[maven-doxia-sitetools] 02/02: [DOXIASITETOOLS-182] created
DocumentContent interface
Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git
commit 280fff917d264b80f2828c101ba0d2d376a91d15
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Tue Dec 12 07:46:29 2017 +0100
[DOXIASITETOOLS-182] created DocumentContent interface
to model SiteRendererSink output
---
.../doxia/siterenderer/DefaultSiteRenderer.java | 36 ++++---
.../maven/doxia/siterenderer/DocumentContent.java | 66 +++++++++++++
.../apache/maven/doxia/siterenderer/Renderer.java | 14 +++
.../doxia/siterenderer/sink/SiteRendererSink.java | 110 ++++++++-------------
4 files changed, 142 insertions(+), 84 deletions(-)
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 25f73d1..43c7609 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
@@ -470,7 +470,7 @@ public class DefaultSiteRenderer
IOUtil.close( reader );
}
- generateDocument( writer, sink, siteContext );
+ mergeDocumentIntoSite( writer, (DocumentContent) sink, siteContext );
}
/**
@@ -605,22 +605,22 @@ public class DefaultSiteRenderer
* Create a Velocity Context for the site template decorating the document. In addition to all the informations
* from the document, this context contains data gathered in {@link SiteRendererSink} during document rendering.
*
- * @param siteRendererSink the site renderer sink for the document
+ * @param content the document content to be merged into the template
* @param siteRenderingContext the site rendering context
* @return
*/
- protected Context createSiteTemplateVelocityContext( SiteRendererSink siteRendererSink,
+ protected Context createSiteTemplateVelocityContext( DocumentContent content,
SiteRenderingContext siteRenderingContext )
{
// first get the context from document
- Context context = createDocumentVelocityContext( siteRendererSink.getRenderingContext(), siteRenderingContext );
+ Context context = createDocumentVelocityContext( content.getRenderingContext(), siteRenderingContext );
// then add data objects from rendered document
// Add infos from document
- context.put( "authors", siteRendererSink.getAuthors() );
+ context.put( "authors", content.getAuthors() );
- context.put( "shortTitle", siteRendererSink.getTitle() );
+ context.put( "shortTitle", content.getTitle() );
// DOXIASITETOOLS-70: Prepend the project name to the title, if any
String title = "";
@@ -638,16 +638,16 @@ public class DefaultSiteRenderer
{
title += " – "; // Symbol Name: En Dash, Html Entity: –
}
- title += siteRendererSink.getTitle();
+ title += content.getTitle();
context.put( "title", title );
- context.put( "headContent", siteRendererSink.getHead() );
+ context.put( "headContent", content.getHead() );
- context.put( "bodyContent", siteRendererSink.getBody() );
+ context.put( "bodyContent", content.getBody() );
// document date (got from Doxia Sink date() API)
- String documentDate = siteRendererSink.getDate();
+ String documentDate = content.getDate();
if ( StringUtils.isNotEmpty( documentDate ) )
{
context.put( "documentDate", documentDate );
@@ -667,13 +667,13 @@ public class DefaultSiteRenderer
catch ( java.text.ParseException e )
{
getLogger().warn( "Could not parse date '" + documentDate + "' from "
- + siteRendererSink.getRenderingContext().getInputName()
+ + content.getRenderingContext().getInputName()
+ " (expected yyyy-MM-dd format), ignoring!" );
}
}
// document rendering context, to get eventual inputName
- context.put( "docRenderingContext", siteRendererSink.getRenderingContext() );
+ context.put( "docRenderingContext", content.getRenderingContext() );
return context;
}
@@ -682,12 +682,20 @@ public class DefaultSiteRenderer
public void generateDocument( Writer writer, SiteRendererSink sink, SiteRenderingContext siteRenderingContext )
throws RendererException
{
+ mergeDocumentIntoSite( writer, sink, siteRenderingContext );
+ }
+
+ /** {@inheritDoc} */
+ public void mergeDocumentIntoSite( Writer writer, DocumentContent content,
+ SiteRenderingContext siteRenderingContext )
+ throws RendererException
+ {
String templateName = siteRenderingContext.getTemplateName();
getLogger().debug( "Processing Velocity for template " + templateName + " on "
- + sink.getRenderingContext().getInputName() );
+ + content.getRenderingContext().getInputName() );
- Context context = createSiteTemplateVelocityContext( sink, siteRenderingContext );
+ Context context = createSiteTemplateVelocityContext( content, siteRenderingContext );
ClassLoader old = null;
diff --git a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentContent.java b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentContent.java
new file mode 100644
index 0000000..4bcbb9e
--- /dev/null
+++ b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DocumentContent.java
@@ -0,0 +1,66 @@
+package org.apache.maven.doxia.siterenderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+/**
+ * Document content, that will be merged into a site template.
+ *
+ * @since 1.8
+ */
+public interface DocumentContent
+{
+ /**
+ * Get the title of the document.
+ * @return the document title
+ */
+ String getTitle();
+
+ /**
+ * Get the date of the document.
+ * @return the document date
+ */
+ String getDate();
+
+ /**
+ * Get the authors of the document.
+ * @return the document authors
+ */
+ List<String> getAuthors();
+
+ /**
+ * Get the html head of the document.
+ * @return the document html head
+ */
+ String getHead();
+
+ /**
+ * Get the html body of the document.
+ * @return the document body head
+ */
+ String getBody();
+
+ /**
+ * Get the document rendering context.
+ * @return the document rendering context
+ */
+ RenderingContext getRenderingContext();
+}
diff --git a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java
index 9607209..82b3068 100644
--- a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java
+++ b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/Renderer.java
@@ -69,10 +69,24 @@ public interface Renderer
* @param siteRenderingContext the SiteRenderingContext to use.
* @throws RendererException if it bombs.
*/
+ @Deprecated
void generateDocument( Writer writer, SiteRendererSink sink, SiteRenderingContext siteRenderingContext )
throws RendererException;
/**
+ * Generate a document output integrated in a site from a document content,
+ * i.e. merge the document content into the site template.
+ *
+ * @param writer the Writer to use.
+ * @param content the document content to be merged
+ * @param siteRenderingContext the SiteRenderingContext to use.
+ * @throws RendererException if it bombs.
+ * @since 1.8
+ */
+ void mergeDocumentIntoSite( Writer writer, DocumentContent content, SiteRenderingContext siteRenderingContext )
+ throws RendererException;
+
+ /**
* Create a Site Rendering Context for a site using a skin.
*
* @param skin
diff --git a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
index d47d3d8..9f59855 100644
--- a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
+++ b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
@@ -31,6 +31,7 @@ import javax.swing.text.html.HTML.Attribute;
import org.apache.maven.doxia.module.xhtml.XhtmlSink;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.SinkEventAttributes;
+import org.apache.maven.doxia.siterenderer.DocumentContent;
import org.apache.maven.doxia.siterenderer.RenderingContext;
import org.apache.maven.doxia.util.HtmlTools;
import org.codehaus.plexus.util.StringUtils;
@@ -41,17 +42,11 @@ import org.codehaus.plexus.util.StringUtils;
* into skin or template: title, date, authors, head, body
*
* @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
- * @version $Id$
- * @see #getTitle()
- * @see #getDate()
- * @see #getAuthors()
- * @see #getHead()
- * @see #getBody()
*/
@SuppressWarnings( "checkstyle:methodname" )
public class SiteRendererSink
extends XhtmlSink
- implements Sink, org.codehaus.doxia.sink.Sink
+ implements Sink, org.codehaus.doxia.sink.Sink, DocumentContent
{
private String date = "";
@@ -124,16 +119,6 @@ public class SiteRendererSink
resetTextBuffer();
}
- /**
- * <p>Getter for the field <code>title</code>.</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public String getTitle()
- {
- return title;
- }
-
/** {@inheritDoc} */
@Override
public void author()
@@ -155,16 +140,6 @@ public class SiteRendererSink
resetTextBuffer();
}
- /**
- * <p>Getter for the field <code>authors</code>.</p>
- *
- * @return a {@link java.util.List} object.
- */
- public List<String> getAuthors()
- {
- return authors;
- }
-
/** {@inheritDoc} */
@Override
public void date()
@@ -185,16 +160,6 @@ public class SiteRendererSink
}
/**
- * <p>Getter for the field <code>date</code>.</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public String getDate()
- {
- return date;
- }
-
- /**
* {@inheritDoc}
*
* Do nothing.
@@ -218,28 +183,6 @@ public class SiteRendererSink
// nop
}
- /**
- * <p>getBody.</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public String getBody()
- {
- return writer.toString();
- }
-
- /**
- * <p>getHead.</p>
- *
- * @return a {@link java.lang.String} object.
- *
- * @since 1.1.1
- */
- public String getHead()
- {
- return headWriter.toString();
- }
-
/** {@inheritDoc} */
@Override
public void head_()
@@ -315,17 +258,6 @@ public class SiteRendererSink
super.onSectionTitle_( depth );
}
- /**
- * <p>Getter for the field <code>renderingContext</code> containing the document rendering context.</p>
- *
- * @return the current document rendering context
- * @since 1.1
- */
- public RenderingContext getRenderingContext()
- {
- return renderingContext;
- }
-
/** {@inheritDoc} */
@Override
public void text( String text )
@@ -376,4 +308,42 @@ public class SiteRendererSink
super.write( txt );
}
}
+
+ // DocumentContent interface
+
+ /** {@inheritDoc} */
+ public String getTitle()
+ {
+ return title;
+ }
+
+ /** {@inheritDoc} */
+ public List<String> getAuthors()
+ {
+ return authors;
+ }
+
+ /** {@inheritDoc} */
+ public String getDate()
+ {
+ return date;
+ }
+
+ /** {@inheritDoc} */
+ public String getBody()
+ {
+ return writer.toString();
+ }
+
+ /** {@inheritDoc} */
+ public String getHead()
+ {
+ return headWriter.toString();
+ }
+
+ /** {@inheritDoc} */
+ public RenderingContext getRenderingContext()
+ {
+ return renderingContext;
+ }
}
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.
[maven-doxia-sitetools] 01/02: updated version to 1.8-SNAPSHOT
Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git
commit 9059489d39bf83399237edb1b2986c93ba2f2112
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun Dec 10 10:54:07 2017 +0100
updated version to 1.8-SNAPSHOT
---
doxia-decoration-model/pom.xml | 2 +-
doxia-doc-renderer/pom.xml | 2 +-
doxia-integration-tools/pom.xml | 2 +-
doxia-site-renderer/pom.xml | 2 +-
doxia-skin-model/pom.xml | 2 +-
pom.xml | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/doxia-decoration-model/pom.xml b/doxia-decoration-model/pom.xml
index 8c83625..60d9642 100644
--- a/doxia-decoration-model/pom.xml
+++ b/doxia-decoration-model/pom.xml
@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sitetools</artifactId>
- <version>1.7.6-SNAPSHOT</version>
+ <version>1.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/doxia-doc-renderer/pom.xml b/doxia-doc-renderer/pom.xml
index 0362a94..e3643db 100644
--- a/doxia-doc-renderer/pom.xml
+++ b/doxia-doc-renderer/pom.xml
@@ -25,7 +25,7 @@ under the License.
<parent>
<artifactId>doxia-sitetools</artifactId>
<groupId>org.apache.maven.doxia</groupId>
- <version>1.7.6-SNAPSHOT</version>
+ <version>1.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/doxia-integration-tools/pom.xml b/doxia-integration-tools/pom.xml
index d93b682..f6cb4a6 100644
--- a/doxia-integration-tools/pom.xml
+++ b/doxia-integration-tools/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sitetools</artifactId>
- <version>1.7.6-SNAPSHOT</version>
+ <version>1.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/doxia-site-renderer/pom.xml b/doxia-site-renderer/pom.xml
index 1f7e3a0..1f3e9e0 100644
--- a/doxia-site-renderer/pom.xml
+++ b/doxia-site-renderer/pom.xml
@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sitetools</artifactId>
- <version>1.7.6-SNAPSHOT</version>
+ <version>1.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/doxia-skin-model/pom.xml b/doxia-skin-model/pom.xml
index c3817b9..54a2459 100644
--- a/doxia-skin-model/pom.xml
+++ b/doxia-skin-model/pom.xml
@@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sitetools</artifactId>
- <version>1.7.6-SNAPSHOT</version>
+ <version>1.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/pom.xml b/pom.xml
index 8723e55..290eedf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@ under the License.
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sitetools</artifactId>
- <version>1.7.6-SNAPSHOT</version>
+ <version>1.8-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Doxia Sitetools</name>
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.