xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r392902 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/datatypes/ src/java/org/apache/fop/image/ src/java/org/apache/fop/layoutmgr/inline/ test/layoutengine/standard-testcases/
Date Mon, 10 Apr 2006 07:41:19 GMT
Author: jeremias
Date: Mon Apr 10 00:41:16 2006
New Revision: 392902

URL: http://svn.apache.org/viewcvs?rev=392902&view=rev
Log:
Bugfix: Allow URLs in basic-link's external-destination to be wrapped in "url()".

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/datatypes/URISpecification.java   (with
props)
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/basic-link_external-destination.xml
  (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
    xmlgraphics/fop/trunk/status.xml

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/datatypes/URISpecification.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/datatypes/URISpecification.java?rev=392902&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/datatypes/URISpecification.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/datatypes/URISpecification.java Mon Apr
10 00:41:16 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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$ */
+
+package org.apache.fop.datatypes;
+
+/**
+ * This class contains method to deal with the <uri-specification> datatype from XSL-FO.
+ */
+public class URISpecification {
+
+    /**
+     * Get the URL string from a wrapped URL.
+     *
+     * @param href the input wrapped URL
+     * @return the raw URL
+     */
+    public static String getURL(String href) {
+        /*
+         * According to section 5.11 a <uri-specification> is:
+         * "url(" + URI + ")"
+         * according to 7.28.7 a <uri-specification> is:
+         * URI
+         * So handle both.
+         */
+        href = href.trim();
+        if (href.startsWith("url(") && (href.indexOf(")") != -1)) {
+            href = href.substring(4, href.indexOf(")")).trim();
+            if (href.startsWith("'") && href.endsWith("'")) {
+                href = href.substring(1, href.length() - 1);
+            } else if (href.startsWith("\"") && href.endsWith("\"")) {
+                href = href.substring(1, href.length() - 1);
+            }
+        } else {
+            // warn
+        }
+        return href;
+    }
+
+    
+}

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/datatypes/URISpecification.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java?rev=392902&r1=392901&r2=392902&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/ImageFactory.java Mon Apr 10 00:41:16
2006
@@ -37,6 +37,7 @@
 // FOP
 import org.apache.fop.image.analyser.ImageReaderFactory;
 import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.datatypes.URISpecification;
 
 
 /**
@@ -131,25 +132,7 @@
      * @return the raw url
      */
     public static String getURL(String href) {
-        /*
-         * According to section 5.11 a <uri-specification> is:
-         * "url(" + URI + ")"
-         * according to 7.28.7 a <uri-specification> is:
-         * URI
-         * So handle both.
-         */
-        href = href.trim();
-        if (href.startsWith("url(") && (href.indexOf(")") != -1)) {
-            href = href.substring(4, href.indexOf(")")).trim();
-            if (href.startsWith("'") && href.endsWith("'")) {
-                href = href.substring(1, href.length() - 1);
-            } else if (href.startsWith("\"") && href.endsWith("\"")) {
-                href = href.substring(1, href.length() - 1);
-            }
-        } else {
-            // warn
-        }
-        return href;
+        return URISpecification.getURL(href);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java?rev=392902&r1=392901&r2=392902&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
Mon Apr 10 00:41:16 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 
 package org.apache.fop.layoutmgr.inline;
 
+import org.apache.fop.datatypes.URISpecification;
 import org.apache.fop.fo.flow.BasicLink;
 import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.area.inline.InlineArea;
@@ -41,6 +42,7 @@
         fobj = node;
     }
 
+    /** @see org.apache.fop.layoutmgr.inline.InlineLayoutManager#createArea(boolean) */
     protected InlineArea createArea(boolean bInlineParent) {
         InlineArea area = super.createArea(bInlineParent);
         setupBasicLinkArea(parentLM, area);
@@ -50,7 +52,8 @@
     private void setupBasicLinkArea(LayoutManager parentLM,
                                       InlineArea area) {
          if (fobj.getExternalDestination() != null) {
-             area.addTrait(Trait.EXTERNAL_LINK, fobj.getExternalDestination());
+             area.addTrait(Trait.EXTERNAL_LINK, 
+                     URISpecification.getURL(fobj.getExternalDestination()));
          } else {
              String idref = fobj.getInternalDestination();
              PageViewport page = getPSLM().getFirstPVWithID(idref);

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/status.xml?rev=392902&r1=392901&r2=392902&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Mon Apr 10 00:41:16 2006
@@ -27,6 +27,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="fix">
+        Bugfix: Allow URLs in basic-link's external-destination to be wrapped in "url()".
+      </action>
       <action context="Code" dev="MM" type="fix">
         Bugfix: Corrected enumerated property value for white-space property
         from "no-wrap" to "nowrap".

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/basic-link_external-destination.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/basic-link_external-destination.xml?rev=392902&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/basic-link_external-destination.xml
(added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/basic-link_external-destination.xml
Mon Apr 10 00:41:16 2006
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed 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$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks external-destination on a fo:basic-link.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block><fo:basic-link external-destination="http://xmlgraphics.apache.org/fop/">FOP</fo:basic-link></fo:block>
+          <fo:block><fo:basic-link external-destination="url(http://xmlgraphics.apache.org/fop/)">FOP</fo:basic-link></fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="http://xmlgraphics.apache.org/fop/" xpath="//flow/block[1]/lineArea/inlineparent/@external-link"/>
+    <eval expected="http://xmlgraphics.apache.org/fop/" xpath="//flow/block[2]/lineArea/inlineparent/@external-link"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/basic-link_external-destination.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/basic-link_external-destination.xml
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message