Skip to content
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

Conversation

abelsromero
Copy link
Contributor

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.
doxia-modules-classes.

Some observations open for discussion:

  • Used null insteall of empty string to represent there's no reference at all. I found the empty string to be ambiguous. I noted that AptParser, ConfluenceParser and TwikiParser use empty string, but I consider this implementation specific.

@abelsromero abelsromero force-pushed the DOXIA-614/support-source-reference-in-doxia-parser branch from 10928cb to 84bf84a Compare June 29, 2020 17:52
@abelsromero
Copy link
Contributor Author

Applied the suggestions tried to keep commit history clean.

  • Squashed test change in Test commit
  • Added new commit for Doxia's JavaDoc review

@abelsromero abelsromero force-pushed the DOXIA-614/support-source-reference-in-doxia-parser branch from 84bf84a to d99011c Compare June 30, 2020 20:34
@abelsromero
Copy link
Contributor Author

All improvements applied, thanks for your time.
Note there are a couple of points for discussion I added in the JIRA issue. I am new, so let me know where do you think is best to discuss, directly here or there.

@abelsromero
Copy link
Contributor Author

Applied the suggestions. Anything else that could be improved?

@slachiewicz
Copy link
Member

ok, now we have green build (clirr update was missing)
CI: https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-doxia/job/DOXIA-614%252Fsupport-source-reference-in-doxia-parser/
branch: https://github.com/apache/maven-doxia/commits/DOXIA-614/support-source-reference-in-doxia-parser

I'm ok with changes, but it would b good to bump to 1.10 with proposed change wdyt @hboutemy ?

@elharo elharo changed the title DOXIA-614: support source reference in doxia parser [DOXIA-614] support source reference in doxia parser Oct 7, 2020
@@ -81,14 +81,14 @@

/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink )
public void parse( Reader source, Sink sink, String reference )
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@abelsromero
Copy link
Contributor Author

Anything I should review?

@elharo
Copy link
Contributor

elharo commented Jan 5, 2021

If you resolve conflicts and ping me, I can take another look.

@abelsromero abelsromero force-pushed the DOXIA-614/support-source-reference-in-doxia-parser branch from 333a89e to 6c076ba Compare January 6, 2021 17:05
@abelsromero
Copy link
Contributor Author

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 )
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slachiewicz
Copy link
Member

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants