From 85832c1b2513b389ad0cc2ceab23a1b0a3f27ab1 Mon Sep 17 00:00:00 2001 From: Giuseppe Rota Date: Sun, 5 Feb 2012 18:40:58 +0100 Subject: [PATCH] Fix bug in python snipmate conversion script, to avoid skipping every other snippet --- utils/convert_snipmate_snippets.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/convert_snipmate_snippets.py b/utils/convert_snipmate_snippets.py index 2fdef8b..689f58f 100755 --- a/utils/convert_snipmate_snippets.py +++ b/utils/convert_snipmate_snippets.py @@ -48,7 +48,15 @@ def convert_snippet_file(source): # In snippet: Check if indentation level is the same. If not, snippet has ended if line[:len(whitespace)] != whitespace: retval += convert_snippet_contents(snippet) + "endsnippet\n\n" - state = 0 + # Copy-paste the section from state=0 so that we don't skip every other snippet + if line[:8] == "snippet ": + snippet_info = re.match("(\S+)\s*(.*)", line[8:]) + if not snippet_info: + print >> sys.stderr, "Warning: Malformed snippet\n %s\n" % line + continue + retval += 'snippet %s "%s"' % (snippet_info.group(1), snippet_info.group(2) if snippet_info.group(2) else snippet_info.group(1)) + "\n" + state = 1 + snippet = "" else: snippet += line[len(whitespace):] if state == 2: