Examples of ByLineSource


Examples of org.apache.maven.doxia.util.ByLineSource

    {
        final StringReader sw =
            new StringReader( "" + "  <verbatim> hello, \n" + " this is a verbatim text \n"
                + " which i would like to test \n" + " Thanks </verbatim>" );

        final ByLineSource source = new ByLineReaderSource( sw );

        Block block, expected;
        expected =
            new VerbatimBlock( new Block[] { new TextBlock( " hello, \n" ),
                new TextBlock( " this is a verbatim text \n" ), new TextBlock( " which i would like to test \n" ),
                new TextBlock( " Thanks \n" ) } );

        block = getVerbatimParser().visit( source.getNextLine(), source );
        assertEquals( block, expected );
    }
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

        throws Exception
    {
        final StringReader sw =
            new StringReader( "hello this is a paragraph \n" + "  <verbatim> hello, \n"
                + " this is a verbatim text \n" + " which i would like to test \n" + " Thanks </verbatim>" );
        final ByLineSource source = new ByLineReaderSource( sw );

        Block[] expected;
        expected =
            new Block[] {
                new ParagraphBlock( new Block[] { new TextBlock( "hello this is a paragraph" ) } ),
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

    public void testVerbatimAfterSection()
        throws ParseException
    {
        final StringReader sw =
            new StringReader( "---++ fooo\n" + "  <verbatim> hello, \n" + " Thanks </verbatim>" );
        final ByLineSource source = new ByLineReaderSource( sw );

        Block[] expected;
        expected =
            new Block[] { new SectionBlock( "foo", 2, new Block[] { new VerbatimBlock( new Block[] {
                new TextBlock( " hello, \n" ), new TextBlock( " Thanks \n" ) } ) } ) };
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

{

    public void testSectionTitle()
        throws Exception
    {
        final ByLineSource source = new ByLineReaderSource( new StringReader( "---++ Test\n hello world" ) );

        final TWikiParser parser = new TWikiParser();

        assertEquals( "Test", parser.getTitle( parser.parse( source ), source ) );
    }
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

    }

    public void testNoSectionTitle()
        throws Exception
    {
        final ByLineSource source =
            new NamedByLineSource( new ByLineReaderSource( new StringReader( "hello world" ) ), "testpage" );

        final TWikiParser parser = new TWikiParser();

        assertEquals( "testpage", parser.getTitle( parser.parse( source ), source ) );
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

    }

    public void testNoSectionTwikiExtensionTitle()
        throws Exception
    {
        final ByLineSource source =
            new NamedByLineSource( new ByLineReaderSource( new StringReader( "hello world" ) ), "testpage.twiki" );

        final TWikiParser parser = new TWikiParser();

        assertEquals( "testpage", parser.getTitle( parser.parse( source ), source ) );
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

        final String text =
            "" + "      * item1.1 \n" + "   * item2\n" + "      * item2.1\n" + "   * item3\n"
                + "      * item3.1\n" + "      * item3.2\n" + "         * item3.2.1\n" + "         * item3.2.2\n"
                + "         * item3.2.3\n" + "      * item3.3\n" + "         * item3.3.1\n" + "   * item4";

        final ByLineSource source = new ByLineReaderSource( new StringReader( text ) );
        final Block b = parser.visit( source.getNextLine(), source );
        final Block[] firstLevelBlocks = ( (UnorderedListBlock) b ).getBlocks();
        final int numberOfChild = 4;
        assertEquals( numberOfChild, firstLevelBlocks.length );

        for ( int i = 0; i < firstLevelBlocks.length; i++ )
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

    public final void testNumeringDecimal()
        throws ParseException
    {
        final String text = "" + "   1. item1\n" + "   1. item2\n" + "   1. item3";

        final ByLineSource source = new ByLineReaderSource( new StringReader( text ) );
        Block blocks, expected;
        expected =
            new NumeratedListBlock( Sink.NUMBERING_DECIMAL, new ListItemBlock[] {
                new ListItemBlock( new Block[] { new TextBlock( "item1" ) } ),
                new ListItemBlock( new Block[] { new TextBlock( "item2" ) } ),
                new ListItemBlock( new Block[] { new TextBlock( "item3" ) } ) } );
        blocks = listParser.visit( source.getNextLine(), source );
        assertEquals( expected, blocks );
    }
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

    {
        final String text =
            "" + "   A. item1\n" + "      * item1.1\n" + "      * item1.2\n" + "   B. item2\n"
                + "      i. item2.1\n" + "      i. item2.2\n" + "   C. item3";

        final ByLineSource source = new ByLineReaderSource( new StringReader( text ) );
        Block blocks, expected;
        expected =
            new NumeratedListBlock( Sink.NUMBERING_UPPER_ALPHA, new ListItemBlock[] {
                new ListItemBlock( new Block[] { new TextBlock( "item1" ) },
                                   new UnorderedListBlock( new ListItemBlock[] {
                                       new ListItemBlock( new Block[] { new TextBlock( "item1.1" ) } ),
                                       new ListItemBlock( new Block[] { new TextBlock( "item1.2" ) } ) } ) ),
                new ListItemBlock( new Block[] { new TextBlock( "item2" ) },
                                   new NumeratedListBlock( Sink.NUMBERING_LOWER_ROMAN, new ListItemBlock[] {
                                       new ListItemBlock( new Block[] { new TextBlock( "item2.1" ) } ),
                                       new ListItemBlock( new Block[] { new TextBlock( "item2.2" ) } ) } ) ),
                new ListItemBlock( new Block[] { new TextBlock( "item3" ) } ) } );
        blocks = listParser.visit( source.getNextLine(), source );
        assertEquals( expected, blocks );
    }
View Full Code Here

Examples of org.apache.maven.doxia.util.ByLineSource

    public final void testTable()
        throws ParseException
    {
        final StringReader sw = new StringReader( "" + "  |cell1|cell2|  \n" + "|cell3|cell4|\n" );

        final ByLineSource source = new ByLineReaderSource( sw );

        Block block, expected;
        expected =
            new TableBlock( new Block[] {
                new TableRowBlock( new Block[] { new TableCellBlock( new Block[] { new TextBlock( "cell1" ) } ),
                    new TableCellBlock( new Block[] { new TextBlock( "cell2" ) } ) } ),
                new TableRowBlock( new Block[] { new TableCellBlock( new Block[] { new TextBlock( "cell3" ) } ),
                    new TableCellBlock( new Block[] { new TextBlock( "cell4" ) } ) } ) } );

        block = tableParser.visit( source.getNextLine(), source );
        assertEquals( block, expected );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.