equal
deleted
inserted
replaced
289 public static enum BlockType { |
289 public static enum BlockType { |
290 BLOCK, |
290 BLOCK, |
291 INLINE, |
291 INLINE, |
292 LIST_ITEM, |
292 LIST_ITEM, |
293 TABLE_ITEM, |
293 TABLE_ITEM, |
294 OTHER; |
294 OTHER |
295 } |
295 } |
296 |
296 |
297 /** |
297 /** |
298 * Enum representing HTML end tag requirement. |
298 * Enum representing HTML end tag requirement. |
299 */ |
299 */ |
300 public static enum EndKind { |
300 public static enum EndKind { |
301 NONE, |
301 NONE, |
302 OPTIONAL, |
302 OPTIONAL, |
303 REQUIRED; |
303 REQUIRED |
304 } |
304 } |
305 |
305 |
306 public static enum Flag { |
306 public static enum Flag { |
307 ACCEPTS_BLOCK, |
307 ACCEPTS_BLOCK, |
308 ACCEPTS_INLINE, |
308 ACCEPTS_INLINE, |
354 |
354 |
355 public String getText() { |
355 public String getText() { |
356 return StringUtils.toLowerCase(name()); |
356 return StringUtils.toLowerCase(name()); |
357 } |
357 } |
358 |
358 |
359 static final Map<String,Attr> index = new HashMap<String,Attr>(); |
359 static final Map<String,Attr> index = new HashMap<>(); |
360 static { |
360 static { |
361 for (Attr t: values()) { |
361 for (Attr t: values()) { |
362 index.put(t.getText(), t); |
362 index.put(t.getText(), t); |
363 } |
363 } |
364 } |
364 } |
392 |
392 |
393 HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) { |
393 HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) { |
394 this.blockType = blockType; |
394 this.blockType = blockType; |
395 this.endKind = endKind; |
395 this.endKind = endKind; |
396 this.flags = flags; |
396 this.flags = flags; |
397 this.attrs = new EnumMap<Attr,AttrKind>(Attr.class); |
397 this.attrs = new EnumMap<>(Attr.class); |
398 for (Map<Attr,AttrKind> m: attrMaps) |
398 for (Map<Attr,AttrKind> m: attrMaps) |
399 this.attrs.putAll(m); |
399 this.attrs.putAll(m); |
400 attrs.put(Attr.CLASS, AttrKind.OK); |
400 attrs.put(Attr.CLASS, AttrKind.OK); |
401 attrs.put(Attr.ID, AttrKind.OK); |
401 attrs.put(Attr.ID, AttrKind.OK); |
402 attrs.put(Attr.STYLE, AttrKind.OK); |
402 attrs.put(Attr.STYLE, AttrKind.OK); |
448 AttrMap map = new AttrMap(); |
448 AttrMap map = new AttrMap(); |
449 for (Attr a: attrs) map.put(a, k); |
449 for (Attr a: attrs) map.put(a, k); |
450 return map; |
450 return map; |
451 } |
451 } |
452 |
452 |
453 private static final Map<String,HtmlTag> index = new HashMap<String,HtmlTag>(); |
453 private static final Map<String,HtmlTag> index = new HashMap<>(); |
454 static { |
454 static { |
455 for (HtmlTag t: values()) { |
455 for (HtmlTag t: values()) { |
456 index.put(t.getText(), t); |
456 index.put(t.getText(), t); |
457 } |
457 } |
458 } |
458 } |