Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
When calling readDocumentHeader() on a file where an attribute is part of an include path a WARNING message is output warning that the attribute is missing. However there appears to be no way to pass attributes into the readDocumentHeader method so isn't this warning redundant? Available method signatures: DocumentHeader readDocumentHeader(File filename); DocumentHeader readDocumentHeader(String content); DocumentHeader readDocumentHeader(Reader contentReader); Test file:include::{some-attribute}/file.adoc[] Test code:Asciidoctor asciidoctor = create(); asciidoctor.readDocumentHeader(new File("test.adoc")); Test output:asciidoctor: WARNING: dropping line containing reference to missing attribute: some-attribute Is this an issue that should be resolved by dropping the warning or providing the ability to pass in attributes? Or have I missed another configuration step that would avoid the warning message? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
On Thu, Sep 25, 2014 at 5:04 PM, kanecta [via Asciidoctor :: Discussion] <[hidden email]> wrote: Is this an issue that should be resolved by dropping the warning or providing the ability to pass in attributes? Definitely option B. The functionality of this API is severely limited if there's no way to pass options or attributes. The Map<String,Object> options argument needs to be added to parallel readDocumentStructure. Could you file an issue in AsciidoctorJ? -Dan |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Thanks! |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Dan,Kanecta I think the loadFile method could be used instead of readDocumentHeader, so you will be able to pass the map and retrieve same information as well.
Currently I am refactoring all this part as well as changing the names to follow a convention. For this reason I plan to deprecate in next version 1.5.2 the readDocumentHeader method, in 1.6.0 the methods will still be there but deprecated and probably in 1.7.0 these methods will disappear. You can read a bit more here: http://discuss.asciidoctor.org/Questions-about-readDocumentStructure-td2252.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Gotcha. To clarify, you should be able to call the load (or load_file) method and pass the "parse_header_only" option. That probably needs to be added to OptionsBuilder, though, to make it simpler to set. Currently, you have to manually create the options hash as follows: [source,java] ---- Map<String, Object> options = new HashMap<String, Object>(); options.put("parse_header_only", true); RubyHash rubyHash = RubyHashUtil.convertMapToRubyHashWithSymbols(rubyRuntime, options); Document documentHeader = asciidoctor.load_file("sample.adoc", rubyHash); ---- You can see that this is what the parseDocumentHeader method is doing behind the scenes. Sound right, Alex? -Dan On Fri, Sep 26, 2014 at 12:28 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote: Dan,Kanecta I think the loadFile method could be used instead of readDocumentHeader, so you will be able to pass the map and retrieve same information as well. ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I will create the options as well, but let me fix the code you have posted hehehe :P
[source,java] ---- Map<String, Object> options = new HashMap<String, Object>(); options.put("parse_header_only", true); //It is not necessary to do it by yourself because this line is handled automatically inside asciidoctorj. //RubyHash rubyHash = RubyHashUtil.convertMapToRubyHashWithSymbols(rubyRuntime, options); Document documentHeader = asciidoctor.loadFile(new File("sample.adoc"), options); ---- |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Thanks! -Dan On Fri, Sep 26, 2014 at 12:59 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote: I will create the options as well, but let me fix the code you have posted hehehe :P ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Free forum by Nabble | Edit this page |