incubator-any23-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mosta...@apache.org
Subject svn commit: r1345230 - in /incubator/any23/trunk: core/src/main/java/org/apache/any23/extractor/rdfa/RDFa11Parser.java core/src/test/java/org/apache/any23/Any23Test.java service/src/main/java/org/apache/any23/servlet/WebResponder.java
Date Fri, 01 Jun 2012 15:18:17 GMT
Author: mostarda
Date: Fri Jun  1 15:18:16 2012
New Revision: 1345230

URL: http://svn.apache.org/viewvc?rev=1345230&view=rev
Log:
Added IgnoreAccidentalRDFa and IgnoreTitlesOfEmptyDocuments filter in WebResponder, added
logic to prevent text/css link serialization in RDFa11. This commit is related to issue #ANY23-95.

Modified:
    incubator/any23/trunk/core/src/main/java/org/apache/any23/extractor/rdfa/RDFa11Parser.java
    incubator/any23/trunk/core/src/test/java/org/apache/any23/Any23Test.java
    incubator/any23/trunk/service/src/main/java/org/apache/any23/servlet/WebResponder.java

Modified: incubator/any23/trunk/core/src/main/java/org/apache/any23/extractor/rdfa/RDFa11Parser.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/core/src/main/java/org/apache/any23/extractor/rdfa/RDFa11Parser.java?rev=1345230&r1=1345229&r2=1345230&view=diff
==============================================================================
--- incubator/any23/trunk/core/src/main/java/org/apache/any23/extractor/rdfa/RDFa11Parser.java
(original)
+++ incubator/any23/trunk/core/src/main/java/org/apache/any23/extractor/rdfa/RDFa11Parser.java
Fri Jun  1 15:18:16 2012
@@ -73,6 +73,9 @@ public class RDFa11Parser {
     public static final String SRC_ATTRIBUTE      = "src";
     public static final String HREF_ATTRIBUTE     = "href";
 
+    public static final String TYPE_ATTRIBUTE     = "type";
+    public static final String ATTRIBUTE_CSS      = "text/css";
+
     public static final String[] SUBJECT_ATTRIBUTES = {
             ABOUT_ATTRIBUTE,
             SRC_ATTRIBUTE,
@@ -165,6 +168,7 @@ public class RDFa11Parser {
     }
 
     protected static boolean isRelativeNode(Node node) {
+        if( ATTRIBUTE_CSS.equals( DomUtils.readAttribute(node, TYPE_ATTRIBUTE) ) ) return
false;
         return DomUtils.hasAttribute(node, REL_ATTRIBUTE) || DomUtils.hasAttribute(node,
REV_ATTRIBUTE);
     }
 

Modified: incubator/any23/trunk/core/src/test/java/org/apache/any23/Any23Test.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/core/src/test/java/org/apache/any23/Any23Test.java?rev=1345230&r1=1345229&r2=1345230&view=diff
==============================================================================
--- incubator/any23/trunk/core/src/test/java/org/apache/any23/Any23Test.java (original)
+++ incubator/any23/trunk/core/src/test/java/org/apache/any23/Any23Test.java Fri Jun  1 15:18:16
2012
@@ -287,7 +287,7 @@ public class Any23Test extends Any23Onli
 
         final String bufferContent = byteArrayOutputStream.toString();
         logger.debug(bufferContent);
-        Assert.assertSame("Unexpected number of triples.", 65, StringUtils.countNL(bufferContent));
+        Assert.assertSame("Unexpected number of triples.", 60, StringUtils.countNL(bufferContent));
         
     }
 

Modified: incubator/any23/trunk/service/src/main/java/org/apache/any23/servlet/WebResponder.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/service/src/main/java/org/apache/any23/servlet/WebResponder.java?rev=1345230&r1=1345229&r2=1345230&view=diff
==============================================================================
--- incubator/any23/trunk/service/src/main/java/org/apache/any23/servlet/WebResponder.java
(original)
+++ incubator/any23/trunk/service/src/main/java/org/apache/any23/servlet/WebResponder.java
Fri Jun  1 15:18:16 2012
@@ -24,6 +24,7 @@ import org.apache.any23.extractor.Extrac
 import org.apache.any23.extractor.Extractor;
 import org.apache.any23.extractor.IssueReport;
 import org.apache.any23.filter.IgnoreAccidentalRDFa;
+import org.apache.any23.filter.IgnoreTitlesOfEmptyDocuments;
 import org.apache.any23.source.DocumentSource;
 import org.apache.any23.validator.SerializationException;
 import org.apache.any23.validator.XMLValidationReportSerializer;
@@ -321,7 +322,10 @@ class WebResponder {
         tripleHandlers.add(new CountingTripleHandler());
         rdfWriter = new CompositeTripleHandler(tripleHandlers);
         reporter = new ReportingTripleHandler(rdfWriter);
-        rdfWriter = reporter;
+        rdfWriter = new IgnoreAccidentalRDFa(
+            new IgnoreTitlesOfEmptyDocuments(reporter),
+            true    // suppress stylesheet triples.
+        );
         return true;
     }
 



Mime
View raw message