Hi,
Two things tripped me up just now using the reST bundle:
(1) I'm not sure if it's broken or not, but the Validate Syntax command didn't work for me as it stands, and it's the first line that's tripping it up for me: `TRST=${TM_PYTHON:=rst2html.py}`
I found that most of the rest commands used `TRST=$ {TM_RST2HTML:=rst2html.py}` and when I switched it in for that, it seems to be working.
Just out of curiousity, where/how is this $TM_RST2HTML environment variable getting set, anyway (and what's `:=`)?
(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.
Thanks, -steve
On Apr 28, 2007, at 2:32 PM, Steve Lianoglou wrote:
Hi,
Two things tripped me up just now using the reST bundle:
(1) I'm not sure if it's broken or not, but the Validate Syntax command didn't work for me as it stands, and it's the first line that's tripping it up for me: `TRST=${TM_PYTHON:=rst2html.py}`
I found that most of the rest commands used `TRST=$ {TM_RST2HTML:=rst2html.py}` and when I switched it in for that, it seems to be working.
Just out of curiousity, where/how is this $TM_RST2HTML environment variable getting set, anyway (and what's `:=`)?
:= 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.
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.
(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).
Thanks, -steve
Haris Skiadas Department of Mathematics and Computer Science Hanover College
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
On 29. Apr 2007, at 00:20, Steve Lianoglou wrote:
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.
Yes, this is clearly wrong. I checked in a fix.
(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.
Yeah, we had a thread about the issue for Markdown [1]. I think the in-place conversion makes sense, but definitely not everyone does. For now people will just have to locally change the output to “New Window” :)
[1] http://lists.macromates.com/pipermail/textmate/2007-April/ 018735.html