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

Side by Side 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: sync 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 unified diff | Download patch
OLDNEW
(Empty)
1 package org.chromium.distiller.webdocument;
2
3 import java.util.Arrays;
4 import java.util.List;
5
6 /**
7 * This class represents HTML tags that need to be preserved over the
8 * distillation process.
9 */
10 public class WebTag extends WebElement {
11 private String tagName;
12 private TagType tagType;
13
14 public enum TagType {
15 START, END
16 }
17
18 private static List<String> canBeNestedTags = Arrays.asList("UL", "OL", "LI" );
mdjones 2015/08/06 15:26:20 Why not Set/HashSet? The TableClassifier and Embed
19
20 public WebTag(String tagName, TagType tagType) {
21 this.tagName = tagName;
22 this.tagType = tagType;
23 }
24
25 public boolean isStartTag() {
26 return tagType == TagType.START;
27 }
28
29 public String getTagName() {
30 return tagName;
31 }
32
33 @Override
34 public String generateOutput(boolean textOnly) {
35 if (textOnly) {
36 return "";
37 }
38 return "<" + (isStartTag() ? "" : "/") + tagName + ">";
39 }
40
41 public static boolean canBeNested(String tagName) {
42 return canBeNestedTags.contains(tagName);
43 }
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698