mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Fixed the naming problem
This commit is contained in:
parent
73dc27384c
commit
859ae946da
@ -154,13 +154,26 @@ class TmSnippet
|
|||||||
doc << "# condition: \"#{self.scope}\"\n"
|
doc << "# condition: \"#{self.scope}\"\n"
|
||||||
end
|
end
|
||||||
doc << "# --\n"
|
doc << "# --\n"
|
||||||
@@known_substitutions.each {|level| level.each_pair { |k, v| self.content.gsub!(k,v) }}
|
if self.content
|
||||||
doc << "#{self.content}"
|
@@known_substitutions.each {|level| level.each_pair { |k, v| self.content.gsub!(k,v) }}
|
||||||
|
doc << "#{self.content}"
|
||||||
|
end
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
|
||||||
|
def canonicalize(filename)
|
||||||
|
invalid_char = /[^ a-z_0-9.+=~(){}'"'"'`&#,-]/i
|
||||||
|
|
||||||
|
filename.
|
||||||
|
gsub(invalid_char, ''). # remove invalid characters
|
||||||
|
gsub(/ {2,}/,' '). # squeeze repeated spaces into a single one
|
||||||
|
rstrip # remove trailing whitespaces
|
||||||
end
|
end
|
||||||
|
|
||||||
def yasnippet_file(basedir)
|
def yasnippet_file(basedir)
|
||||||
basedir = File.join(basedir,group) if group
|
# files cannot end with dots (followed by spaces) on windows
|
||||||
File.join(basedir,@file).gsub(/#{File.extname(@file)}$/,".yasnippet")
|
basedir = File.join(basedir,group.gsub(/[.]+ *$/,'')) if group
|
||||||
|
File.join(basedir,canonicalize(@file[0, @file.length-File.extname(@file).length]) + ".yasnippet")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user