When I want to use the Markdown --> Headings --> Level 1 [setext] / Level 2 [setext] commands, I get the error message "/tmp/temp_textmate.qXjdGq:11: undefined method `rstrip' for nil:NilClass (NoMethodError)".
Textmate is Version 1.5.8 (1505) on Leopard 10.5.7 with the stock ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]. I updated Markdown.tmbundle to r11632 and Support to r11693 but it didn't help.
Any idea what is going wrong here?
The Code of the Headings Command is:
#!/usr/bin/env ruby -wKU
require 'jcode'
# Split document into lines. Get current line number minus one for # previous, minus another for ruby being 0 based. lines = STDIN.readlines line = ENV['TM_LINE_NUMBER'].to_i - 2
# Get length of previous line, using jlength for unicode length = lines[line].rstrip.jlength
# Print same number of = length.times { print "=" }
Regards, Sebastian R.
On Sat, Jul 18, 2009 at 11:22, Sebastian Rödersebroeder@gmail.com wrote:
When I want to use the Markdown --> Headings --> Level 1 [setext] / Level 2 [setext] commands, I get the error message "/tmp/temp_textmate.qXjdGq:11: undefined method `rstrip' for nil:NilClass (NoMethodError)".
Textmate is Version 1.5.8 (1505) on Leopard 10.5.7 with the stock ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]. I updated Markdown.tmbundle to r11632 and Support to r11693 but it didn't help.
Any idea what is going wrong here?
Are you using the commands while your cursor is on the first line?
Setext-style headers are of the form
This is a heading =================
and the commands calculate the amount of symbols to write from the length of the actual heading. So to use the commands, write your heading, move to the next line and invoke the command.
The error message could, of course, use improvement :-)
HTH Martin
On 18 Jul 2009, at 12:09, Martin Kühl wrote:
[…] Any idea what is going wrong here?
Are you using the commands while your cursor is on the first line?
Setext-style headers are of the form
This is a heading
and the commands calculate the amount of symbols to write from the length of the actual heading. So to use the commands, write your heading, move to the next line and invoke the command.
The error message could, of course, use improvement :-)
Yeah, I’ll update it.
Just to add though: The intended use of the commands is to press return after your heading, then type either a ‘-’ or ‘=’ (depending on style of desired heading) and follow that with a press of the tab key — they are not designed to be invoked via the menu / ⌃⌘T (not that there are anything wrong with that, just a lot more tedious, and why we didn’t consider them being invoked with caret on first line of document).