[TxMt] About the reStructuredText bundle

Steve Lianoglou lists at arachnedesign.net
Sat Apr 28 22:20:07 UTC 2007


Hi,


> := is "shell-speak". Type "bash" in a plain text document and run  
> ctrl-H, and the man page for the bash shell will pop up. Then  
> search for ":=", and you'll find a list of similar options. The  
> description for this particular one is:
>
> ${parameter:=word}
> Assign Default Values. If parameter is unset or null, the expansion  
> of word is assigned to parameter. The value of param_eter is then  
> substituted. Positional parameters and special parameters may not  
> be assigned to in this way.

Great -- thanks for the bash tutorial!

> So in other words, the above sets the value of TM_RST2HTML to  
> rst2html.py, unless it has already been set. Further, this value is  
> also assigned to the TRST variable. So you could set the value of  
> TM_RST2HTML manually if you want it to be something else.
>
> The original was setting/using the value of the TM_PYTHON variable  
> instead.

So .. I still think this is broken in the bundle.

If I get it correct, then as the current "Validate Syntax" command  
stands, it sets TRST like so:  `TRST=${TM_PYTHON:=rst2html.py}` which  
will set TRST to rst2html.py unless $TM_PYTHON is set.

Being that $TM_PYTHON is meant to be the path to your python  
interpreter, running the command will then use TRST like so: `$TRST  
"$TM_FILEPATH" 1>/dev/null|pre`

That would expand to: `/path/to/python $TM_FILEPATH 1>dev/null | pre`  
which will send your raw reST file to the python interpreter, which  
will then in turn throw some SyntaxError since Python can't parse a  
reST document.

In that context, I guess `/path/to/python rst2html.py $TM_FILEPATH`  
would work, or we can just set TRST to the value used by the other  
commands (TRST=${TM_RST2HTML:=rst2html.py}) which works fine.

>> (2) I feel like the "Convert Document to HTML" command should have  
>> its output set to "Create New Document" instead of replacing the  
>> reST in the file w/ the HTML so you don't blow out the file you've  
>> been working on.
>
> I think this follows the similar command in Markdown. I guess the  
> idea is that you would only want to use this command within a  
> bigger HTML document. i.e. you have an HTML document and want to  
> add something you've written in reST. Then you copy and paste it  
> in, then select it and convert it to HTML (It's rather unfortunate  
> that you have to select it again I guess).

Ahh .. I see. I can see the use for that. I'll just keep my own  
command along side it to output to a new document for when I don't  
want that to happen.

Thanks,
-steve



More information about the textmate mailing list