"MonoTree" extension

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

"MonoTree" extension

vdmitriev
Hi!

Concluding discussion that I've started in  Asciidoctorj API questions, I finally patched up usable version of the extension (I called it "MonoTree") that outputs trees like the following
[tree]
----
> A             A
>> B            ├── B
>>> C           │   ├── C
>>> D   =>      │   └── D
>> E            ├── E
>>> F           │   └── F
>> G            ├── G
>> H            └── H
----

I wonder however  if it will be deprecated by PlantUML/Salt even before a release :) I'll be grateful for ideas, code review, suggestions of making this extension more of  the "asciidoc way", etc.

Source code is available on GitHub.
Binaries are (or should be at least) available on Bintray. It's the first time I publish maven artifacts on Bintray, so I may have missed something essential.

~ Regards, Vadim
Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

Robert.Panzer
I don't think that PlantUML/Salt will supersede this plugin.
If you want to render file trees PlantUML has the drawback that it renders images, so you can't cut and paste from them.

So I would definitely want to see an extension like this!

And in fact I had a similar idea but did not start it because computing the tree lines is really a tedious task :)
Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

wimalopaan
In reply to this post by vdmitriev
Is this available as asciidoctor extension too?
Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

Robert.Panzer
No, I didn't come beyond thinking about it :)
Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

mojavelinux
Administrator
In reply to this post by wimalopaan

On Wed, Apr 1, 2015 at 3:39 PM, wimalopaan [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Is this available as asciidoctor extension too?

Something similar for Ruby can be found here (perhaps more primitive) https://github.com/asciidoctor/asciidoctor-extensions-lab/tree/master/lib/tree-block-macro

Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

mojavelinux
Administrator
In reply to this post by Robert.Panzer

On Wed, Apr 1, 2015 at 9:04 AM, Robert.Panzer [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I don't think that PlantUML/Salt will supersede this plugin.
If you want to render file trees PlantUML has the drawback that it renders images, so you can't cut and paste from them.

Ideally the AsciiDoc source could be handled by different interpreters. One could be to feed it through Asciidoctor Diagram / salt (after some text conversion). Another is to output it as text.

What's important is that we try to find the best way to represent the source document. I like the simplicity of the nested arrows. However, we could also consider supporting nested asterisks. That way, it would render in plain AsciiDoc output (up to the max depth of an AsciiDoc list). Others might like the idea of being about to feed output from the tree command directly into the block. Possible enhancements for the future.

Nice work!

Cheers,

Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

mojavelinux
Administrator
In reply to this post by vdmitriev

On Wed, Apr 1, 2015 at 12:55 AM, vdmitriev [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Source code is available on GitHub.
Binaries are (or should be at least) available on Bintray. It's the first time I publish maven artifacts on Bintray, so I may have missed something essential.

You should consider promoting it by adding a link to asciidoctor.org/docs. (for now put it at the bottom of "Integration and Plugins"). Send a pull request and we'll merge it in.

Cheers!

Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

wimalopaan
In reply to this post by mojavelinux
Am 02.04.2015 um 14:59 schrieb mojavelinux [via Asciidoctor :: Discussion]:

>
> On Wed, Apr 1, 2015 at 3:39 PM, wimalopaan [via Asciidoctor ::
> Discussion] <[hidden email]
> </user/SendEmail.jtp?type=node&node=2944&i=0>> wrote:
>
>     Is this available as asciidoctor extension too?
>
>
> Something similar for Ruby can be found here (perhaps more
> primitive) https://github.com/asciidoctor/asciidoctor-extensions-lab/tree/master/lib/tree-block-macro

Oh thank you, very cool!


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

Re: "MonoTree" extension

vdmitriev
In reply to this post by mojavelinux
mojavelinux wrote
You should consider promoting it by adding a link to asciidoctor.org/docs.
(for now put it at the bottom of "Integration and Plugins"). Send a pull
request and we'll merge it in.
Pull request: https://github.com/asciidoctor/asciidoctor.org/pull/372

mojavelinux wrote
Ideally the AsciiDoc source could be handled by different interpreters. One could be to feed it through Asciidoctor Diagram / salt (after some text conversion). Another is to output it as text.

What's important is that we try to find the best way to represent the source document. I like the simplicity of the nested arrows. However, we could also consider supporting nested asterisks. That way, it would render in plain AsciiDoc output (up to the max depth of an AsciiDoc list).
That was something that I had thought of myself! See question 4 here (I used ordered list in the example there by mistake). Maybe you could share some insight on questions 3 and 4 while we are at it?

mojavelinux wrote
Others might like the idea of being about to feed output from the tree command directly into the block.
Could you please elaborate on that? Short example will be most welcome.

~ Regards, Vadim
Reply | Threaded
Open this post in threaded view
|

Re: "MonoTree" extension

mojavelinux
Administrator
On Thu, Apr 9, 2015 at 5:06 PM, vdmitriev [via Asciidoctor :: Discussion] <[hidden email]> wrote:
mojavelinux wrote
You should consider promoting it by adding a link to asciidoctor.org/docs.
(for now put it at the bottom of "Integration and Plugins"). Send a pull
request and we'll merge it in.
Pull request: https://github.com/asciidoctor/asciidoctor.org/pull/372

Excellent!

 


mojavelinux wrote
Ideally the AsciiDoc source could be handled by different interpreters. One could be to feed it through Asciidoctor Diagram / salt (after some text conversion). Another is to output it as text.

What's important is that we try to find the best way to represent the source document. I like the simplicity of the nested arrows. However, we could also consider supporting nested asterisks. That way, it would render in plain AsciiDoc output (up to the max depth of an AsciiDoc list).
That was something that I had thought of myself! See question 4 here (I used ordered list in the example there by mistake). Maybe you could share some insight on questions 3 and 4 while we are at it?

Currently, extensions cannot tie into lists. This is something on the roadmap. But you can wrap the list in an open block and register the block processor on the open block. That way, you can control the parsing (for instance, parse_content_as :raw) and get the raw text in the extension. But it will still look like a regular list when the extension isn't loaded. Sneaky!

[tree]
--
. parent
.. child
.. child
--
 

mojavelinux wrote
Others might like the idea of being about to feed output from the tree command directly into the block.
Could you please elaborate on that? Short example will be most welcome.


Cheers,

-Dan

--