コード例 #1
0
  @Test
  public void testParseMultipleImageTags() {
    WikiPageNode wikiPageNode = getWikiPageNode("image-5.creole");

    Assert.assertNotNull(wikiPageNode);

    ParagraphNode paragraphNode = (ParagraphNode) wikiPageNode.getChildASTNode(0);

    LineNode lineNode = (LineNode) paragraphNode.getChildASTNode(0);

    Assert.assertEquals(5, lineNode.getChildASTNodesCount());

    List<ASTNode> astNodes = lineNode.getChildASTNodes();

    for (int i = 0; i < astNodes.size(); ) {
      ImageNode imageNode = (ImageNode) astNodes.get(i);

      Assert.assertEquals("L" + ++i, imageNode.getLink());
    }
  }
コード例 #2
0
  @Test
  public void testParseSimpleLinkTagWithoutDescription2() {
    WikiPageNode wikiPageNode = getWikiPageNode("link-3.creole");

    Assert.assertNotNull(wikiPageNode);

    ParagraphNode paragraphNode = (ParagraphNode) wikiPageNode.getChildASTNode(0);

    LineNode lineNode = (LineNode) paragraphNode.getChildASTNode(0);

    Assert.assertEquals(5, lineNode.getChildASTNodesCount());

    List<ASTNode> astNodes = lineNode.getChildASTNodes();

    for (ASTNode astNode : astNodes) {
      if (!(astNode instanceof LinkNode)) {
        continue;
      }

      LinkNode linkNode = (LinkNode) astNode;

      Assert.assertEquals("L", linkNode.getLink());

      CollectionNode collectionNode = linkNode.getAltCollectionNode();

      Assert.assertNotNull(collectionNode);
      Assert.assertEquals(1, collectionNode.size());

      List<ASTNode> collectionNodeASTNodes = collectionNode.getASTNodes();

      UnformattedTextNode unformattedTextNode = (UnformattedTextNode) collectionNodeASTNodes.get(0);

      collectionNode = (CollectionNode) unformattedTextNode.getChildASTNode(0);

      unformattedTextNode = (UnformattedTextNode) collectionNode.get(0);

      Assert.assertEquals("A", unformattedTextNode.getContent());
    }
  }
コード例 #3
0
 public void visit(LineNode lineNode) {
   traverse(lineNode.getChildASTNodes(), null, StringPool.SPACE);
 }
コード例 #4
0
ファイル: BaseASTVisitor.java プロジェクト: nitro1010/liferay
 public void visit(LineNode lineNode) {
   traverse(lineNode.getChildASTNodes());
 }