A TextMate snippet (.tmSnippet) usually looks something like this, whereas some key/string-pairs are optional and can be at any position.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>${1:the actual snippet}</string>
<key>tabTrigger</key>
<string>my_trigger</string>
<key>name</key>
<string>This is my Snippet's name</string>
<key>scope</key>
<string>source.js</string>
<key>uuid</key>
<string>6C2985F1-9BB8-43D7-A85C-1006B2932A0D</string>
</dict>
</plist>
I'm trying to parse this using Nokogiri, but since the tags are all <key>
and <string>
and the position of each key/string-pair can alter, I'm not sure how to do that. I'm after the scope
, the tabTrigger
, content
and name
.