Re: [asciidoctor-java-integration] Add POJO resolution in AsciiDoc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [asciidoctor-java-integration] Add POJO resolution in AsciiDoc

LightGuardjp
A more complete solution would be for Asciidoctor core (the ruby code) to support a context which it would use to resolve interpolation. We could then plugin all sorts of things: pojos, hashes, json, etc. 

Sent from Mailbox for iPhone


On Sat, May 11, 2013 at 11:30 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:

I was thinking if it don't be  a nice new feature for asciidoctor-java-integration project to add a module to resolve POJO variables to Asciidoctor attributes. I am thinking for example in next use case:

A school wants to prepare typical filling the gap exams, they could prepare the exam in AsciiDoc, the exam is presented to students online, they fill the gaps, these information is stored into a POJO, and then when teaches wants to correct the exams, the same AsciiDoc file can be used and filled with the POJO values.

So for example (an yes it is at high level don't want to go too deep) we can have something like:

class Exam {
  Student student;
  String answer1;
}


and our AsciiDoc:

= Exam

Student Name: {student.name}

== Questions

What year did man first land on the moon ?
Ansswer: {answer1}


Then using an special render module on asciidoctor-java-integration project with a given instance and document, an output is produced.

Of course when Asciidoctor supports checkboxes (https://github.com/asciidoctor/asciidoctor/issues/200) more kind of questions could be done.

Also this works with for example typical forms that should be filled by users.

What you think, has it sense this feature?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/asciidoctor-java-integration-Add-POJO-resolution-in-AsciiDoc-tp194.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: [asciidoctor-java-integration] Add POJO resolution in AsciiDoc

asotobu
yes this would be even better, when I opened the discussion it was only to affect the Java part, but of course, it is better if we can plug in the interpolation code.
Reply | Threaded
Open this post in threaded view
|

Re: [asciidoctor-java-integration] Add POJO resolution in AsciiDoc

LightGuardjp
Thoughts Dan?


On Sun, May 12, 2013 at 4:13 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
yes this would be even better, when I opened the discussion it was only to affect the Java part, but of course, it is better if we can plug in the interpolation code.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Re-asciidoctor-java-integration-Add-POJO-resolution-in-AsciiDoc-tp195p196.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: [asciidoctor-java-integration] Add POJO resolution in AsciiDoc

mojavelinux
Administrator
I agree this would be a great feature. At the very least, we should introduce an extension point to handle attribute resolution (reminiscent of an EL resolver in Java EE, though far less complicated). I do think it's reasonable to support a basic object graph natively as well. Wrapping an OpenStruct around just about any data model allows you do reference the members using the proposed dot notation...and that keeps the document simple.

My reply on this thread was triggered by a discussion I had at OSCON. The person I was talking to needed to be able to populate the document with structured data and it relied on being able to traverse the graph in the attribute references (e.g., {borrower.firstname}). This use case is also present in the Awestruct integration (e.g., {site.name}). Thus, I'm escalating it to a must have, in some form.

I'll create an issue for this feature so we can discuss how it should work, how it should be implemented, etc.

-Dan


On Mon, May 13, 2013 at 11:08 AM, lightguard.jp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thoughts Dan?


On Sun, May 12, 2013 at 4:13 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
yes this would be even better, when I opened the discussion it was only to affect the Java part, but of course, it is better if we can plug in the interpolation code.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Re-asciidoctor-java-integration-Add-POJO-resolution-in-AsciiDoc-tp195p196.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Re-asciidoctor-java-integration-Add-POJO-resolution-in-AsciiDoc-tp195p197.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: [asciidoctor-java-integration] Add POJO resolution in AsciiDoc

mojavelinux
Administrator
In reply to this post by LightGuardjp


On Tue, Jul 30, 2013 at 6:11 PM, Dan Allen <[hidden email]> wrote:
I agree this would be a great feature. At the very least, we should introduce an extension point to handle attribute resolution (reminiscent of an EL resolver in Java EE, though far less complicated). I do think it's reasonable to support a basic object graph natively as well. Wrapping an OpenStruct around just about any data model allows you do reference the members using the proposed dot notation...and that keeps the document simple.

My reply on this thread was triggered by a discussion I had at OSCON. The person I was talking to needed to be able to populate the document with structured data and it relied on being able to traverse the graph in the attribute references (e.g., {borrower.firstname}). This use case is also present in the Awestruct integration (e.g., {site.name}). Thus, I'm escalating it to a must have, in some form.

I'll create an issue for this feature so we can discuss how it should work, how it should be implemented, etc.

-Dan


On Mon, May 13, 2013 at 11:08 AM, lightguard.jp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thoughts Dan?


On Sun, May 12, 2013 at 4:13 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
yes this would be even better, when I opened the discussion it was only to affect the Java part, but of course, it is better if we can plug in the interpolation code.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Re-asciidoctor-java-integration-Add-POJO-resolution-in-AsciiDoc-tp195p196.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Re-asciidoctor-java-integration-Add-POJO-resolution-in-AsciiDoc-tp195p197.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--



--