forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: r632916 - in /forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets: document-to-fo.xsl helper-commonElements.xsl helper-xmpMetadata.xsl
Date Mon, 03 Mar 2008 01:41:18 GMT
Author: crossley
Date: Sun Mar  2 17:41:18 2008
New Revision: 632916

URL: http://svn.apache.org/viewvc?rev=632916&view=rev
Log:
Fix pdf links (broken by previous patch). Better presentation of header/version. Now generates
an XMP metadata package from some minimal metadata (title, subject (project-name), authors)
so this can be accessed from the Properties/GetInfo dialog in the pdf viewer.
Contributed by: Jeremias Maerki
Issue: FOR-1072

Added:
    forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-xmpMetadata.xsl
  (with props)
Modified:
    forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/document-to-fo.xsl
    forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/document-to-fo.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/document-to-fo.xsl?rev=632916&r1=632915&r2=632916&view=diff
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/document-to-fo.xsl
(original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/document-to-fo.xsl
Sun Mar  2 17:41:18 2008
@@ -118,6 +118,8 @@
         href="helper-commonElements.xsl" />
   <xsl:include
         href="helper-layout.xsl" />
+  <xsl:include
+        href="helper-xmpMetadata.xsl" />
   <xsl:template
         match="/">
     <fo:root
@@ -223,6 +225,7 @@
           </fo:repeatable-page-master-alternatives>
         </fo:page-sequence-master>
       </fo:layout-master-set>
+      <xsl:call-template name="createXMPMetadata"/>
       <xsl:apply-templates
                 select="/site/document"
                 mode="outline" />
@@ -390,12 +393,30 @@
     </fo:block>
     <xsl:apply-templates />
   </xsl:template>
-  <xsl:template
-        match="authors">
+  <xsl:template match="version">
     <fo:block
-            space-before="20pt"
             font-weight="bold"
-            font-size="9pt">
+            font-size="smaller">
+      <xsl:call-template name="insertPageBreaks"/>
+      <xsl:apply-templates select="@major"/>
+      <xsl:apply-templates select="@minor"/>
+      <xsl:apply-templates select="@fix"/>
+      <xsl:apply-templates select="@tag"/>
+      <xsl:choose>
+        <xsl:when test="starts-with(., '$Revision: ')">
+          Version <xsl:value-of select="substring(., 12, string-length(.) -11-2)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="."/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:block>
+  </xsl:template>
+  <xsl:template match="authors">
+    <fo:block
+            space-before="2em"
+            font-weight="bold"
+            font-size="smaller">
       <xsl:call-template
                 name="insertPageBreaks" />
 <!-- insert i18n stuff here --> by <xsl:for-each
@@ -410,7 +431,7 @@
   <xsl:template match="body[count(//section) != 0]">
     <xsl:if test="$disable-toc != 'true' and $toc-max-depth > 0">
       <fo:block font-family="sans-serif" font-size="12pt" font-weight="bold"
-        space-after="5pt" space-before="5pt" text-align="justify" id="__toc__">
+        space-after="0.5em" space-before="1em" text-align="justify" id="__toc__">
         <xsl:call-template name="insertPageBreaks"/>
         <!-- insert i18n stuff here -->
         <xsl:text>Table of contents</xsl:text>

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl?rev=632916&r1=632915&r2=632916&view=diff
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl
(original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-commonElements.xsl
Sun Mar  2 17:41:18 2008
@@ -308,7 +308,7 @@
     <xsl:variable name="color"
       select="$config/colors/color[@name = 'body']/@link"/>
     <xsl:choose>
-      <xsl:when test="not(boolean(href))">
+      <xsl:when test="not(boolean(@href))">
         <!-- html2document.xsl creates links with name but with no href -> filter those
-->
         <xsl:apply-templates/>
       </xsl:when>

Added: forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-xmpMetadata.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-xmpMetadata.xsl?rev=632916&view=auto
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-xmpMetadata.xsl
(added)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-xmpMetadata.xsl
Sun Mar  2 17:41:18 2008
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+  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$ -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
+  <xsl:template name="createXMPMetadata">
+    <xsl:variable name="authors" select="/site/document/header/authors/person"/>
+    <fo:declarations>
+      <x:xmpmeta xmlns:x="adobe:ns:meta/">
+        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+          <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
+            <dc:title>
+              <rdf:Alt>
+                <rdf:li xml:lang="x-default">
+                  <xsl:value-of select="/site/document/header/title"/>
+                </rdf:li>
+              </rdf:Alt>
+            </dc:title>
+            <dc:description>
+              <rdf:Alt>
+                <rdf:li xml:lang="x-default">
+                  <xsl:value-of select="$config/project-name"/>
+                </rdf:li>
+              </rdf:Alt>
+            </dc:description>
+            <xsl:if test="count($authors) &gt; 0">
+              <dc:creator>
+                <rdf:Seq>
+                  <xsl:for-each select="$authors">
+                    <rdf:li><xsl:value-of select="@name"/></rdf:li>
+                  </xsl:for-each>
+                </rdf:Seq>
+              </dc:creator>
+            </xsl:if>
+          </rdf:Description>
+          <rdf:Description about="" xmlns="http://ns.adobe.com/pdf/1.3/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
+            <pdf:Creator>Apache Forrest - http://forrest.apache.org/</pdf:Creator>
+          </rdf:Description>
+        </rdf:RDF>
+      </x:xmpmeta>
+    </fo:declarations>
+  </xsl:template>
+</xsl:stylesheet>

Propchange: forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/resources/stylesheets/helper-xmpMetadata.xsl
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message