Login  Register

Structure document in AsciidoctorJ

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Structure document in AsciidoctorJ

smigielski
Hi,

I finalize my idea about using asciidoc for content storage and make an extension to asciidoctorJ to support some more structure way of getting asciidoc file into java object.

For now it works great. It supports retrieving content parts by  id, title, style, role, attributes and context so you can for example write:

 List<ContentPart> images = document.getPartsByContext("image");

to get a list of images defined in the document and then to process single image:

String src = (String) image.getAttributes().get("target");
String alt = (String) image.getAttributes().get("alt");
String link = (String) image.getAttributes().get("link");

or other use case:

String text =document.getPartByStyle("description").getContent();

to get actual text of the block annotated with [description] style.

I like that idea there much and now it is really convenient to process your asciidocument to actual flexible content.

I would love to have it in the mainstream of asciidoctorJ so please review my branch:

https://github.com/smigielski/asciidoctor-java-integration/tree/structureddocuments

If it is ok for you I will issue a pull request.

Cheers,
Marek
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Structure document in AsciidoctorJ

asotobu
Wow, that's amazing, this is something that I had on my list but because I didn't have time I have always postponed and only implementing the requirements of the moment.

So first of all thank you very much for collaborating with us, second one thank you so much for using asciidoctor, and if you have any other feedback not only about AsciidoctorJ but about Asciidoctor (things that may change, or would fit better in your environment), don't hesitate to write them.

Again thank you very much and please send the pull request. :)

Alex.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Structure document in AsciidoctorJ

smigielski
Nice to hear.  I will add some documentation to README and will make a pull request.

Cheers,
Marek
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Structure document in AsciidoctorJ

asotobu
Cool, in documentation if you can add a use case of use, I mean why could be interesting to get information from AsciiDoc document, it will help other users to understand the need of having access to that elements.

Thank you so much for you help.
Alex.


2013/10/31 smigielski [via Asciidoctor :: Discussion] <[hidden email]>
Nice to hear.  I will add some documentation to README and will make a pull request.

Cheers,
Marek


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Structure-document-in-AsciidoctorJ-tp906p910.html
To unsubscribe from Structure document in AsciidoctorJ, click here.
NAML



--
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+