-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOXIA-614] support source reference in doxia parser #35
[DOXIA-614] support source reference in doxia parser #35
Conversation
doxia-core/src/test/java/org/apache/maven/doxia/DefaultDoxiaTest.java
Outdated
Show resolved
Hide resolved
10928cb
to
84bf84a
Compare
Applied the suggestions tried to keep commit history clean.
|
doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
Outdated
Show resolved
Hide resolved
doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
Show resolved
Hide resolved
doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
Outdated
Show resolved
Hide resolved
doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
Outdated
Show resolved
Hide resolved
84bf84a
to
d99011c
Compare
All improvements applied, thanks for your time. |
Applied the suggestions. Anything else that could be improved? |
ok, now we have green build (clirr update was missing) I'm ok with changes, but it would b good to bump to 1.10 with proposed change wdyt @hboutemy ? |
@@ -81,14 +81,14 @@ | |||
|
|||
/** {@inheritDoc} */ | |||
@Override | |||
public void parse( Reader source, Sink sink ) | |||
public void parse( Reader source, Sink sink, String reference ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to follow from the diff, but are any of the apparent method signature changes real? Or is it just Github diff being funky?
If these are real changes is it possible to add overloads with the old variants that pass null for reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really.
To see the changes probably, the image in the PR description summarizes the changes (@ means overrride method), at least it helped me to track the changes.
The problems is the parse(String,String,String)
method in AbstractParser
was calling parse(String, String)
without the third argument. So the "reference" was totally lost and no one could use it.
Even with fixing the call in AbstractParser
, the problem is that all implementations add logic in their respective parse
and relly on the others using super.parse(String,String)
calls. So only that change would mean that someone overriding Xhtml5Parser::parse(String,String,String)
would find a total different behauviour than extending the 2 args method because the will be extending the AbstractParser
really and missing a lot of logic.
The only solution I saw was to replace 2 args method by the 3 args in all implementations and call the 3 args in the AbstractParser
with null. That makes reference
available and should not brake current doxia components.
Anything I should review? |
If you resolve conflicts and ping me, I can take another look. |
333a89e
to
6c076ba
Compare
Done 👍 |
* @throws ParserNotFoundException if no parser could be found for the given id | ||
* @throws ParseException if the model could not be parsed | ||
*/ | ||
void parse( Reader source, String parserId, Sink sink, String reference ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably doesn't matter a great deal, but adding methods to interfaces is not backwards compatible
@@ -101,7 +101,7 @@ | |||
/** | |||
* {@inheritDoc} | |||
* | |||
* @return a int. | |||
* @return a int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just delete this, if there's nothing more to say than the type
@@ -117,7 +117,7 @@ public void setEmitComments( boolean emitComments ) | |||
/** | |||
* <p>isEmitComments.</p> | |||
* | |||
* @return a boolean. | |||
* @return a boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fixed the issue and made a small adjustment. Build gene https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-doxia/job/DOXIA-614%252Fsupport-source-reference-in-doxia-parser/ |
There's still a thing to fix with test begin discussed in https://issues.apache.org/jira/browse/DOXIA-614.
Other than that, the changes are all done and the tests pass. I tried to minimize changes so no tests have been modified and all works as-is.
To facilitate review, here is a diagram with changes. Green for added elements, red for removed.
.
Some observations open for discussion:
AptParser
,ConfluenceParser
andTwikiParser
use empty string, but I consider this implementation specific.