Re: [code] How to do AsciiDoc Preview?

From: Mitchell <m.att.foicica.com>
Date: Wed, 25 Nov 2015 09:14:30 -0500 (EST)

Hi Russell,

On Wed, 25 Nov 2015, Russell Dickenson wrote:

> In my work of writing documentation, the AsciiDoc markup is one I use
> often. Editors such as Brackets and Atom have plugins available which
> provide live preview of content marked up in AsciiDoc.
>
> There are both Python and Ruby processors available for AsciiDoc and I
> would to activate them from within Textadept. I thought the
> ta-markdown module might provide inspiration and it does for handling
> the markup, but not for launching a markup processor.
>
> How could I go about doing this? For those who don't know me, I am
> what's known as "code challenged", otherwise known as "utterly
> clueless when it comes to coding".

I don't know anything about asciidoc or processors for it, so I can only
offer general advice.

If you know the command to use to turn an asciidoc file into markup (let's
say it's called "asciidoc"), and you have a consistent file extention
(".ad"? I'm grasping at straws here...), and you know the output filename
format (I assume ".html"), then you can use something like this in your
~/.textadept/init.lua:

     textadept.run.run_commands['ad'] = 'asciidoc "%f" && firefox "%e.html"'

This will markup and display the current asciidoc file when you press
Ctrl+R (or use the 'Tools > Run' menu item).

The ['ad'] part contains the asciidoc file extension. 'asciidoc' is the
command that transforms asciidoc into markup. 'firefox' is the command to
visualize the produced markup. '%f' is the full name of the asciidoc file.
'%e' is the name of the asciidoc file without extension. This obviously
assumes the asciidoc transformer outputs a file of the same name, but with
a different extension (e.g. "foo.ad" -> "foo.html").

I hope this helps somewhat.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 25 Nov 2015 - 09:14:30 EST

This archive was generated by hypermail 2.2.0 : Thu 26 Nov 2015 - 06:29:17 EST