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

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

Issue 1230583006: Fix for keeping lists structure (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: Classes were documented. Created 5 years, 4 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
Index: java/org/chromium/distiller/webdocument/WebTag.java
diff --git a/java/org/chromium/distiller/webdocument/WebTag.java b/java/org/chromium/distiller/webdocument/WebTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..eaaf0642645bbbd423bd9280837d345772829ec8
--- /dev/null
+++ b/java/org/chromium/distiller/webdocument/WebTag.java
@@ -0,0 +1,36 @@
+package org.chromium.distiller.webdocument;
+
+/**
+ * This class represents HTML tags that need to be preserved over the
+ * distillation process.
+ */
+public class WebTag extends WebElement {
+
+ private String tagName;
+ private TagType tagType;
+
+ public enum TagType {
+ START, END
+ }
+
+ public WebTag(String tagName, TagType tagType) {
+ this.tagName = tagName;
+ this.tagType = tagType;
+ }
+
+ public boolean isStartTag() {
+ return tagType == TagType.START;
+ }
+
+ public String getTagName() {
+ return tagName;
+ }
+
+ @Override
+ public String generateOutput(boolean textOnly) {
+ if (textOnly) {
+ return "";
+ }
+ return "<" + (isStartTag() ? "" : "/") + tagName + ">";
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698