[code] Problem with snippets

From: Russell Dickenson <russelldickenson.att.gmail.com>
Date: Tue, 13 Oct 2015 08:51:26 +1000

I am again trying Textadept for about the 10th time. Rest assured the
problem is with my brain, not Textadept.

As I write documentation in DocBook XML format, an extremely "wordy"
and highly-structured format, I am keen to establish a set of
snippets. I created one which went well, but am having trouble with a
more advanced one.

The following [1] is the content of textadept-snippets.lua which I am
calling from init.lua. When I type "para" and press [Tab] I get the
expected result, which is the text at [2] inserted and the caret at
'_'. When I type "varlist" and press [Enter] I get the text at [3]. My
issues are that (1) I don't understand if the "/" symbol is causing
the issue and if so, why, (2) Textadept happily outputs the error text
into the document. Anyone less Eagle-eyed might miss the fact that
unwanted text had been inserted.

Example [1]
snippets.xml = {
  ['para'] = '<para>\n\t%1\n</para>',
  ['literal'] = '<literal>%1</literal>',
  ['varlist'] =
'<variablelist>\n<title>%1</title>\n<varlistentry>\n\t<term>\n\t<filename>\n%2</filename>\n</term>\n<listitem>\n<para>\n%3</para>\n</listitem>\n</varlistentry>\n</variablelist>\n'
}

Example [2]
<para>
  _
</para>

Example [3]
<variablelist>
<title>[string "return /title"]:1: unexpected symbol near '/'
<varlistentry>
  <term>
  <filename>
[string "return /filename"]:1: unexpected symbol near '/'
</term>
<listitem>
<para>
[string "return /para"]:1: unexpected symbol near '/'
</listitem>
</varlistentry>
</variablelist>

-- 
Russell Dickenson
-- 
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 Mon 12 Oct 2015 - 18:51:26 EDT

This archive was generated by hypermail 2.2.0 : Tue 13 Oct 2015 - 06:46:32 EDT