Package org.pegdown.ast

Examples of org.pegdown.ast.Node


            RootNode rootNode = PEGDOWN_PROCESSOR.parseMarkdown( text.toCharArray() );
            if ( !haveTitle && rootNode.getChildren().size() > 0 )
            {
                // use the first (non-comment) node only if it is a heading
                int i = 0;
                Node firstNode = null;
                while ( i < rootNode.getChildren().size() && isHtmlComment(
                    ( firstNode = rootNode.getChildren().get( i ) ) ) )
                {
                    i++;
                }
View Full Code Here


    //************* BLOCKS ****************

    Rule Doc() {
        return Sequence(
                push(new Node()),
                ZeroOrMore(Block(), peek(1).addChild(pop()))
        );
    }
View Full Code Here

        );
    }

    Rule ListTight() {
        return Sequence(
                ListItem(true), push(new Node(pop())),
                ZeroOrMore(ListItem(true), peek(1).addChild(pop())),
                ZeroOrMore(BlankLine()),
                TestNot(FirstOf(Bullet(), Enumerator()))
        );
    }
View Full Code Here

        );
    }

    Rule ListLoose() {
        return Sequence(
                ListItem(false), push(new Node(pop())),
                ZeroOrMore(BlankLine()),
                ZeroOrMore(ListItem(false), peek(1).addChild(pop()), ZeroOrMore(BlankLine()))
        );
    }
View Full Code Here

        int start = 0;
        int end = innerSource.indexOf('\u0001', start); // look for boundary markers
        if (end == -1) {
            // if we have just one part simply parse and set
            Context<Node> context = getContext();
            Node innerRoot = parseRawBlock(innerSource).resultValue;
            setContext(context); // we need to save and restore the context since we might be recursing
            return push(tight ? new TightListItemNode(innerRoot) : new LooseListItemNode(innerRoot));
        }

        // ok, we have several parts, so create the root node and attach all part roots
        push(tight ? new TightListItemNode() : new LooseListItemNode());
        while (true) {
            end = innerSource.indexOf('\u0001', start);
            if (end == -1) end = innerSource.length();
            String sourcePart = innerSource.substring(start, end);

            Context<Node> context = getContext();
            Node node = parseRawBlock(sourcePart).resultValue;
            setContext(context);
            peek().addChild(node.getChildren().get(0)); // skip one superfluous level

            if (end == innerSource.length()) return true;
            start = end + 1;
        }
    }
View Full Code Here

        StringVar source = new StringVar();
        return Sequence(
                Line(),
                source.set(pop().getText()),
                ZeroOrMore(ListBlockLine(), source.append(pop().getText())),
                push(new Node(source.get()))
        );
    }
View Full Code Here

        StringVar name = new StringVar();
        return Sequence(
                OneOrMore(Alphanumeric()),
                name.set(match().toLowerCase()) && // compare ignoring case
                        Arrays.binarySearch(HTML_TAGS, name.get()) >= 0 && // make sure its a defined tag
                        push(new Node(name.get()))
        );
    }
View Full Code Here

    //************* INLINES ****************

    Rule Inlines() {
        return Sequence(
                InlineOrIntermediateEndline(), push(new Node(pop())),
                ZeroOrMore(InlineOrIntermediateEndline(), peek(1).addChild(pop())),
                Optional(Endline())
        );
    }
View Full Code Here

    }

    Rule EmphOrStrong(String chars) {
        return Sequence(
                EmphOrStrongOpen(chars),
                push(new Node()),
                OneOrMore(
                        TestNot(EmphOrStrongClose(chars)), TestNot(Newline()),
                        Inline(), peek(1).addChild(pop())
                ),
                EmphOrStrongClose(chars)
View Full Code Here

    }

    Rule Label() {
        return Sequence(
                '[',
                push(new Node()),
                OneOrMore(TestNot(']'), Inline(), peek(1).addChild(pop())),
                ']'
        );
    }
View Full Code Here

TOP

Related Classes of org.pegdown.ast.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.