Package org.apache.maven.doxia.sink

Examples of org.apache.maven.doxia.sink.SinkEventAttributeSet


    SinkEventTestingSink sink = new SinkEventTestingSink();
    createParser().parse(new StringReader(document), sink);

    Iterator<SinkEventElement> it = sink.getEventList().iterator();
    assertEquals(it, "head", "head_", "body", "paragraph");
    assertEquals(it.next(), "text", "Underline", new SinkEventAttributeSet(
        "decoration", "underline"));
    assertEquals(it, "paragraph_", "body_");
    assertFalse(it.hasNext());
  }
View Full Code Here


    SinkEventTestingSink sink = new SinkEventTestingSink();
    createParser().parse(new StringReader(document), sink);

    Iterator<SinkEventElement> it = sink.getEventList().iterator();
    assertEquals(it, "head", "head_", "body", "paragraph");
    assertEquals(it.next(), "text", "Sub", new SinkEventAttributeSet(
        "valign", "sub"));
    assertEquals(it, "paragraph_", "body_");
    assertFalse(it.hasNext());
  }
View Full Code Here

    SinkEventTestingSink sink = new SinkEventTestingSink();
    createParser().parse(new StringReader(document), sink);

    Iterator<SinkEventElement> it = sink.getEventList().iterator();
    assertEquals(it, "head", "head_", "body", "paragraph");
    assertEquals(it.next(), "text", "Sup", new SinkEventAttributeSet(
        "valign", "sup"));
    assertEquals(it, "paragraph_", "body_");
    assertFalse(it.hasNext());
  }
View Full Code Here

        this.text = text;
    }

    public void traverse( Sink sink )
    {
        sink.text( text, new SinkEventAttributeSet( SinkEventAttributes.DECORATION, "line-through" ) );
    }
View Full Code Here

        this.text = text;
    }

    public void traverse( Sink sink )
    {
        sink.text( text, new SinkEventAttributeSet( SinkEventAttributes.DECORATION, "underline" ) );
    }
View Full Code Here

        this.text = text;
    }

    public void traverse( Sink sink )
    {
        sink.text( text, new SinkEventAttributeSet( SinkEventAttributes.VALIGN, "sub" ) );
    }
View Full Code Here

        this.text = text;
    }

    public void traverse( Sink sink )
    {
        sink.text( text, new SinkEventAttributeSet( SinkEventAttributes.VALIGN, "sup" ) );
    }
View Full Code Here

     *
     * @param sink The sink to consume the event.
     */
    private void writeTopLink( Sink sink )
    {
        SinkEventAttributeSet atts = new SinkEventAttributeSet();
        atts.addAttribute( SinkEventAttributeSet.ALIGN, "right" );
        sink.paragraph( atts );
        sink.link( "#top" );
        sink.text( "[top]" );
        sink.link_();
        sink.paragraph_();
View Full Code Here

                            break;
                        default:
                            justif = SinkEventAttributeSet.LEFT;
                            break;
                    }
                    SinkEventAttributeSet event = new SinkEventAttributeSet();
                    event.addAttributes( justif );

                    if ( headers[i] )
                    {
                        AptParser.this.sink.tableHeaderCell( event );
                    }
View Full Code Here

    protected void handleStartTag( XmlPullParser parser, Sink sink )
        throws XmlPullParserException, MacroExecutionException
    {
        isEmptyElement = parser.isEmptyElementTag();

        SinkEventAttributeSet attribs = getAttributesFromParser( parser );

        if ( parser.getName().equals( HTML.toString() ) )
        {
            //Do nothing
            return;
        }
        else if ( parser.getName().equals( HEAD.toString() ) )
        {
            sink.head( attribs );
        }
        else if ( parser.getName().equals( TITLE.toString() ) )
        {
            sink.title( attribs );
        }
        else if ( parser.getName().equals( META.toString() ) )
        {
            String name = parser.getAttributeValue( null, Attribute.NAME.toString() );
            String content = parser.getAttributeValue( null, Attribute.CONTENT.toString() );

            if ( "author".equals( name ) )
            {
                sink.author( null );

                sink.text( content );

                sink.author_();
            }
            else if ( "date".equals( name ) )
            {
                sink.date( null );

                sink.text( content );

                sink.date_();
            }
            else
            {
                sink.unknown( "meta", new Object[] { Integer.valueOf( TAG_TYPE_SIMPLE ) }, attribs );
            }
        }
        /*
         * The ADDRESS element may be used by authors to supply contact information
         * for a model or a major part of a model such as a form. This element
         *  often appears at the beginning or end of a model.
         */
        else if ( parser.getName().equals( ADDRESS.toString() ) )
        {
            sink.author( attribs );
        }
        else if ( parser.getName().equals( BODY.toString() ) )
        {
            sink.body( attribs );
        }
        else if ( parser.getName().equals( DIV.toString() ) )
        {
            String divclass = parser.getAttributeValue( null, Attribute.CLASS.toString() );

            if ( "source".equals( divclass ) )
            {
                this.boxed = true;
            }

            super.baseStartTag( parser, sink ); // pick up other divs
        }
        /*
         * The PRE element tells visual user agents that the enclosed text is
         * "preformatted". When handling preformatted text, visual user agents:
         * - May leave white space intact.
         * - May render text with a fixed-pitch font.
         * - May disable automatic word wrap.
         * - Must not disable bidirectional processing.
         * Non-visual user agents are not required to respect extra white space
         * in the content of a PRE element.
         */
        else if ( parser.getName().equals( PRE.toString() ) )
        {
            if ( boxed )
            {
                attribs.addAttributes( SinkEventAttributeSet.BOXED );
            }

            verbatim();

            sink.verbatim( attribs );
View Full Code Here

TOP

Related Classes of org.apache.maven.doxia.sink.SinkEventAttributeSet

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.