-
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
Add missing method implementations to Java AST classes and fixed some… #499
Conversation
… misalignments. Replace all occurrences of ".context " with ".context.to_sym "
It might be a lot cleaner to simply monkeypatch the AbstractNode (in src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb) to override the context getter method. module Asciidoctor
class AbstractNode
def context
@context.to_sym
end
end
end That still won't fix internal references to I really don't feel good about modifying the Ruby source code from the build. This eliminates that need. |
Thanks for the tip! I don't feel good about monkeypatching either. Am Samstag, 13. August 2016 schrieb Dan Allen :
|
I don't mind monkeypatching. I just don't like that we are modifying the code in core directly instead of extending/overridding the Ruby code.
This is probably my misunderstanding of how 1.5.x works, but as far as Ruby is concerned, the underlying
That's why I advocate so strongly for anyone using extensions to be using AsciidoctorJ 1.6.x. I don't think we want to spend a lot of time trying to fix 1.5.x when we know that the model is wrong. We should only address the high priority issues and keep encouraging people to switch. |
The thing with the Java nodes is that they sit directly between Asciidoctor That's the major difference between Asciidoctorj 1.5 and 1.6: in 1.6 this Am Sonntag, 14. August 2016 schrieb Dan Allen :
|
That means the patch I proposed may not work. If that's the case, then we'll have to use the solution in the PR. |
Just tried adding the script adding some debug outputs without luck As soon as a Treeprocessor touches a node, the Java version of AbstractNodeImpl.getContext() is called instead of the Ruby AbstractNode#context. Just to make it explicit: Cheers
|
That's the clarification I was looking for. Thank you.
That's the strategy I support. I think we need to be looking ahead to 1.6 instead of backwards at 1.5. That does put some more pressure on the timeline, but I think that's a good thing. |
OK, then I’ll go back to monkeypatching only the comparison in abstract_node.rb that we currently have on master.
|
Cool. Technically, that's not monkey patching. That's hot patching. Monkey patching refers to loading a Ruby file that modifies a type already defined (such as replacing a method). |
Thanks for the clarification! I didn't know that difference yet. If you're ok with the current state of this PR I would merge it. |
👍 |
… misalignments.
As a continuation of #498 this adds more methods missing in the Java AST classes that are required if nodes are touched once by a Treeprocessor.
Additionally all occurrences of .context are now replaced with .context.to_sym.
The contexts of content created by Blockmacros could for example never be handled correctly by the parser.
This PR should also fix the second issue mentioned in #497 .