Re: [code] How to do AsciiDoc Preview?

From: Russell Dickenson <russelldickenson.att.gmail.com>
Date: Thu, 26 Nov 2015 14:34:05 +1000

Mitchell,

I'm definitely making progress with this preview function.

I added your suggested "Run" command to my init.lua file with a few
minor changes. When I use the key combination Ctrl-R to have the file
converted to HTML and the resulting file loaded in Firefox, Textadept
outputs the following text to a newly-created buffer:

> asciidoctor "bookmarks_work.adoc" -D /tmp/ && firefox "/tmp/bookmarks_work.html"
asciidoctor: FAILED: input file && missing or cannot be read
> exit status: 256

When I enter this command in a (Linux) terminal it works as expected.

I wonder if the 'Run' command is mangling the parameters. Another
approach I'll try is using a BASH script which accepts the file's name
as a parameter.

On the topic of creating a new Lexer for AsciiDoc support, how do I go
about doing this? I coped the Markdown lexer (in the lexers directory)
and renamed it "adoc.lua" but I'm not sure how to have files with
".adoc" extension automatically handled by the AsciiDoc lexer.

-- 
Russell
On 26 November 2015 at 08:12, Russell Dickenson
<russelldickenson.att.gmail.com> wrote:
> Mitchell,
>
> Thank you for being able to make educated guesses in the absence of
> critical information. I really should have explained the situation
> better.
>
> The solution you have provided should work as the AsciiDoc processor
> is a command-line application and I can use a predetermined extension
> for AsciiDoc marked-up files.
>
> I'll try this out and reply with the results soon.
>
>
> --
>
> Russell Dickenson
>
> On 26 November 2015 at 00:14, Mitchell <m.att.foicica.com> wrote:
>> 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.
>>
-- 
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 - 23:34:05 EST

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