Author: sebb
Date: Mon Mar 7 00:36:49 2011
New Revision: 1078637
URL: http://svn.apache.org/viewvc?rev=1078637&view=rev
Log:
Add trademark overlay processing
Added:
commons/proper/commons-skin/trunk/src/main/resources/css/commons-trade.css
(with props)
Modified:
commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm
commons/proper/commons-skin/trunk/src/main/resources/css/site.css
Modified:
commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm
URL:
http://svn.apache.org/viewvc/commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm?rev=1078637&r1=1078636&r2=1078637&view=diff
==============================================================================
--- commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm
(original)
+++ commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm
Mon Mar 7 00:36:49 2011
@@ -1,6 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Generated by Apache Maven Doxia at $dateFormat.format( $currentDate ) (
$Revision: 1074931 $ ) -->
<!-- $HeadURL:
https://svn.apache.org/repos/asf/commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm
$ -->
+##
+##
+## Special processing:
+## - allows relative URLs to be processed by the template by removing
http://dummy.invalid/ from the start of any URL
+## - resolves $relativePath in banner and head elements
+## - allows absolute URLs in banner elements by removing '.remove.invalid'
from hrefs
+## - adds <custom><footer> content after Copyright, replacing @project.name@
with current ${project.name}
+## i.e. delays resolution of the Maven variable so it is processed in the
current site context, not wherever
+## site.xml is located.
+## - add trademark overlay if <custom><bannerLeft|Right><tradePos> is defined,
using the value as the style
+##
+## Resolve relativePath in context of current project
+#set ( $dummy = 'http://dummy.invalid/' )
+#set ( $dummylen = $dummy.length() )
+#macro ( relreplace $text )
+## Workround to allow site.xml to use $relativePath in URLs
+#if ( $text.startsWith($dummy) )#set ( $text = $text.substring($dummylen) )#end
+$StringUtils.replace( $text, '$relativePath', $relativePath )##
+#end
+##
+## Remove extraneous header from custom entries
+## See DOXIA-150
+#set ( $documentHeader = '<?xml version="1.0" encoding="UTF-8"?>' )
+#macro ( removeheader $text )
+#set ( $text = $StringUtils.replace( $text, $documentHeader, '' ) )
+#end
+##
#macro ( link $href $name $target $img $position $alt $border $width $height )
#set ( $linkTitle = ' title="' + $name + '"' )
#if( $target )
@@ -62,8 +89,15 @@
#end
#macro ( banner $banner $id )
#if ( $banner )
+ <div id="$id">
+ #if ( $decoration.custom.getChild($id).getChild("tradePos") )
+ #set ( $trade =
$decoration.custom.getChild($id).getChild("tradePos").value )
+ #end
+ #if ( $trade )
+ <div class="overlay_wrapper">
+ #end
#if( $banner.href )
- #set ( $hrf = $banner.href )
+ #set ( $hrf = $banner.href.replace('.remove.invalid' ,'') )
#if ( ! ( $hrf.toLowerCase().startsWith("http:/") ||
$hrf.toLowerCase().startsWith("https:/") ||
$hrf.toLowerCase().startsWith("ftp:/") ||
$hrf.toLowerCase().startsWith("mailto:/") ||
$hrf.toLowerCase().startsWith("file:/") ||
($hrf.toLowerCase().indexOf("://") != -1) ) )
@@ -73,9 +107,7 @@
#set ( $hrf = './' )
#end
#end
- <a href="$hrf" id="$id"#if( $banner.alt ) title="$banner.alt"#end>
- #else
- <div id="$id">
+ <a href="$hrf"#if( $banner.alt ) title="$banner.alt"#end>
#end
##
#if( $banner.src )
@@ -91,16 +123,18 @@
#else
#set ( $alt = $banner.name )
#end
- <img src="$src" alt="$alt" />
+ <img src="#relreplace($src)" alt="$alt"/>
#else
$banner.name
#end
-##
#if( $banner.href )
</a>
- #else
- </div>
#end
+ #if ( $trade )
+ <div class="overlay" style="$trade"><span>™</span></div>
+ </div><!-- class="overlay_wrapper" -->
+ #end
+ </div><!-- id="$id" -->
#end
#end
##
@@ -486,17 +520,15 @@
<meta http-equiv="Content-Language" content="$locale.language" />
#end
#if ( $decoration.body.head )
- ## Workround to allow site.xml to use $relativePath in URLs
- #set ( $rp = '$'+'relativePath' )
#foreach( $item in $decoration.body.head.getChildren() )
## Workaround for DOXIA-150 due to a non-desired behaviour in p-u
## @see org.codehaus.plexus.util.xml.Xpp3Dom#toString()
## @see org.codehaus.plexus.util.xml.Xpp3Dom#toUnescapedString()
#set ( $documentHeader = '<?xml version="1.0" encoding="UTF-8"?>' )
#if ( $item.name == "script" )
- $StringUtils.replace( $StringUtils.replace(
$item.toUnescapedString(), $documentHeader, "" ), $rp , $relativePath )
+ #relreplace( $StringUtils.replace( $item.toUnescapedString(),
$documentHeader, "" ) )
#else
- $StringUtils.replace( $StringUtils.replace( $item.toString(),
$documentHeader, "" ), $rp , $relativePath )
+ #relreplace( $StringUtils.replace( $item.toString(),
$documentHeader, "" ) )
#end
#end
#end
@@ -537,11 +569,10 @@
<div id="footer">
<div class="center">Copyright ©#copyright()All Rights
Reserved.#publishDate( "bottom" $decoration.publishDate $decoration.version
)</div>
#if ( $decoration.custom.getChild("footer") )
- ## See DOXIA-150
- #set ( $documentHeader = '<?xml version="1.0" encoding="UTF-8"?>' )
#foreach( $item in $decoration.custom.getChild("footer").getChildren() )
- #set ( $foot = $StringUtils.replace( $item.toString().trim(),
$documentHeader, "" ) )
- $StringUtils.replace( $foot, '@project.name@', ${project.name} )
+ #set ( $foot = $item.toString().trim() )
+ #removeheader ( $foot )
+ $StringUtils.replace( $foot, '@project.name@', ${project.name} )
#end
#end
<div class="clear">
Added:
commons/proper/commons-skin/trunk/src/main/resources/css/commons-trade.css
URL:
http://svn.apache.org/viewvc/commons/proper/commons-skin/trunk/src/main/resources/css/commons-trade.css?rev=1078637&view=auto
==============================================================================
--- commons/proper/commons-skin/trunk/src/main/resources/css/commons-trade.css
(added)
+++ commons/proper/commons-skin/trunk/src/main/resources/css/commons-trade.css
Mon Mar 7 00:36:49 2011
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/* $Id$ */
+
+/*
+ * Implement overlay for adding "TM" symbol over selected images.
+ */
+
+
+div.overlay_wrapper{ /* Absolute overlay must occur within relative div
containing the image*/
+ float:left;
+ position:relative;
+}
+
+div.overlay{/* This is absolute relative to the wrapper container. Default to
bottom */
+ position:absolute;
+ bottom:0px;
+}
+
+div.overlay span{ /* settings for the ™ content */
+ font-size:20px;
+ color:black;
+ margin:0px;
+}
Propchange:
commons/proper/commons-skin/trunk/src/main/resources/css/commons-trade.css
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/commons-skin/trunk/src/main/resources/css/site.css
URL:
http://svn.apache.org/viewvc/commons/proper/commons-skin/trunk/src/main/resources/css/site.css?rev=1078637&r1=1078636&r2=1078637&view=diff
==============================================================================
--- commons/proper/commons-skin/trunk/src/main/resources/css/site.css (original)
+++ commons/proper/commons-skin/trunk/src/main/resources/css/site.css Mon Mar
7 00:36:49 2011
@@ -1,2 +1,3 @@
/* $Id$ */
@import url("commons-maven.css");
+@import url("commons-trade.css");
\ No newline at end of file