org.commonmark.node.BulletList Java Examples

The following examples show how to use org.commonmark.node.BulletList. 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: RuleService.java    From clouditor with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(BulletList bulletList) {
  var node = bulletList.getFirstChild();

  this.rule.getControls().add(renderText(node.getFirstChild()));

  while (node.getNext() != null) {
    node = node.getNext();

    this.rule.getControls().add(renderText(node.getFirstChild()));
  }
}
 
Example #2
Source File: MarkdownAssert.java    From doov with Apache License 2.0 5 votes vote down vote up
public IntegerAssert countBulletList() {
    final AtomicInteger count = new AtomicInteger();
    actual.accept(new AbstractVisitor() {
        @Override
        public void visit(BulletList bulletList) {
            count.incrementAndGet();
            super.visit(bulletList);
        }
    });
    return new IntegerAssert(count.get());
}
 
Example #3
Source File: TableOfContentsPlugin.java    From Markwon with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(Heading heading) {
    this.isInsideHeading = true;
    try {
        // reset build from previous content
        builder.setLength(0);

        // obtain level (can additionally filter by level, to skip lower ones)
        final int level = heading.getLevel();

        // build heading title
        visitChildren(heading);

        // initial list item
        final ListItem listItem = new ListItem();

        Node parent = listItem;
        Node node = listItem;

        for (int i = 1; i < level; i++) {
            final ListItem li = new ListItem();
            final BulletList bulletList = new BulletList();
            bulletList.appendChild(li);
            parent.appendChild(bulletList);
            parent = li;
            node = li;
        }

        final String content = builder.toString();
        final Link link = new Link("#" + AnchorHeadingPlugin.createAnchor(content), null);
        final Text text = new Text(content);
        link.appendChild(text);
        node.appendChild(link);
        bulletList.appendChild(listItem);


    } finally {
        isInsideHeading = false;
    }
}
 
Example #4
Source File: BulletListIsOrderedWithLettersWhenNestedPlugin.java    From Markwon with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: BulletListHolder.java    From 1Rramp-Android with MIT License 4 votes vote down vote up
public BulletListHolder(ListHolder parent, BulletList list) {
    super(parent);
    marker = list.getBulletMarker();
}
 
Example #6
Source File: MarkwonVisitorImpl.java    From Markwon with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(BulletList bulletList) {
    visit((Node) bulletList);
}
 
Example #7
Source File: CorePlugin.java    From Markwon with Apache License 2.0 4 votes vote down vote up
private static void bulletList(@NonNull MarkwonVisitor.Builder builder) {
    builder.on(BulletList.class, new SimpleBlockNodeVisitor());
}
 
Example #8
Source File: BulletListHolder.java    From commonmark-java with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BulletListHolder(ListHolder parent, BulletList list) {
    super(parent);
    marker = list.getBulletMarker();
}