[TxMt] TM_CURRENT_LINE broken variable content
marios
tmtxpstuff at consking.com
Tue Nov 7 20:28:05 UTC 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Allan Odgaard wrote:
> On 1. Nov 2006, at 18:41, marios wrote:
>
>> I am having trouble with the Dynamic variables, not sure, what is
>> going on.
>> Here are some test-strings of current lines, and the wrong output I get
>> from this variable, instead of the whole string, using the Show
>> TM_VARIABLES command.
>>
>> 1) <li <txp:zem_nth step=1
>> of=2>class="odd"</txp:zem_nth>><txp:linkdesctitle /></li>
>>
>> $TM_CURRENT_LINE echoes: [CSS-bullet] class="odd">
>
> You’re saying that if you paste the above line into a new document,
> place caret on that line, and invoces Show Variables, you only see
> “[CSS-bullet] class="odd">”?
>
>> 2) <txp:if_article_category></txp:if_article_category>
>>
>> ouput: nil
>
> nil? Okay, so this is _not_ using Show Variables, right? Could you paste
> the code that you are using to dump the variable.
>
>> [...] It seems, that any HTML brackets will just strip the content
>> off, from
>> the variables.
>
> HTML output? Yes, if you output something with <…> and have the output
> option as Show as HTML, that part will not be shown.
>
> You can add ‘|pre’ to your command to have things HTML-escaped.
>
Ah, I can see now, what's happening here, probably because output is set
to insert as snippet.
However, the code I am using is here:
echo "$TM_CURRENT_WORD"
#Don't use this command. It is completely broken, some weird things are
going on with TM_CURRENT_LINE and TM_CURRENT_WORD
# Experimental Template Syntax command. However this doesn't make a lot
of sense, since it is not possible to set multiple tag triggers per
commmand.
FILE="${TM_FILENAME/%.*/}"
base="${TM_FILEPATH##/*/}"
type="${base#*.*}"
ext="${type#*.*}"
if [[ $ext = "txfml" ]]
then
echo "\$1$TM_CURRENT_WORD
\$2
$TM_CURRENT_WORD
\$3"
else
exit_insert_snippet "\${1:Warning: Wrong syntax. This tag is only
allowed within a form template.}"
fi
INPUT is selected Text or Line
OUTPUT is insert as snippet
and
SAVE is nothing.
It was an experimental command intended to warn me about illegal tag
insertions and would have been triggered with the return key,
with a scope of text.html.txp meta.tag.container.endbracket
I'll probably ditch this one.
regards , marios
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: This might change in the future
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFUOxV8tSzPOYuZvQRAlXzAJ9vMOBbam/rIuHMz4e8KJVrPTosvQCggJKe
VFmuUi7wxeP6iI7pCCBPdBY=
=xFAZ
-----END PGP SIGNATURE-----
More information about the textmate
mailing list