-
Notifications
You must be signed in to change notification settings - Fork 172
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
Multiple small changes #509
Multiple small changes #509
Conversation
IRubyObject innerDocument = getRubyProperty("inner_document"); | ||
if (innerDocument.isNil()) | ||
return null; | ||
return (Document) NodeConverter.createASTNode(innerDocument); |
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 haven't tested it, but I don't think this will compile.
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 does, though. Why shouldn't it?
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.
Gotcha! :-)
Could you please add braces around the return null
?
I probably automatically put them in there mentally around both returns that have the same indentation.
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.
Done.
Thanks a lot for your great contribution, Kristian! Would you mind adding tests for the three problems you fixed?
That would help us a lot and would avoid that we later stumble over these problems again. |
… not have an inner document.
…tributes of a block that was previously created by a block processor.
Added test cases as requested. |
Thanks a lot! Such tests really help us. There are a couple of code style problems that codenarc complains. Thanks a lot! Cheers |
Sure, will do! |
Done ;-) |
Some things still seem broken in your CI. I have run the tests locally and it was fine. Any hints? |
Yes, there are some problems with Asciidoctor PDF and JRuby on Windows. Thanks! |
Sorry to submit multiple changes in one pull request (and not using branches), but I had to make these changes in quick succession and could not isolate them. They are independent of each other, however. There are three changes:
Convert nested Java maps to Ruby hashes in
RubyHashUtil#toRubyObject
This prevents a
ClassCastException
when, after creating a new block in a block processor, you attempt to access the attributes of that block later in a tree processor. When asking the block for its attributes, AsciidoctorJ assumes that what it gets from the asciidoctor AST is an instance ofRubyHash
, when in this case what it really gets is an instance ofMapJavaProxy
that was injected by JRuby into the asciidoctor AST when the block was created originally.I'm not sure about this change, since I had to choose one of several different methods to convert Java maps to Ruby hashes in
RubyHashUtil
.Return
null
if the inner document of a table cell isnil
This prevents a
NullPointerException
when attempting to access the inner document of a table cell in a processor when that cell doesn't have an inner document in the asciidoctor AST.Add getter for
@content_model
This adds a getter for the
@content_model
attribute of an asciidoctorAbstractBlock
toStructuralNode
.I hope these changes are useful for you and that you can apply them. I have run the tests in the asciidoctorj-asciidoctorj and asciidoctorj-distribution projects and there were no failures.