Java Code Examples for org.commonmark.node.Node#getParent()
The following examples show how to use
org.commonmark.node.Node#getParent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableBlockHtmlRenderer.java From js-dossier with Apache License 2.0 | 6 votes |
private void renderCell(TableCellNode cell) { Map<String, String> attributes = new HashMap<>(); if (cell.getColSpan() > 1) { attributes.put("colspan", String.valueOf(cell.getColSpan())); } if (cell.getAlignment() != Alignment.NONE) { attributes.put("align", cell.getAlignment().name().toLowerCase()); } Node parent = cell.getParent(); boolean isHead = parent != null && parent.getParent() instanceof TableHeadNode; String tag = isHead ? "th" : "td"; context.getWriter().tag(tag, attributes); renderChildren(cell); context.getWriter().tag("/" + tag); }
Example 2
Source File: CorePlugin.java From Markwon with Apache License 2.0 | 5 votes |
private static int listLevel(@NonNull Node node) { int level = 0; Node parent = node.getParent(); while (parent != null) { if (parent instanceof ListItem) { level += 1; } parent = parent.getParent(); } return level; }
Example 3
Source File: CorePlugin.java From Markwon with Apache License 2.0 | 5 votes |
private static boolean isInTightList(@NonNull Paragraph paragraph) { final Node parent = paragraph.getParent(); if (parent != null) { final Node gramps = parent.getParent(); if (gramps instanceof ListBlock) { ListBlock list = (ListBlock) gramps; return list.isTight(); } } return false; }
Example 4
Source File: BulletListIsOrderedWithLettersWhenNestedPlugin.java From Markwon with Apache License 2.0 | 5 votes |
private static int listLevel(@NonNull Node node) { int level = 0; Node parent = node.getParent(); while (parent != null) { if (parent instanceof ListItem) { level += 1; } parent = parent.getParent(); } return level; }
Example 5
Source File: BulletListIsOrderedWithLettersWhenNestedPlugin.java From Markwon with Apache License 2.0 | 5 votes |
private static boolean isBulletOrdered(@NonNull Node node) { node = node.getParent(); while (node != null) { if (node instanceof OrderedList) { return true; } if (node instanceof BulletList) { return false; } node = node.getParent(); } return false; }