Package org.apache.maven.doxia.util

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


    {
        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


        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

    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

{

    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

    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

    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

        assertTrue( parser.accept( "---+++ Title4" ) );
        assertTrue( parser.accept( "---++++ Title5" ) );
        assertTrue( parser.accept( "---+++++ Title6" ) );

        SectionBlock block;
        block = (SectionBlock) parser.visit( "---++++ Title4", new ByLineReaderSource( new StringReader( "" ) ) );

        final int level = 4;
        assertEquals( "Title4", block.getTitle() );
        assertEquals( level, block.getLevel() );
        assertEquals( 0, block.getBlocks().length );

        // ejemplo un poco m�s complejo
        block =
            (SectionBlock) parser.visit( "---+++ Title3",
                                         new ByLineReaderSource( new StringReader(
                                                                                   "This is *a* parragraph of a section.\n"
                                                                                       + "Some text.\n"
                                                                                       + "---+++ Another Title"
                                                                                       + "... and more text" ) ) );
        final SectionBlock expected =
View Full Code Here

        final String text =
            "" + "---++ Title\n" + "\n" + "hey!\n" + "how are\n" + "you?\n" + "  \n  " + "Fine!! thanks";

        final SectionBlockParser parser = sectionParser;
        parser.setVerbatimBlockParser( new VerbatimBlockParser() );
        final ByLineReaderSource source = new ByLineReaderSource( new StringReader( text ) );
        final SectionBlock block = (SectionBlock) parser.visit( source.getNextLine(), source );
        assertEquals( 2, block.getBlocks().length );
        assertEquals( "hey! how are you?",
                      ( (TextBlock) ( (ParagraphBlock) block.getBlocks()[0] ).getBlocks()[0] ).getText() );
        assertEquals( "Fine!! thanks",
                      ( (TextBlock) ( (ParagraphBlock) block.getBlocks()[1] ).getBlocks()[0] ).getText() );
View Full Code Here

     */
    public final void testSectionAndParaAndHrule()
        throws ParseException
    {
        Block[] blocks, expected;
        ByLineReaderSource source;

        source =
            new ByLineReaderSource( new StringReader( "" + "---++ Title\n" + "Some text\n"
                + "----------- More text\n" ) );
        expected =
            new Block[] { new SectionBlock( "Title", 1, new Block[] {
                new ParagraphBlock( new Block[] { new TextBlock( "Some text" ) } ), new HorizontalRuleBlock(),
                new ParagraphBlock( new Block[] { new TextBlock( "More text" ) } ) } ) };
View Full Code Here

        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

TOP

Related Classes of org.apache.maven.doxia.util.ByLineReaderSource

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.