OLD | NEW |
(Empty) | |
| 1 package org.chromium.distiller.webdocument; |
| 2 |
| 3 /** |
| 4 * This class represents HTML tags that need to be preserved over the |
| 5 * distillation process. |
| 6 */ |
| 7 public class WebTag extends WebElement { |
| 8 |
| 9 private String tagName; |
| 10 private TagType tagType; |
| 11 |
| 12 public enum TagType { |
| 13 START, END |
| 14 } |
| 15 |
| 16 public WebTag(String tagName, TagType tagType) { |
| 17 this.tagName = tagName; |
| 18 this.tagType = tagType; |
| 19 } |
| 20 |
| 21 public boolean isStartTag() { |
| 22 return tagType == TagType.START; |
| 23 } |
| 24 |
| 25 public String getTagName() { |
| 26 return tagName; |
| 27 } |
| 28 |
| 29 @Override |
| 30 public String generateOutput(boolean textOnly) { |
| 31 if (textOnly) { |
| 32 return ""; |
| 33 } |
| 34 return "<" + (isStartTag() ? "" : "/") + tagName + ">"; |
| 35 } |
| 36 } |
OLD | NEW |