Search in sources :

Example 31 with Node

use of org.commonmark.node.Node in project hippo by NHS-digital-website.

the class TableBlockNodeRenderer method renderChildren.

private void renderChildren(Node parent) {
    Node node = parent.getFirstChild();
    while (node != null) {
        Node next = node.getNext();
        context.render(node);
        node = next;
    }
}
Also used : Node(org.commonmark.node.Node)

Example 32 with Node

use of org.commonmark.node.Node in project hippo by NHS-digital-website.

the class CodeAttributeProviderTest method ignoresElementOtherThanCode.

@Test
public void ignoresElementOtherThanCode() {
    // given
    final Node nodeOtherThanCode = new TableBlock();
    // when
    codeAttributeProvider.setAttributes(nodeOtherThanCode, "tagName is ignored", attributes);
    // then
    then(attributes).shouldHaveZeroInteractions();
}
Also used : TableBlock(org.commonmark.ext.gfm.tables.TableBlock) Node(org.commonmark.node.Node) Test(org.junit.Test)

Example 33 with Node

use of org.commonmark.node.Node in project hippo by NHS-digital-website.

the class ListAttributeProviderTest method setsCssClassOnBulletListElement.

@Test
public void setsCssClassOnBulletListElement() {
    // given
    final Node nodeBulletList = new BulletList();
    // when
    listAttributeProvider.setAttributes(nodeBulletList, "tagName is ignored", attributes);
    // then
    then(attributes).should().put("class", "nhsd-t-list nhsd-t-list--bullet");
    then(attributes).shouldHaveNoMoreInteractions();
}
Also used : BulletList(org.commonmark.node.BulletList) Node(org.commonmark.node.Node) Test(org.junit.Test)

Example 34 with Node

use of org.commonmark.node.Node in project hippo by NHS-digital-website.

the class HyperlinkAttributeProviderTest method ignoresElementOtherThanLink.

@Test
public void ignoresElementOtherThanLink() {
    // given
    final Node nodeOtherThanLink = new TableBlock();
    // when
    hyperlinkAttributeProvider.setAttributes(nodeOtherThanLink, "tagName is ignored", attributes);
    // then
    then(attributes).shouldHaveZeroInteractions();
}
Also used : TableBlock(org.commonmark.ext.gfm.tables.TableBlock) Node(org.commonmark.node.Node) Test(org.junit.Test)

Example 35 with Node

use of org.commonmark.node.Node in project hippo by NHS-digital-website.

the class HyperlinkAttributeProviderTest method setsHyperlinkCssClassOnLinkElement.

@Test
public void setsHyperlinkCssClassOnLinkElement() {
    // given
    final Node nodeLink = new Link();
    // when
    hyperlinkAttributeProvider.setAttributes(nodeLink, "tagName is ignored", attributes);
    // then
    then(attributes).should().put("class", "nhsd-a-link");
    then(attributes).shouldHaveNoMoreInteractions();
}
Also used : Node(org.commonmark.node.Node) Link(org.commonmark.node.Link) Test(org.junit.Test)

Aggregations

Node (org.commonmark.node.Node)42 Parser (org.commonmark.parser.Parser)18 HtmlRenderer (org.commonmark.renderer.html.HtmlRenderer)12 Test (org.junit.Test)9 Extension (org.commonmark.Extension)7 TablesExtension (org.commonmark.ext.gfm.tables.TablesExtension)7 IOException (java.io.IOException)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 DateFormat (java.text.DateFormat)2 HashMap (java.util.HashMap)2 TableBlock (org.commonmark.ext.gfm.tables.TableBlock)2 Code (org.commonmark.node.Code)2 CustomNode (org.commonmark.node.CustomNode)2 AppWidgetManager (android.appwidget.AppWidgetManager)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 ComponentName (android.content.ComponentName)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1