Skip to content

Commit

Permalink
[DOXIA-614] Make Parser::parse(Reader,Sink,String) the default method…
Browse files Browse the repository at this point in the history
… for modules

Closes #35
  • Loading branch information
slachiewicz committed May 30, 2021
1 parent 8bfb5be commit 64ddf82
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,32 @@ protected File getBasedir()
public void parse( String string, Sink sink )
throws ParseException
{
parse( new StringReader( string ), sink );
this.parse( string, sink, null );
}

/**
* {@inheritDoc}
*
* Convenience method to parse an arbitrary string and emit events into the given sink.
*
* @param string a string that provides the source input
* @param sink a sink that consumes the Doxia events
* @param reference a string containing the reference to the source of the input string (e.g. filename)
* @throws org.apache.maven.doxia.parser.ParseException if the string could not be parsed
* @since 1.10
*/
public void parse( String string, Sink sink, String reference )
throws ParseException
{
parse( new StringReader( string ), sink, reference );
}

/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink, String reference )
public void parse( Reader source, Sink sink )
throws ParseException
{
parse( source, sink );
parse( source, sink, null );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public abstract class AbstractXmlParser
private boolean validate = false;

/** {@inheritDoc} */
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
init();
Expand Down Expand Up @@ -166,18 +166,6 @@ protected void initXmlParser( XmlPullParser parser )
// nop
}

/**
* {@inheritDoc}
*
* Convenience method to parse an arbitrary string and emit any xml events into the given sink.
*/
@Override
public void parse( String string, Sink sink )
throws ParseException
{
super.parse( string, sink );
}

/** {@inheritDoc} */
@Override
public final int getType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public class Xhtml5BaseParser

/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
init();

try
{
super.parse( source, sink );
super.parse( source, sink, reference );
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public class XhtmlBaseParser

/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
init();

try
{
super.parse( source, sink );
super.parse( source, sink, reference );
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class FmlParser
private Map<String, Object> macroParameters = new HashMap<>();

/** {@inheritDoc} */
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
this.faqs = null;
Expand Down Expand Up @@ -118,7 +118,7 @@ public void parse( Reader source, Sink sink )
this.faqs = new Faqs();

// this populates faqs
super.parse( tmp, sink );
super.parse( tmp, sink, reference );

writeFaqs( sink );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public int getType()

/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class XdocParser
private boolean hasTitle;

/** {@inheritDoc} */
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
this.sourceContent = null;
Expand All @@ -110,7 +110,7 @@ public void parse( Reader source, Sink sink )

try
{
super.parse( new StringReader( sourceContent ), sink );
super.parse( new StringReader( sourceContent ), sink, reference );
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ protected void init()
}

/** {@inheritDoc} */
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
this.sourceContent = null;
Expand All @@ -355,7 +355,7 @@ public void parse( Reader source, Sink sink )

try
{
super.parse( new StringReader( sourceContent ), sink );
super.parse( new StringReader( sourceContent ), sink, reference );
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ protected void init()
}

/** {@inheritDoc} */
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
throws ParseException
{
this.sourceContent = null;
Expand All @@ -356,7 +356,7 @@ public void parse( Reader source, Sink sink )

try
{
super.parse( new StringReader( sourceContent ), sink );
super.parse( new StringReader( sourceContent ), sink, reference );
}
finally
{
Expand Down

0 comments on commit 64ddf82

Please # to comment.