nkh / Asciio-2.0

1 stars 0 forks source link

Command-line interface #15

Closed jimcheetham closed 1 year ago

jimcheetham commented 8 years ago

Integration with external tools is often by means of a text file, and it would be nice to be able to automate the generation of a diagram, from the ASCIIO format original directly to the end formats.

So a command-line option to read an ASCIIO input file, and automatically export the text rendering, would be a very useful thing to have

nkh commented 8 years ago

Hi,

I read multiple requirements here, I find them interesting but I don't understand them 100%, could you please help clarify?

Integration with external tools is often by means of a text file

Able to automate the generation of a diagram, from the ASCIIO format original directly to the end formats.

So a command-line option to read an ASCIIO input file, and automatically export the text rendering, would be a very useful thing to have

jimcheetham commented 8 years ago

I'm using v 1.02.71-1.1 from Ubuntu 16.04.1, and I don't recognise the "asciio_to_text command". Perhaps my version is too old.

The external tools I am talking about are things like asciitosvg, ditaa, and so on. They take plain text as an input, not an asciio save file.

My usual workflow: 1 * Edit a diagram in asciio 2 * Save it (file.asciio) 3 * Save as (file.txt) 4 * Run a2s (asciitosvg) on file.txt to produce file.svg 5 * Run a2x (asciidoc) on my main documentation file to produce PDF, HTML, text documents

Steps 4 and 5 are automatic (from a Makefile), based on detecting a new version of the .txt input file. I can also detect when the asciio file is written, but my Makefile does not know how to create the .txt version.

So, if you have an "asciio_to_text" external command already, that will be enough. That way I can remove step 3 completely, and my documentation will auto-update when I save the asciio file :-)

-jim

nkh commented 8 years ago

I you help me a bit with details about your installation, we may be able to get asciio_to_text to run on your machine. First thing is to head to download this https://github.com/nkh/P5-App-Asciio/blob/master/script/asciio_to_text, cmod +x it, run and tell me what errors it gives you.

I am in contact with the author of a2s, I hope for a tighter integration in the future.

jimcheetham commented 8 years ago

It cannot open an X display, because that shell doesn't have any DISPLAY (and I don't want it to have one).

$ asciio_to_text Gtk-WARNING **: cannot open display: at /usr/lib/x86_64-linux-gnu/perl5/5.22/Gtk2.pm line 126.

-jim

nkh commented 8 years ago

We're out of luck then, at least for a short time. Xvfb might be a solution, but there's still the need of GTk libs.

Asciio should not need any thing graphical if no user interaction is needed. The problem is that asciio_to text is using asciio, the appllication, not the libraries.

I'll fix this for you, if you don't hear from me in the coming days, ping me.

N.

On Mon, Oct 31, 2016 at 8:47 AM, Jim Cheetham notifications@github.com wrote:

It cannot open an X display, because that shell doesn't have any DISPLAY (and I don't want it to have one).

$ asciio_to_text Gtk-WARNING **: cannot open display: at /usr/lib/x86_64-linux-gnu/perl5/5.22/Gtk2.pm line 126.

-jim

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nkh/Asciio-2.0/issues/15#issuecomment-257231626, or mute the thread https://github.com/notifications/unsubscribe-auth/AACxYa443O1VtVjr8axawatWD9LtOpfEks5q5Z0cgaJpZM4KkomG .

jimcheetham commented 8 years ago

It is OK to leave this as a v2 issue, I think :-)

nkh commented 8 years ago

If the work with Devon goes forward, you may get a "save to SVG" much sooner than v2.

Actually, we can automate you case without Devon's help! Can you locate where " /setup/import_export/ascii.pl" is installed?

N

On Mon, Oct 31, 2016 at 9:37 AM, Jim Cheetham notifications@github.com wrote:

It is OK to leave this as a v2 issue, I think :-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nkh/Asciio-2.0/issues/15#issuecomment-257239289, or mute the thread https://github.com/notifications/unsubscribe-auth/AACxYUz_DtXxe5lSoLZh_Vsh-dSkgTJkks5q5ajAgaJpZM4KkomG .

jimcheetham commented 8 years ago

/usr/share/perl5/App/Asciio/setup/import_export/ascii.pl

nkh commented 8 years ago

Chmod that file so you cn write in it

Now come the difficult decision, "leave it there and be happy forever or fix it properly in 3 mn?"

Fix it !

N.

On Mon, Oct 31, 2016 at 9:45 AM, Jim Cheetham notifications@github.com wrote:

/usr/share/perl5/App/Asciio/setup/import_export/ascii.pl

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nkh/Asciio-2.0/issues/15#issuecomment-257240624, or mute the thread https://github.com/notifications/unsubscribe-auth/AACxYSggV3_H5gHLoV9Y4N2-2T6SkcSLks5q5aqjgaJpZM4KkomG .

jimcheetham commented 8 years ago

Well yes, except of course you shouldn't be calling the system() function with unquoted data like that - something as simple as a space in a filename can spell disaster. But the system call could be correctly quoted easily enough.

Having a hook would be more flexible - allow users to provide their own executable/external script to be called, via a fixed-name command. Something like ~/.asciio/hooks/on-save for example.

I just want a txt file saved whenever I save the asciio file - I'm sure other people will want the SVG as well, but I already have a bigger workflow to integrate with (using https://github.com/cortesi/modd to drive it all)

On Mon, Oct 31, 2016 at 10:26 PM, Nadim Khemir notifications@github.com wrote:

Chmod that file so you cn write in it

  • locate the line that starts with "write_file($file,"
  • there may be commented lines under, just delete them
  • add the following line: system "echo $file >> $file.svg" ;
  • fire asciio and save a .txt file. You should have a file.txt.svg where you saved you .txt file.
  • replace echo in the command above by whatever you use to generate the svg
  • test/enjoy
  • make a backup copy, next version will install over it.

Now come the difficult decision, "leave it there and be happy forever or fix it properly in 3 mn?"

Fix it !

  • Copy your modified export_ascii to export_svg and register it at the top of the file
  • Remove the modification you made to export_ascii if you do not want a SVG to be generated when you generate a txt file
  • Do you want the svg generated when you save the .asciio file too?

N.

On Mon, Oct 31, 2016 at 9:45 AM, Jim Cheetham notifications@github.com wrote:

/usr/share/perl5/App/Asciio/setup/import_export/ascii.pl

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nkh/Asciio-2.0/issues/15#issuecomment-257240624, or mute the thread https://github.com/notifications/unsubscribe- auth/AACxYSggV3_H5gHLoV9Y4N2-2T6SkcSLks5q5aqjgaJpZM4KkomG

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nkh/Asciio-2.0/issues/15#issuecomment-257248176, or mute the thread https://github.com/notifications/unsubscribe-auth/AAd7i5vn6VvA5fdPs8uzuvLJy3p8jQdHks5q5bRggaJpZM4KkomG .

nkh commented 1 year ago

saving to svg, via goat, is implemented in ascio 1.7