Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: java/org/chromium/distiller/webdocument/DomConverter.java

Issue 2729233002: Ignore the "Edit" links in wiki pages (Closed)
Patch Set: fix redlink and desktop Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/webdocument/DomConverterTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: java/org/chromium/distiller/webdocument/DomConverter.java
diff --git a/java/org/chromium/distiller/webdocument/DomConverter.java b/java/org/chromium/distiller/webdocument/DomConverter.java
index 1b270f62edee7f7e6f2538644f48e77bf545e324..57bb531fa9008fd9a3c004a2b159ead8a12284c7 100644
--- a/java/org/chromium/distiller/webdocument/DomConverter.java
+++ b/java/org/chromium/distiller/webdocument/DomConverter.java
@@ -6,10 +6,10 @@ package org.chromium.distiller.webdocument;
import org.chromium.distiller.DomUtil;
import org.chromium.distiller.DomWalker;
-import org.chromium.distiller.JavaScript;
import org.chromium.distiller.LogUtil;
import org.chromium.distiller.TableClassifier;
+import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.Style;
@@ -155,6 +155,22 @@ public class DomConverter implements DomWalker.Visitor {
}
switch (e.getTagName()) {
+ case "A":
+ String editPattern = "action=edit&section=";
mdjones 2017/03/14 15:59:50 Is "action=edit" used for more than just editing?
wychen 2017/03/14 21:48:54 For "redlinks" (links to entries yet to be created
+ boolean isEdit = AnchorElement.as(e).getHref().indexOf(editPattern) != -1;
+ if (isEdit) {
+ // Skip "edit section" on mediawiki.
+ // See crbug.com/647667.
+ return false;
+ }
+ break;
+ case "SPAN":
+ if (className.equals("mw-editsection")) {
+ // Skip "[edit]" on mediawiki desktop version.
+ // See crbug.com/647667.
+ return false;
+ }
+ break;
case "BR":
builder.lineBreak(e);
return false;
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/webdocument/DomConverterTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698