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 2022/01/28 20:13:13 UTC
[maven-doxia-sitetools] branch master updated: [DOXIASITETOOLS-242] Remove all deprecated code
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git
The following commit(s) were added to refs/heads/master by this push:
new f0ce5f2 [DOXIASITETOOLS-242] Remove all deprecated code
f0ce5f2 is described below
commit f0ce5f25e899de3fdce465ca52d76edaea4a0fa3
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Jan 22 20:59:45 2022 +0100
[DOXIASITETOOLS-242] Remove all deprecated code
This closes #25
---
.../decoration/inheritance/PathDescriptor.java | 255 --------
.../site/decoration/inheritance/PathUtils.java | 145 -----
.../site/decoration/inheritance/Doxia91Test.java | 72 ---
.../decoration/inheritance/PathDescriptorTest.java | 655 ---------------------
.../site/decoration/inheritance/PathUtilsTest.java | 80 ---
.../apache/maven/doxia/tools/DefaultSiteTool.java | 5 +-
doxia-integration-tools/src/site/apt/index.apt | 25 +-
.../org/apache/maven/doxia/tools/SiteToolTest.java | 4 +-
doxia-site-renderer/pom.xml | 4 -
.../doxia/siterenderer/DefaultSiteRenderer.java | 78 +--
.../apache/maven/doxia/siterenderer/Renderer.java | 59 --
.../maven/doxia/siterenderer/RenderingContext.java | 12 -
.../doxia/siterenderer/SkinResourceLoader.java | 125 ----
.../doxia/siterenderer/sink/SiteRendererSink.java | 12 +-
.../siterenderer/resources/default-site-macros.vm | 28 +-
.../doxia/siterenderer/resources/default-site.vm | 2 +
doxia-site-renderer/src/site/apt/index.apt.vm | 14 -
.../siterenderer/DefaultSiteRendererTest.java | 28 -
.../doxia/siterenderer/SkinResourceLoaderTest.java | 63 --
.../siterenderer/velocity-toolmanager.expected.txt | 74 ++-
.../doxia/siterenderer/velocity-toolmanager.vm | 2 +-
21 files changed, 87 insertions(+), 1655 deletions(-)
diff --git a/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java b/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java
deleted file mode 100644
index 6c5f550..0000000
--- a/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptor.java
+++ /dev/null
@@ -1,255 +0,0 @@
-package org.apache.maven.doxia.site.decoration.inheritance;
-
-/*
- * 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.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * This class holds an instance of a maven path. This consists of a relative path (e.g. images/maven-logo.png) and a
- * base reference which can also be a relative path (e.g. '.' or '../doxia') or an URL that is used for an absolute
- * anchor.
- *
- * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
- * @deprecated use {@link URIPathDescriptor} instead.
- */
-
-public class PathDescriptor
-{
- private final URL baseUrl;
-
- private final URL pathUrl;
-
- private final String relativePath;
-
- /**
- * Construct a PathDescriptor from a path.
- *
- * @param path the path.
- * @throws java.net.MalformedURLException if a URL cannot be formed from the path.
- */
- public PathDescriptor( final String path )
- throws MalformedURLException
- {
- this( (URL) null, path );
- }
-
- /**
- * Construct a PathDescriptor from a path and a base.
- *
- * @param base a base reference.
- * @param path the path.
- * @throws java.net.MalformedURLException if a URL cannot be formed from the path.
- */
- public PathDescriptor( final String base, final String path )
- throws MalformedURLException
- {
- this( PathDescriptor.buildBaseUrl( base ), path );
- }
-
- /**
- * Construct a PathDescriptor from a path and a base.
- *
- * @param baseUrl a base reference.
- * @param path the path.
- * @throws java.net.MalformedURLException if a URL cannot be formed from the path.
- */
- public PathDescriptor( final URL baseUrl, final String path )
- throws MalformedURLException
- {
- this.baseUrl = baseUrl;
-
- URL pathURL = null;
- String relPath = null;
-
- try
- {
- pathURL = new URL( path );
- }
- catch ( MalformedURLException e )
- {
- try
- {
- pathURL = buildUrl( baseUrl, path );
- }
- catch ( MalformedURLException e2 )
- {
- // If we got an absolute path passed in and end here, then the path
- // is converted to relative because we have no reference URL anyway
- // to which it has been anchored.
- if ( path != null && path.startsWith( "/" ) )
- {
- relPath = path.substring( 1 );
- }
- else
- {
- relPath = path;
- }
- }
- }
-
- this.pathUrl = pathURL;
- this.relativePath = relPath;
- }
-
- private static URL buildBaseUrl( final String base )
- throws MalformedURLException
- {
- if ( base == null )
- {
- return null;
- }
-
- try
- {
- return new URL( base );
- }
- catch ( MalformedURLException e )
- {
- return new File( base ).toURI().toURL();
- }
- }
-
- private static URL buildUrl( final URL baseUrl, final String path )
- throws MalformedURLException
- {
- if ( baseUrl == null )
- {
- throw new MalformedURLException( "Base is null!" );
- }
-
- if ( path == null )
- {
- return baseUrl;
- }
-
- if ( baseUrl.getProtocol().equals( "file" ) )
- {
- return new File( baseUrl.getFile(), path ).toURI().toURL();
- }
-
- if ( path.startsWith( "/" ) && baseUrl.getPath().endsWith( "/" ) )
- {
- return new URL( baseUrl, path.substring( 1 ) );
- }
-
- return new URL( baseUrl, path );
- }
-
- /**
- * Check if this PathDescriptor describes a file.
- *
- * @return true for file, false otherwise.
- */
- public boolean isFile()
- {
- return isRelative() || pathUrl.getProtocol().equals( "file" );
- }
-
- /**
- * Check if this PathDescriptor describes a relative path.
- *
- * @return true if {@link #getPathUrl()} returns null.
- */
- public boolean isRelative()
- {
- return pathUrl == null;
- }
-
- /**
- * Get the base URL.
- *
- * @return the base URL.
- */
- public URL getBaseUrl()
- {
- return baseUrl;
- }
-
- /**
- * Get the path as a URL.
- *
- * @return the path as a URL.
- */
- public URL getPathUrl()
- {
- return pathUrl;
- }
-
- /**
- * Get the path.
- *
- * @return the path.
- */
- public String getPath()
- {
- if ( getPathUrl() != null )
- {
- if ( isFile() )
- {
- return StringUtils.stripEnd( getPathUrl().getPath(), "/" );
- }
- else
- {
- return getPathUrl().getPath();
- }
- }
- else
- {
- return relativePath;
- }
- }
-
- /**
- * Get the location for files.
- *
- * @return the location.
- */
- public String getLocation()
- {
- if ( isFile() )
- {
- if ( getPathUrl() != null )
- {
- return StringUtils.stripEnd( getPathUrl().getFile(), "/" );
- }
- else
- {
- return relativePath;
- }
- }
- else
- {
- return getPathUrl().toExternalForm();
- }
- }
-
- /** {@inheritDoc} */
- public String toString()
- {
- StringBuilder res =
- new StringBuilder( ( StringUtils.isNotEmpty( relativePath ) ) ? relativePath : String.valueOf( pathUrl ) );
- res.append( " (Base: " ).append( baseUrl ).append( ") Location: " ).append( getLocation() );
- return res.toString();
- }
-}
diff --git a/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtils.java b/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtils.java
deleted file mode 100644
index fad4afb..0000000
--- a/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtils.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.apache.maven.doxia.site.decoration.inheritance;
-
-/*
- * 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.net.MalformedURLException;
-import java.net.URL;
-
-import org.codehaus.plexus.util.PathTool;
-
-/**
- * Utilities that allow conversion of old and new pathes and URLs relative to each other.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
- * @deprecated this only operates on deprecated classes, it is not used anymore.
- */
-public abstract class PathUtils
-{
- /**
- * Private constructor.
- */
- private PathUtils()
- {
- // do not instantiate
- }
-
- /**
- * <p>convertPath.</p>
- *
- * @param oldPath not null
- * @param newPath not null
- * @return a PathDescriptor converted by the new path
- * @throws java.net.MalformedURLException if any
- */
- public static final PathDescriptor convertPath( final PathDescriptor oldPath, final PathDescriptor newPath )
- throws MalformedURLException
- {
- String relative = getRelativePath( oldPath, newPath );
-
- if ( relative == null )
- {
- return oldPath;
- }
-
- return new PathDescriptor( relative );
- }
-
- /**
- * <p>getRelativePath.</p>
- *
- * @param oldPathDescriptor not null
- * @param newPathDescriptor not null
- * @return a relative path depending if PathDescriptor is a file or a web url.
- * @see PathTool#getRelativeFilePath(String, String)
- * @see PathTool#getRelativeWebPath(String, String)
- */
- public static final String getRelativePath( final PathDescriptor oldPathDescriptor,
- final PathDescriptor newPathDescriptor )
- {
- // Cannot convert from URL to file.
- if ( oldPathDescriptor.isFile() )
- {
- if ( !newPathDescriptor.isFile() )
- {
- // We want to convert from a file to an URL. This is normally not possible...
- if ( oldPathDescriptor.isRelative() )
- {
- // unless the old path is a relative path. Then we might convert an existing
- // site into a new URL using resolvePaths()...
- return oldPathDescriptor.getPath();
- }
-
- // The old path is not relative. Bail out.
- return null;
- }
- else
- {
- // both are files, if either of them is relative, bail out
- // see DOXIASITETOOLS-29, MSITE-404, PLXUTILS-116
- if ( oldPathDescriptor.isRelative() || newPathDescriptor.isRelative() )
- {
- return null;
- }
- }
- }
-
- // Don't optimize to else. This might also be old.isFile && new.isFile ...
- if ( !oldPathDescriptor.isFile() )
- {
- // URLs, determine if they share protocol and domain info
- URL oldUrl = oldPathDescriptor.getPathUrl();
- URL newUrl = newPathDescriptor.getPathUrl();
-
- if ( oldUrl == null || newUrl == null )
- {
- // One of the sites has a strange URL. no relative path possible, bail out.
- return null;
- }
-
- if ( ( newUrl.getProtocol().equalsIgnoreCase( oldUrl.getProtocol() ) )
- && ( newUrl.getHost().equalsIgnoreCase( oldUrl.getHost() ) )
- && ( newUrl.getPort() == oldUrl.getPort() ) )
- {
- // Both paths point to the same site. So we can use relative paths.
-
- String oldPath = oldPathDescriptor.getPath();
- String newPath = newPathDescriptor.getPath();
-
- return PathTool.getRelativeWebPath( newPath, oldPath );
- }
-
- // Different sites. No relative Path possible.
- return null;
- }
-
- // Both Descriptors point to an absolute path. We can build a relative path.
- String oldPath = oldPathDescriptor.getPath();
- String newPath = newPathDescriptor.getPath();
-
- if ( oldPath == null || newPath == null )
- {
- // One of the sites has a strange URL. no relative path possible, bail out.
- return null;
- }
-
- return PathTool.getRelativeFilePath( oldPath, newPath );
- }
-}
diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/Doxia91Test.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/Doxia91Test.java
deleted file mode 100644
index bcb8585..0000000
--- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/Doxia91Test.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.apache.maven.doxia.site.decoration.inheritance;
-
-/*
- * 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 org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for DOXIA-91 problems. All tests make sure that a passed in null will not generate any path conversion but
- * just returns the old path.
- *
- * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
- */
-public class Doxia91Test
-{
- /** @throws Exception */
- @Test
- public void testOldPathNull()
- throws Exception
- {
- PathDescriptor oldPath = new PathDescriptor( null );
- PathDescriptor newPath = new PathDescriptor( "http://www.apache.org/" );
-
- PathDescriptor diff = PathUtils.convertPath( oldPath, newPath );
-
- assertEquals( diff, oldPath );
- }
-
- /** @throws Exception */
- @Test
- public void testNewPathNull()
- throws Exception
- {
- PathDescriptor oldPath = new PathDescriptor( "http://www.apache.org/", "file:///home/henning/foo" );
- PathDescriptor newPath = new PathDescriptor( null );
-
- PathDescriptor diff = PathUtils.convertPath( oldPath, newPath );
-
- assertEquals( diff, oldPath );
- }
-
- /** @throws Exception */
- @Test
- public void testBothPathNull()
- throws Exception
- {
- PathDescriptor oldPath = new PathDescriptor( null );
- PathDescriptor newPath = new PathDescriptor( null );
-
- PathDescriptor diff = PathUtils.convertPath( oldPath, newPath );
-
- assertEquals( diff, oldPath );
- }
-}
diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java
deleted file mode 100644
index 3662b72..0000000
--- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java
+++ /dev/null
@@ -1,655 +0,0 @@
-package org.apache.maven.doxia.site.decoration.inheritance;
-
-/*
- * 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.io.File;
-
-import org.codehaus.plexus.util.Os;
-import org.codehaus.plexus.util.StringUtils;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Test the PathDescriptor creation under various circumstances.
- *
- * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
- */
-public class PathDescriptorTest
-{
- /** @throws Exception */
- @Test
- public void testAbsPath()
- throws Exception
- {
- String path = "absolutePath";
-
- PathDescriptor desc = new PathDescriptor( "/" + path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testRelPath()
- throws Exception
- {
- String path = "relativePath";
-
- PathDescriptor desc = new PathDescriptor( path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testEmptyAbsPath()
- throws Exception
- {
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( "/" + path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testEmptyRelPath()
- throws Exception
- {
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testNullPath()
- throws Exception
- {
- String path = null;
-
- PathDescriptor desc = new PathDescriptor( path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNull( desc.getPath() );
- assertNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testNullBaseAbsPath()
- throws Exception
- {
- String base = null;
- String path = "absolutePath";
-
- PathDescriptor desc = new PathDescriptor( base, "/" + path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testNullBaseRelPath()
- throws Exception
- {
- String base = null;
- String path = "relativePath";
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testNullBaseEmptyAbsPath()
- throws Exception
- {
- String base = null;
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( base, "/" + path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testNullBaseEmptyRelPath()
- throws Exception
- {
- String base = null;
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testNullBaseNullPath()
- throws Exception
- {
- String base = null;
- String path = null;
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertTrue( desc.isFile() );
- assertTrue( desc.isRelative() );
- assertNull( desc.getBaseUrl() );
- assertNull( desc.getPathUrl() );
- assertNull( desc.getPath() );
- assertNull( desc.getLocation() );
- assertEquals( "wrong path", path, desc.getPath() );
- assertEquals( "wrong location", path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testUrlBaseAbsPath()
- throws Exception
- {
- String base = "http://maven.apache.org/";
- String path = "absolutePath";
-
- PathDescriptor desc = new PathDescriptor( base, "/" + path );
-
- assertFalse( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testUrlBaseRelPath()
- throws Exception
- {
- String base = "http://maven.apache.org/";
- String path = "relativePath";
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertFalse( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testUrlBaseEmptyAbsPath()
- throws Exception
- {
- String base = "http://maven.apache.org/";
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( base, "/" + path );
-
- assertFalse( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testUrlBaseEmptyRelPath()
- throws Exception
- {
- String base = "http://maven.apache.org/";
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertFalse( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + path, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testUrlBaseNullPath()
- throws Exception
- {
- String base = "http://maven.apache.org/";
- String path = null;
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertFalse( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", "/", desc.getPath() );
- assertEquals( "wrong location", base, desc.getLocation() );
- }
-
- /** @throws Exception */
- @Test
- public void testFileBaseAbsPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "absolutePath";
-
- PathDescriptor desc = new PathDescriptor( "file://" + base, "/" + path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base + "/" + path ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base + "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testFileBaseRelPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "relativePath";
-
- PathDescriptor desc = new PathDescriptor( "file://" + base, path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base + "/" + path ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base + "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testFileBaseEmptyAbsPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( "file://" + base, "/" + path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base, desc.getPath() );
- assertEquals( "wrong location", base, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testFileBaseEmptyRelPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( "file://" + base, path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base, desc.getPath() );
- assertEquals( "wrong location", base, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testFileBaseNullPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = null;
-
- PathDescriptor desc = new PathDescriptor( "file://" + base, path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", base, desc.getPath() );
- assertEquals( "wrong location", base, desc.getLocation() );
- }
-
-/*
- // same as testUrlBaseAbsPath with scp, this fails!? DOXIASITETOOLS-47
- public void testUriBaseAbsPath()
- throws Exception
- {
- String base = "scp://people.apache.org/";
- String path = "absolutePath";
-
- PathDescriptor desc = new PathDescriptor( base, "/" + path );
-
- assertFalse( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( "wrong path", "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + path, desc.getLocation() );
- }
-*/
-
- /** @throws Exception */
- @Test
- public void testPathBaseAbsPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "absolutePath";
-
- PathDescriptor desc = new PathDescriptor( base, "/" + path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base + "/" + path ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base + "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testPathBaseRelPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "relativePath";
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base + "/" + path ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base + "/" + path, desc.getPath() );
- assertEquals( "wrong location", base + "/" + path, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testPathBaseEmptyAbsPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( base, "/" + path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base, desc.getPath() );
- assertEquals( "wrong location", base, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testPathBaseEmptyRelPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = "";
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base, desc.getPath() );
- assertEquals( "wrong location", base, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testPathBaseNullPath()
- throws Exception
- {
- String base = "/tmp/foo";
- String path = null;
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- String s = StringUtils.replace( new File( base ).toURI().toURL().toString(), "file:", "" );
- assertEquals( "wrong path", s, desc.getPath() );
- assertEquals( "wrong location", s, desc.getLocation() );
- }
- else
- {
- assertEquals( "wrong path", base, desc.getPath() );
- assertEquals( "wrong location", base, desc.getLocation() );
- }
- }
-
- /** @throws Exception */
- @Test
- public void testPathRelBase()
- throws Exception
- {
- String base = "../msite-404";
- String path = "index.html";
-
- PathDescriptor desc = new PathDescriptor( base, path );
-
- assertTrue( desc.isFile() );
- assertFalse( desc.isRelative() );
- assertNotNull( desc.getBaseUrl() );
- assertNotNull( desc.getPathUrl() );
- assertNotNull( desc.getPath() );
- assertNotNull( desc.getLocation() );
- assertEquals( desc.getPath(), desc.getLocation() );
- // Hudson doesn't like this?
- //assertEquals( desc.getPathUrl().toString(), desc.getBaseUrl().toString() + "/" + path );
- }
-}
diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtilsTest.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtilsTest.java
deleted file mode 100644
index 06130c5..0000000
--- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtilsTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.apache.maven.doxia.site.decoration.inheritance;
-
-/*
- * 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.io.File;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- *
- * @author ltheussl
- */
-public class PathUtilsTest
-{
- private static final String SLASH = File.separator;
-
- /** @throws Exception */
- @Test
- public void testConvertPath()
- throws Exception
- {
- PathDescriptor oldPath = new PathDescriptor( (String) null, "base" );
- PathDescriptor newPath = new PathDescriptor( "/tmp", "target" );
- assertEquals( oldPath, PathUtils.convertPath( oldPath, newPath ) );
- assertEquals( newPath, PathUtils.convertPath( newPath, oldPath ) );
- }
-
- /** @throws Exception */
- @Test
- public void testGetRelativePath()
- throws Exception
- {
- PathDescriptor oldPath = new PathDescriptor( "/tmp/foo", "base" );
- PathDescriptor newPath = new PathDescriptor( "/tmp", "target" );
- assertEquals( ".." + SLASH + ".." + SLASH + "target", PathUtils.getRelativePath( oldPath, newPath ) );
-
- oldPath = new PathDescriptor( (String) null, "base" );
- assertNull( PathUtils.getRelativePath( oldPath, newPath ) );
- assertNull( PathUtils.getRelativePath( newPath, oldPath ) );
-
- oldPath = new PathDescriptor( "/tmp/foo", null );
- assertEquals( ".." + SLASH + "target", PathUtils.getRelativePath( oldPath, newPath ) );
- assertEquals( ".." + SLASH + "foo", PathUtils.getRelativePath( newPath, oldPath ) );
- }
-
- /** @throws Exception */
- @Test
- public void testRelativePathScpBase()
- throws Exception
- {
- PathDescriptor oldPath = new PathDescriptor( "http://maven.apache.org/", "source" );
- PathDescriptor newPath = new PathDescriptor( "http://maven.apache.org/", "target" );
- assertEquals( "../source", PathUtils.getRelativePath( oldPath, newPath ) );
-
- oldPath = new PathDescriptor( "scp://people.apache.org/", "source" );
- newPath = new PathDescriptor( "scp://people.apache.org/", "target" );
- // same with scp URLs fails?! DOXIASITETOOLS-47
- //assertEquals( "../source", PathUtils.getRelativePath( oldPath, newPath ) );
- }
-}
diff --git a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
index 0e7dfe2..d253c8d 100644
--- a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
+++ b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
@@ -70,7 +70,6 @@ import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
import org.codehaus.plexus.interpolation.InterpolationException;
import org.codehaus.plexus.interpolation.MapBasedValueSource;
-import org.codehaus.plexus.interpolation.ObjectBasedValueSource;
import org.codehaus.plexus.interpolation.PrefixedObjectValueSource;
import org.codehaus.plexus.interpolation.PrefixedPropertiesValueSource;
import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
@@ -506,7 +505,7 @@ public class DefaultSiteTool
}
else
{
- interpolator.addValueSource( new ObjectBasedValueSource( aProject ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( "project.", aProject ) );
interpolator.addValueSource( new MapBasedValueSource( aProject.getProperties() ) );
try
@@ -524,7 +523,7 @@ public class DefaultSiteTool
try
{
// FIXME: this does not escape xml entities, see MSITE-226, PLXCOMP-118
- return interpolator.interpolate( siteDescriptorContent, isEarly ? null : "project" );
+ return interpolator.interpolate( siteDescriptorContent );
}
catch ( InterpolationException e )
{
diff --git a/doxia-integration-tools/src/site/apt/index.apt b/doxia-integration-tools/src/site/apt/index.apt
index 88b394f..f6f0241 100644
--- a/doxia-integration-tools/src/site/apt/index.apt
+++ b/doxia-integration-tools/src/site/apt/index.apt
@@ -32,7 +32,7 @@ Maven Doxia Integration Tools
This shared component has some utilities that are useful when integrating Doxia in Maven,
mainly for site generation and report creation.
-
+
The main entry point is the
{{{./apidocs/org/apache/maven/doxia/tools/SiteTool.html}SiteTool}} Plexus component.
@@ -58,16 +58,15 @@ Maven Doxia Integration Tools
Values are evaluated in sequence from different syntaxes:
-*-------------+--------------+--------------------+------------------+
-|| late value || early value || evaluation result || common examples ||
-*-------------+--------------+--------------------+------------------+
-| <<<project.*>>>\
-<<<*>>> (<deprecated>) | <<<this.*>>> | POM content (see {{{/ref/current/maven-model/maven.html}POM reference}}) | <<<$\{project.version\}>>>\
- | | | <<<$\{this.url\}>>>
-*-------------+--------------+--------------------+------------------+
-| <<<*>>> | <<<this.*>>> | model properties, such as project properties set in the pom | <<<$\{any.key\}>>>\
- | | | <<<$\{this.any.key\}>>>
-*-------------+--------------+--------------------+------------------+
+*-----------------+--------------+--------------------+------------------+
+|| late value || early value || evaluation result || common examples ||
+*-----------------+--------------+--------------------+------------------+
+| <<<project.*>>> | <<<this.*>>> | POM content (see {{{/ref/current/maven-model/maven.html}POM reference}}) | <<<$\{project.version\}>>>\
+ | | | <<<$\{this.url\}>>>
+*-----------------+--------------+--------------------+------------------+
+| <<<*>>> | <<<this.*>>> | model properties, such as project properties set in the pom | <<<$\{any.key\}>>>\
+ | | | <<<$\{this.any.key\}>>>
+*-----------------+--------------+--------------------+------------------+
| <<<env.*>>>\
-<<<*>>> | | environment variables | <<<$\{env.PATH\}>>>\
-*-------------+--------------+--------------------+------------------+
+<<<*>>> | | environment variables | <<<$\{env.PATH\}>>>
+*-----------------+--------------+--------------------+------------------+
diff --git a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
index 6e12e4c..91c4685 100644
--- a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
+++ b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/SiteToolTest.java
@@ -372,9 +372,9 @@ public class SiteToolTest
// href rebase
assertEquals( "../../index.html", model.getBody().getBreadcrumbs().iterator().next().getHref() );
Iterator<LinkItem> links = model.getBody().getLinks().iterator();
- // late interpolation of pom content (which happens first: properties can't override)
+ // late interpolation of pom content
assertEquals( "project.name = MSHARED-217 Child", links.next().getName() );
- assertEquals( "name = MSHARED-217 Child", links.next().getName() );
+ assertEquals( "name = name property", links.next().getName() );
// early interpolation: DOXIASITETOOLS-158
assertEquals( "this.name = MSHARED-217 Parent", links.next().getName() );
diff --git a/doxia-site-renderer/pom.xml b/doxia-site-renderer/pom.xml
index e5db41d..71291fc 100644
--- a/doxia-site-renderer/pom.xml
+++ b/doxia-site-renderer/pom.xml
@@ -96,10 +96,6 @@ under the License.
<artifactId>plexus-component-annotations</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-i18n</artifactId>
- </dependency>
- <dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
</dependency>
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 644eb0c..84b3090 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
@@ -32,15 +32,11 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
-import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Date;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -66,7 +62,6 @@ import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
import org.apache.maven.doxia.site.decoration.DecorationModel;
-import org.apache.maven.doxia.site.decoration.PublishDate;
import org.apache.maven.doxia.site.skin.SkinModel;
import org.apache.maven.doxia.site.skin.io.xpp3.SkinXpp3Reader;
import org.apache.maven.doxia.parser.module.ParserModule;
@@ -103,7 +98,6 @@ import org.apache.velocity.tools.generic.XmlTool;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.i18n.I18N;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
@@ -144,9 +138,6 @@ public class DefaultSiteRenderer
private Doxia doxia;
@Requirement
- private I18N i18n;
-
- @Requirement
private PlexusContainer plexus;
private static final String RESOURCE_DIR = "org/apache/maven/doxia/siterenderer/resources";
@@ -560,16 +551,8 @@ public class DefaultSiteRenderer
context.put( "locale", locale );
context.put( "supportedLocales", Collections.unmodifiableList( siteRenderingContext.getSiteLocales() ) );
- context.put( "currentDate", new Date() );
- SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" );
- context.put( "dateRevision", sdf.format( new Date() ) );
-
context.put( "publishDate", siteRenderingContext.getPublishDate() );
- PublishDate publishDate = siteRenderingContext.getDecoration().getPublishDate();
- DateFormat dateFormat = new SimpleDateFormat( publishDate.getFormat(), locale );
- context.put( "dateFormat", dateFormat );
-
// doxiaSiteRendererVersion
InputStream inputStream = this.getClass().getResourceAsStream( "/META-INF/"
+ "maven/org.apache.maven.doxia/doxia-site-renderer/pom.properties" );
@@ -609,12 +592,8 @@ public class DefaultSiteRenderer
context.put( "PathTool", new PathTool() );
- context.put( "FileUtils", new FileUtils() );
-
context.put( "StringUtils", new StringUtils() );
- context.put( "i18n", i18n );
-
context.put( "plexus", plexus );
return context;
}
@@ -641,54 +620,34 @@ public class DefaultSiteRenderer
context.put( "shortTitle", content.getTitle() );
// DOXIASITETOOLS-70: Prepend the project name to the title, if any
- String title = "";
+ StringBuilder title = new StringBuilder();
if ( siteRenderingContext.getDecoration() != null
&& siteRenderingContext.getDecoration().getName() != null )
{
- title = siteRenderingContext.getDecoration().getName();
+ title.append( siteRenderingContext.getDecoration().getName() );
}
else if ( siteRenderingContext.getDefaultWindowTitle() != null )
{
- title = siteRenderingContext.getDefaultWindowTitle();
+ title.append( siteRenderingContext.getDefaultWindowTitle() );
}
- if ( title.length() > 0 )
+ if ( title.length() > 0 && StringUtils.isNotEmpty( content.getTitle() ) )
{
- title += " – "; // Symbol Name: En Dash, Html Entity: –
+ title.append( " – " ); // Symbol Name: En Dash, Html Entity: –
+ }
+ if ( StringUtils.isNotEmpty( content.getTitle() ) )
+ {
+ title.append( content.getTitle() );
}
- title += content.getTitle();
- context.put( "title", title );
+ context.put( "title", title.length() > 0 ? title.toString() : null );
context.put( "headContent", content.getHead() );
context.put( "bodyContent", content.getBody() );
// document date (got from Doxia Sink date() API)
- String documentDate = content.getDate();
- if ( StringUtils.isNotEmpty( documentDate ) )
- {
- context.put( "documentDate", documentDate );
-
- // deprecated variables that rework the document date, suppose one semantics over others
- // (ie creation date, while it may be last modification date if the document writer decided so)
- // see DOXIASITETOOLS-20 for the beginning and DOXIASITETOOLS-164 for the end of this story
- try
- {
- // we support only ISO 8601 date
- Date creationDate = new SimpleDateFormat( "yyyy-MM-dd" ).parse( documentDate );
-
- context.put( "creationDate", creationDate );
- SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" );
- context.put( "dateCreation", sdf.format( creationDate ) );
- }
- catch ( java.text.ParseException e )
- {
- LOGGER.warn( "Could not parse date '" + documentDate + "' from "
- + content.getRenderingContext().getInputName()
- + " (expected yyyy-MM-dd format), ignoring!" );
- }
- }
+ context.put( "documentDate", content.getDate() );
// document rendering context, to get eventual inputName
context.put( "docRenderingContext", content.getRenderingContext() );
@@ -901,21 +860,6 @@ public class DefaultSiteRenderer
}
/** {@inheritDoc} */
- @Deprecated
- public SiteRenderingContext createContextForTemplate( File templateFile, Map<String, ?> attributes,
- DecorationModel decoration, String defaultWindowTitle,
- Locale locale )
- throws MalformedURLException
- {
- SiteRenderingContext context = createSiteRenderingContext( attributes, decoration, defaultWindowTitle, locale );
-
- context.setTemplateName( templateFile.getName() );
- context.setTemplateClassLoader( new URLClassLoader( new URL[]{templateFile.getParentFile().toURI().toURL()} ) );
-
- return context;
- }
-
- /** {@inheritDoc} */
public void copyResources( SiteRenderingContext siteRenderingContext, File resourcesDirectory,
File outputDirectory )
throws IOException
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 3e7bc89..d3460b0 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
@@ -24,14 +24,12 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
-import java.net.MalformedURLException;
import java.util.Collection;
import java.util.Locale;
import java.util.Map;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.doxia.site.decoration.DecorationModel;
-import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
/**
* <p>Site Renderer interface: render a collection of documents into a site, ie decored with a site template
@@ -60,19 +58,6 @@ public interface Renderer // TODO rename to SiteRenderer
throws RendererException, IOException;
/**
- * Generate a document output from a Doxia SiteRenderer Sink, i.e. merge the document content into
- * the site template.
- *
- * @param writer the Writer to use.
- * @param sink the Site Renderer Sink that received the Doxia events during document content rendering.
- * @param siteRenderingContext the SiteRenderingContext to use.
- * @throws RendererException if it bombs.
- * @deprecated since 1.8, use mergeDocumentIntoSite
- */
- 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.
*
@@ -103,38 +88,6 @@ public interface Renderer // TODO rename to SiteRenderer
throws RendererException, IOException;
/**
- * Create a Site Rendering Context for a site using a local template.
- *
- * @param templateFile template file
- * @param attributes attributes to use
- * @param decoration a decoration model
- * @param defaultWindowTitle default window title
- * @param locale locale to use
- * @return a SiteRenderingContext.
- * @throws MalformedURLException if it bombs.
- * @since 1.7, had an additional skinFile parameter before
- * @deprecated Deprecated without replacement, use skins only.
- * @see #createContextForSkin(Artifact, Map, DecorationModel, String, Locale)
- */
- @Deprecated
- SiteRenderingContext createContextForTemplate( File templateFile, Map<String, ?> attributes,
- DecorationModel decoration, String defaultWindowTitle,
- Locale locale )
- throws MalformedURLException;
-
- /**
- * Copy resource files.
- *
- * @param siteRenderingContext the SiteRenderingContext to use
- * @param resourcesDirectory resources directory as file
- * @param outputDirectory output directory as file
- * @throws IOException if it bombs.
- * @deprecated since 1.7, use copyResources without resourcesDirectory parameter
- */
- void copyResources( SiteRenderingContext siteRenderingContext, File resourcesDirectory, File outputDirectory )
- throws IOException;
-
- /**
* Copy resource files from skin, template, and site resources.
*
* @param siteRenderingContext the SiteRenderingContext to use.
@@ -149,18 +102,6 @@ public interface Renderer // TODO rename to SiteRenderer
* Locate Doxia document source files in the site source context.
*
* @param siteRenderingContext the SiteRenderingContext to use
- * @return the Doxia document renderers in a Map keyed by output file name.
- * @throws IOException if it bombs.
- * @throws RendererException if it bombs.
- * @deprecated since 1.8, use locateDocumentFiles with editable parameter
- */
- Map<String, DocumentRenderer> locateDocumentFiles( SiteRenderingContext siteRenderingContext )
- throws IOException, RendererException;
-
- /**
- * Locate Doxia document source files in the site source context.
- *
- * @param siteRenderingContext the SiteRenderingContext to use
* @param editable Doxia document renderer as editable? (should not set editable if generated Doxia source)
* @return the Doxia document renderers in a Map keyed by output file name.
* @throws IOException if it bombs.
diff --git a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/RenderingContext.java b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/RenderingContext.java
index 239e6ec..aa7cdaa 100644
--- a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/RenderingContext.java
+++ b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/RenderingContext.java
@@ -55,12 +55,6 @@ public class RenderingContext // TODO rename to DocumentRenderingContext
private final String generator;
- @Deprecated
- public RenderingContext( File basedir, String document )
- {
- this( basedir, null, document, null, null, false, null );
- }
-
/**
* <p>
* Constructor for RenderingContext when document is not rendered from a Doxia markup source.
@@ -77,12 +71,6 @@ public class RenderingContext // TODO rename to DocumentRenderingContext
this( basedir, null, document, null, null, false, generator );
}
- @Deprecated
- public RenderingContext( File basedir, String document, String parserId, String extension )
- {
- this( basedir, null, document, parserId, extension, false, null );
- }
-
public RenderingContext( File basedir, String basedirRelativePath, String document, String parserId,
String extension, boolean editable )
{
diff --git a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/SkinResourceLoader.java b/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/SkinResourceLoader.java
deleted file mode 100644
index e8870de..0000000
--- a/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/SkinResourceLoader.java
+++ /dev/null
@@ -1,125 +0,0 @@
-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.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.velocity.runtime.resource.Resource;
-import org.apache.velocity.runtime.resource.loader.ResourceLoader;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.commons.collections.ExtendedProperties;
-import org.codehaus.plexus.util.IOUtil;
-
-/**
- * Skin resource loader: gets content from context classloader, which should contain skin artifact,
- * and normalizes newlines
- * (see <a href="https://issues.apache.org/jira/browse/DOXIASITETOOLS-87">DOXIASITETOOLS-87</a>).
- *
- * @author Hervé Boutemy
- */
-@Deprecated
-public class SkinResourceLoader
- extends ResourceLoader
-{
- public void init( ExtendedProperties configuration )
- {
- }
-
- public synchronized InputStream getResourceStream( String name )
- throws ResourceNotFoundException
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
- if ( name.startsWith( "/" ) )
- {
- name = name.substring( 1 );
- }
-
- return normalizeNewline( classLoader.getResourceAsStream( name ) );
- }
-
- InputStream normalizeNewline( InputStream in )
- throws ResourceNotFoundException
- {
- if ( in == null )
- {
- return null;
- }
-
- try
- {
- byte[] content = IOUtil.toByteArray( in );
-
- // following code based on org.apache.maven.doxia.sink.AbstractSink.unifyEOLs(String)
-
- byte[] eol = System.getProperty( "line.separator" ).getBytes();
-
- final int size = content.length;
-
- ByteArrayOutputStream out = new ByteArrayOutputStream( size );
-
- for ( int i = 0; i < size; i++ )
- {
- byte b = content[i];
-
- if ( b == '\r' )
- {
- if ( ( i + 1 ) < size && content[i + 1] == '\n' )
- {
- i++;
- }
-
- out.write( eol );
- }
- else if ( b == '\n' )
- {
- out.write( eol );
- }
- else
- {
- out.write( b );
- }
- }
-
- return new ByteArrayInputStream( out.toByteArray() );
- }
- catch ( IOException ioe )
- {
- throw new ResourceNotFoundException( "cannot read resource", ioe );
- }
- finally
- {
- IOUtil.close( in );
- }
- }
-
- public boolean isSourceModified( Resource resource )
- {
- return false;
- }
-
- public long getLastModified( Resource resource )
- {
- return 0;
- }
-}
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 7097052..550e03c 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
@@ -49,9 +49,9 @@ public class SiteRendererSink
extends Xhtml5Sink
implements Sink, DocumentContent
{
- private String date = "";
+ private String date;
- private String title = "";
+ private String title;
private List<String> authors = new ArrayList<String>();
@@ -336,13 +336,17 @@ public class SiteRendererSink
/** {@inheritDoc} */
public String getBody()
{
- return writer.toString();
+ String body = writer.toString();
+
+ return body.length() > 0 ? body : null;
}
/** {@inheritDoc} */
public String getHead()
{
- return headWriter.toString();
+ String head = headWriter.toString();
+
+ return head.length() > 0 ? head : null;
}
/** {@inheritDoc} */
diff --git a/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site-macros.vm b/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site-macros.vm
index a2371dc..9e879a1 100644
--- a/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site-macros.vm
+++ b/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site-macros.vm
@@ -354,22 +354,22 @@ $indent </ul>##
##
#**##if ( $datePosition.equalsIgnoreCase( $position ) )
#* *##if ( ( $datePosition.equalsIgnoreCase( "right" ) ) || ( $datePosition.equalsIgnoreCase( "bottom" ) ) )
- $prefix <span id="publishDate">$i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateValue</span>
+ $prefix <span id="publishDate">$text.get( "template.lastpublished" ): $dateValue</span>
#* *##if ( $versionPosition.equalsIgnoreCase( $position ) )
- | <span id="projectVersion">$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}</span>
+ | <span id="projectVersion">$text.get( "template.version" ): ${project.version}</span>
#* *##end
#* *##elseif ( ( $datePosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $datePosition.equalsIgnoreCase( "navigation-top" ) ) )
<div id="lastPublished">
- <span id="publishDate">$i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateValue</span>
+ <span id="publishDate">$text.get( "template.lastpublished" ): $dateValue</span>
#* *##if ( $versionPosition.equalsIgnoreCase( $position ) )
- | <span id="projectVersion">$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}</span>
+ | <span id="projectVersion">$text.get( "template.version" ): ${project.version}</span>
#* *##end
</div>
#* *##elseif ( $datePosition.equalsIgnoreCase( "left" ) )
<div class="xleft">
- <span id="publishDate">$i18n.getString( "site-renderer", $locale, "template.lastpublished" ): $dateValue</span>
+ <span id="publishDate">$text.get( "template.lastpublished" ): $dateValue</span>
#* *##if ( $versionPosition.equalsIgnoreCase( $position ) )
- | <span id="projectVersion">$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}</span>
+ | <span id="projectVersion">$text.get( "template.version" ): ${project.version}</span>
#* *##end
#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 )
| #breadcrumbs( $breadcrumbs )
@@ -378,14 +378,14 @@ $indent </ul>##
#* *##end
#**##elseif ( $versionPosition.equalsIgnoreCase( $position ) )
#* *##if ( ( $versionPosition.equalsIgnoreCase( "right" ) ) || ( $versionPosition.equalsIgnoreCase( "bottom" ) ) )
- $prefix <span id="projectVersion">$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}</span>
+ $prefix <span id="projectVersion">$text.get( "template.version" ): ${project.version}</span>
#* *##elseif ( ( $versionPosition.equalsIgnoreCase( "navigation-bottom" ) ) || ( $versionPosition.equalsIgnoreCase( "navigation-top" ) ) )
<div id="lastPublished">
- <span id="projectVersion">$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}</span>
+ <span id="projectVersion">$text.get( "template.version" ): ${project.version}</span>
</div>
#* *##elseif ( $versionPosition.equalsIgnoreCase( "left" ) )
<div class="xleft">
- <span id="projectVersion">$i18n.getString( "site-renderer", $locale, "template.version" ): ${project.version}</span>
+ <span id="projectVersion">$text.get( "template.version" ): ${project.version}</span>
#* *##if ( $breadcrumbs && $breadcrumbs.size() > 0 )
| #breadcrumbs( $breadcrumbs )
#* *##end
@@ -413,7 +413,7 @@ $indent </ul>##
#* *##if( $item.name )
#* *##set ( $name = $item.name )
#* *##else
-#* *##set ( $name = $i18n.getString( "site-renderer", $locale, "template.builtby" ) )
+#* *##set ( $name = $text.get( "template.builtby" ) )
#* *##set ( $name = "${name} Maven" )
#* *##end
##
@@ -461,13 +461,13 @@ $indent </ul>##
</a>
#* *##end
#* *##if( $poweredBy.isEmpty() )
- <a href="http://maven.apache.org/" title="$i18n.getString( "site-renderer", $locale, "template.builtby" ) Maven" class="poweredBy">
- <img class="poweredBy" alt="$i18n.getString( "site-renderer", $locale, "template.builtby" ) Maven" src="$relativePath/images/logos/maven-feather.png" />
+ <a href="http://maven.apache.org/" title="$text.get( "template.builtby" ) Maven" class="poweredBy">
+ <img class="poweredBy" alt="$text.get( "template.builtby" ) Maven" src="$relativePath/images/logos/maven-feather.png" />
</a>
#* *##end
#**##else
- <a href="http://maven.apache.org/" title="$i18n.getString( "site-renderer", $locale, "template.builtby" ) Maven" class="poweredBy">
- <img class="poweredBy" alt="$i18n.getString( "site-renderer", $locale, "template.builtby" ) Maven" src="$relativePath/images/logos/maven-feather.png" />
+ <a href="http://maven.apache.org/" title="$text.get( "template.builtby" ) Maven" class="poweredBy">
+ <img class="poweredBy" alt="$text.get( "template.builtby" ) Maven" src="$relativePath/images/logos/maven-feather.png" />
</a>
#**##end
#end
diff --git a/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site.vm b/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site.vm
index 6f5e76d..2b5e29b 100644
--- a/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site.vm
+++ b/doxia-site-renderer/src/main/resources/org/apache/maven/doxia/siterenderer/resources/default-site.vm
@@ -40,7 +40,9 @@
#if ( $documentDate )
<meta name="date" content="$documentDate" />
#end
+#if ( $title )
<title>$title</title>
+#end
<link rel="stylesheet" href="$relativePath/css/maven-base.css" />
<link rel="stylesheet" href="$relativePath/css/maven-theme.css" />
<link rel="stylesheet" href="$relativePath/css/site.css" />
diff --git a/doxia-site-renderer/src/site/apt/index.apt.vm b/doxia-site-renderer/src/site/apt/index.apt.vm
index c8eb0cc..efb1952 100644
--- a/doxia-site-renderer/src/site/apt/index.apt.vm
+++ b/doxia-site-renderer/src/site/apt/index.apt.vm
@@ -61,14 +61,8 @@ Doxia Sitetools - Site Renderer
*---------------------------------+----------------------+-------------------------------+
| <<<decoration>>> | {{{../doxia-decoration-model/apidocs/org/apache/maven/doxia/site/decoration/DecorationModel.html}<<<DecorationModel>>>}} | This is a model that represents the data in your {{{../doxia-decoration-model/decoration.html}<<<site.xml>>>}}. |
*---------------------------------+----------------------+-------------------------------+
-| <<<currentDate>>> | <<<Date>>> | <<Deprecated>>: use <<<date>>> or <<<date.systemDate>>>. The date when the site is rendered. |
-*---------------------------------+----------------------+-------------------------------+
| <<<currentFileName>>> | <<<String>>> | The file name of the (HTML) document being rendered, relative to the site root. |
*---------------------------------+----------------------+-------------------------------+
-| <<<dateFormat>>> | <<<DateFormat>>> | <<Deprecated>>: use <<<date>>>, <<<date.format>>>, or <<<decoration.publishDate.format>>>. An instance of the date format as defined in <<<...@format>>> (default: An instance of the default date format for the locale of the document being rendered. |
-*---------------------------------+----------------------+-------------------------------+
-| <<<dateRevision>>> | <<<String>>> | <<Deprecated>>: same as <<<currentDate>>>. The date when the site is rendered, in the format "yyyyMMdd". |
-*---------------------------------+----------------------+-------------------------------+
| <<<doxiaSiteRendererVersion>>> | <<<String>>> | The version of the Doxia Site Renderer in use. |
*---------------------------------+----------------------+-------------------------------+
| <<<locale>>> | <<<Locale>>> | The locale for the document being rendered. |
@@ -86,10 +80,6 @@ Doxia Sitetools - Site Renderer
*---------------------------------+------------------------------------------------------+-------------------------------+
|| Variable || Type || Description ||
*---------------------------------+------------------------------------------------------+-------------------------------+
-| <<<FileUtils>>> | {{{$plexus/util/FileUtils.html}<<<FileUtils>>>}} | <<Deprecated>> |
-*---------------------------------+------------------------------------------------------+-------------------------------+
-| <<<i18n>>> | {{{$plexus/i18n/I18N.html}<<<I18N>>>}} | <<Deprecated>>: use <<<text>>>. |
-*---------------------------------+------------------------------------------------------+-------------------------------+
| <<<PathTool>>> | {{{$plexus/util/PathTool.html}<<<PathTool>>>}} | |
*---------------------------------+------------------------------------------------------+-------------------------------+
| <<<StringUtils>>> | {{{$plexus/util/StringUtils.html}<<<StringUtils>>>}} | |
@@ -174,10 +164,6 @@ Doxia Sitetools - Site Renderer
*---------------------------------+----------------------+-------------------------------+
| <<<bodyContent>>> | <<<String>>> | HTML body content of the Doxia generated output. |
*---------------------------------+----------------------+-------------------------------+
-| <<<dateCreation>>> | <<<String>>> | <<Deprecated>>: use <<<documentDate>>>. The date specified in the source document, in the format "yyyyMMdd". |
-*---------------------------------+----------------------+-------------------------------+
-| <<<creationDate>>> | <<<Date>>> | <<Deprecated>>: use <<<documentDate>>>. The date specified in the source document. |
-*---------------------------------+----------------------+-------------------------------+
| <<<documentDate>>> | <<<String>>> | The date specified in the source document: semantics has to be chosen by document writer (document creation date, or document last modification date, or ...), and format is not enforced. |
*---------------------------------+----------------------+-------------------------------+
| <<<headContent>>> | <<<String>>> | HTML head content of the Doxia generated output. |
diff --git a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
index 8e0157a..c5baec5 100644
--- a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
+++ b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
@@ -316,34 +316,6 @@ public class DefaultSiteRendererTest
assertEquals( expectedResult, renderResult );
}
- public void testVelocityToolManagerForTemplate()
- throws Exception
- {
- StringWriter writer = new StringWriter();
-
- File templateFile =
- new File( getBasedir(), "target/test-classes/org/apache/maven/doxia/siterenderer/velocity-toolmanager.vm" );
- Map<String, Object> attributes = new HashMap<String, Object>();
-
- /*
- * We need to add doxiaSiteRendererVersion manually because version property from pom.properties
- * is not available at test time in some cases.
- */
- attributes.put( "doxiaSiteRendererVersion", "1.7-bogus" );
-
- SiteRenderingContext siteRenderingContext =
- renderer.createContextForTemplate( templateFile, attributes, new DecorationModel(),
- "defaultWindowTitle", Locale.ENGLISH );
- RenderingContext context = new RenderingContext( new File( "" ), "document.html", "generator" );
- SiteRendererSink sink = new SiteRendererSink( context );
- renderer.mergeDocumentIntoSite( writer, sink, siteRenderingContext );
-
- String renderResult = writer.toString();
- InputStream in = getClass().getResourceAsStream( "velocity-toolmanager.expected.txt" );
- String expectedResult = StringUtils.unifyLineSeparators( IOUtils.toString( in, StandardCharsets.UTF_8 ) );
- assertEquals( expectedResult, renderResult );
- }
-
public void testVelocityToolManagerForSkin()
throws Exception
{
diff --git a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/SkinResourceLoaderTest.java b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/SkinResourceLoaderTest.java
deleted file mode 100644
index 6f7a5e9..0000000
--- a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/SkinResourceLoaderTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-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.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.maven.doxia.sink.impl.AbstractSink;
-import org.codehaus.plexus.util.IOUtil;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class SkinResourceLoaderTest
-{
- private SkinResourceLoader skinResourceLoader = new SkinResourceLoader();
-
- @Test
- public void testNormalizeNewline() throws Exception
- {
- String EOL = AbstractSink.EOL;
- String EOL_MACOS9 = "\r";
- String EOL_UNIX = "\n";
- String EOL_WIN = "\r\n";
-
- assertEquals( "Hello " + EOL + " world", normalizeNewline( "Hello " + EOL_MACOS9 + " world" ) );
- assertEquals( "Hello " + EOL + " world", normalizeNewline( "Hello " + EOL_UNIX + " world" ) );
- assertEquals( "Hello " + EOL + " world", normalizeNewline( "Hello " + EOL_WIN + " world" ) );
-
- assertEquals( "Hello world" + EOL, normalizeNewline( "Hello world" + EOL_MACOS9 ) );
- assertEquals( "Hello world" + EOL, normalizeNewline( "Hello world" + EOL_UNIX ) );
- assertEquals( "Hello world" + EOL, normalizeNewline( "Hello world" + EOL_WIN ) );
-
- assertEquals( EOL + "Hello world", normalizeNewline( EOL_MACOS9 + "Hello world" ) );
- assertEquals( EOL + "Hello world", normalizeNewline( EOL_UNIX + "Hello world" ) );
- assertEquals( EOL + "Hello world", normalizeNewline( EOL_WIN + "Hello world" ) );
- }
-
- private String normalizeNewline( String text ) throws IOException
- {
- InputStream in = new ByteArrayInputStream( text.getBytes() );
- InputStream out = skinResourceLoader.normalizeNewline( in );
- return IOUtil.toString( out );
- }
-}
diff --git a/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.expected.txt b/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.expected.txt
index eb6fed9..32689e3 100644
--- a/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.expected.txt
+++ b/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.expected.txt
@@ -1,42 +1,38 @@
-Maven 2 & 3
+Maven 3 & 4
This is...
We have the following keys in the context:
- 1. FileUtils
- 2. PathTool
- 3. StringUtils
- 4. alignedFileName
- 5. alternator
- 6. authors
- 7. bodyContent
- 8. class
- 9. context
- 10. convert
- 11. currentDate
- 12. currentFileName
- 13. date
- 14. dateFormat
- 15. dateRevision
- 16. decoration
- 17. display
- 18. docRenderingContext
- 19. doxiaSiteRendererVersion
- 20. esc
- 21. field
- 22. headContent
- 23. i18n
- 24. link
- 25. locale
- 26. loop
- 27. math
- 28. number
- 29. plexus
- 30. publishDate
- 31. relativePath
- 32. render
- 33. shortTitle
- 34. sorter
- 35. supportedLocales
- 36. text
- 37. title
- 38. xml
+ 1. PathTool
+ 2. StringUtils
+ 3. alignedFileName
+ 4. alternator
+ 5. authors
+ 6. bodyContent
+ 7. class
+ 8. context
+ 9. convert
+ 10. currentFileName
+ 11. date
+ 12. decoration
+ 13. display
+ 14. docRenderingContext
+ 15. documentDate
+ 16. doxiaSiteRendererVersion
+ 17. esc
+ 18. field
+ 19. headContent
+ 20. link
+ 21. locale
+ 22. loop
+ 23. math
+ 24. number
+ 25. plexus
+ 26. publishDate
+ 27. relativePath
+ 28. render
+ 29. shortTitle
+ 30. sorter
+ 31. supportedLocales
+ 32. text
+ 33. title
+ 34. xml
diff --git a/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.vm b/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.vm
index 64a430a..a00ff0a 100644
--- a/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.vm
+++ b/doxia-site-renderer/src/test/resources/org/apache/maven/doxia/siterenderer/velocity-toolmanager.vm
@@ -1,4 +1,4 @@
-$esc.html('Maven 2 & 3')
+$esc.html('Maven 3 & 4')
$display.truncate("This is a long string.", 10)
We have the following keys in the context: