Re: [code] How to do AsciiDoc Preview?

From: Mitchell <>
Date: Fri, 27 Nov 2015 10:02:44 -0500 (EST)

Hi Russell,

On Thu, 26 Nov 2015, Russell Dickenson wrote:

> 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.

It looks like '&&' is not interpreted correctly, which makes sense, as the
command line string is not passed directly to bash. (Sorry for overlooking
that.) If you don't go the bash-script route, you can do a a two-step
process: put your asciidoc command in `` and
your firefox command in ``. Then perform the
usual "Compile" (Ctrl+Shift+R) and "Run" (Ctrl+R) sequence.

> 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.

You'll need to change `_NAME` in the adoc.lua file to "adoc" (instead of
"markdown"), and then add a file type in your init.lua:

     textadept.file_types.extensions.adoc = 'adoc'

The '.adoc' part is the file extension you want to associate a lexer with,
and the 'adoc' string is the name of the lexer file to use.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Fri 27 Nov 2015 - 10:02:44 EST

This archive was generated by hypermail 2.2.0 : Sat 28 Nov 2015 - 06:50:06 EST