Permalink
Browse files

Introducing a pair of snippets for XML parsing and XPath queries.

git-svn-id: http://macromates.com/svn/Bundles/trunk/Bundles/Ruby.tmbundle@8458 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent f521db0 commit 7ba0db4e1dbc73f6c9429d24be968002e592f860 JEG2 committed Nov 15, 2007
Showing with 92 additions and 1 deletion.
  1. +51 −0 Macros/xmlread(__).tmMacro
  2. +16 −0 Snippets/xmlread(__).tmSnippet
  3. +18 −0 Snippets/xpath(__) { __ }.tmSnippet
  4. +7 −1 info.plist
View
51 Macros/xmlread(__).tmMacro
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>commands</key>
+ <array>
+ <dict>
+ <key>command</key>
+ <string>moveToBeginningOfDocumentAndModifySelection:</string>
+ </dict>
+ <dict>
+ <key>argument</key>
+ <dict>
+ <key>command</key>
+ <string>insert_requires.rb rexml/document</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ </dict>
+ <key>command</key>
+ <string>executeCommandWithOptions:</string>
+ </dict>
+ <dict>
+ <key>argument</key>
+ <dict>
+ <key>content</key>
+ <string>REXML::Document.new(File.read(${1:"${2:path/to/file}"}))</string>
+ <key>name</key>
+ <string>xmlread(..)</string>
+ <key>scope</key>
+ <string>source.ruby</string>
+ <key>tabTrigger</key>
+ <string>xml-</string>
+ <key>uuid</key>
+ <string>B904D4AA-D15D-48A4-8EB2-563BAF489332</string>
+ </dict>
+ <key>command</key>
+ <string>insertSnippetWithOptions:</string>
+ </dict>
+ </array>
+ <key>name</key>
+ <string>xmlread(..)</string>
+ <key>scope</key>
+ <string>source.ruby</string>
+ <key>tabTrigger</key>
+ <string>xml</string>
+ <key>uuid</key>
+ <string>F6BF907E-FDF7-4D9B-9E57-BE159561349D</string>
+</dict>
+</plist>
View
16 Snippets/xmlread(__).tmSnippet
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>REXML::Document.new(File.read(${1:"${2:path/to/file}"}))</string>
+ <key>name</key>
+ <string>xmlread(..)</string>
+ <key>scope</key>
+ <string>source.ruby</string>
+ <key>tabTrigger</key>
+ <string>xml-</string>
+ <key>uuid</key>
+ <string>B904D4AA-D15D-48A4-8EB2-563BAF489332</string>
+</dict>
+</plist>
View
18 Snippets/xpath(__) { __ }.tmSnippet
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>elements.each(${1:"${2://XPath}"}) do |${3:node}|
+ $0
+end</string>
+ <key>name</key>
+ <string>xpath(..) { .. }</string>
+ <key>scope</key>
+ <string>source.ruby</string>
+ <key>tabTrigger</key>
+ <string>xpa</string>
+ <key>uuid</key>
+ <string>CC300D44-6C3F-4F6C-A8AB-86F5A2DC57CF</string>
+</dict>
+</plist>
View
8 info.plist
@@ -159,6 +159,10 @@
<string>3BA6762A-BB6B-489E-8006-F30F386AEF48</string>
<string>2C07D4E7-D74F-4AE4-82BE-B0BA82247AFA</string>
<string>8343ACF4-EEB7-44B5-B835-94826466D4D5</string>
+ <string>------------------------------------</string>
+ <string>F6BF907E-FDF7-4D9B-9E57-BE159561349D</string>
+ <string>B904D4AA-D15D-48A4-8EB2-563BAF489332</string>
+ <string>CC300D44-6C3F-4F6C-A8AB-86F5A2DC57CF</string>
</array>
<key>name</key>
<string>Serialization</string>
@@ -433,6 +437,7 @@
<string>5AE7CFB4-418E-4E00-AD76-06DB755EE876</string>
<string>9460392B-C036-4A76-A5AE-1191F10E4B1B</string>
<string>2C07D4E7-D74F-4AE4-82BE-B0BA82247AFA</string>
+ <string>F6BF907E-FDF7-4D9B-9E57-BE159561349D</string>
<string>E5158F94-CC52-4424-A495-14EF9272653F</string>
<string>A83F68A9-F751-4BB4-AE16-56812878C16A</string>
<string>05984208-D559-4C04-A69C-2019361A985A</string>
@@ -564,6 +569,8 @@
<string>46BF99AD-E172-4D49-BCF7-072F4730E1D9</string>
<string>3BA6762A-BB6B-489E-8006-F30F386AEF48</string>
<string>8343ACF4-EEB7-44B5-B835-94826466D4D5</string>
+ <string>B904D4AA-D15D-48A4-8EB2-563BAF489332</string>
+ <string>CC300D44-6C3F-4F6C-A8AB-86F5A2DC57CF</string>
<string>2DBEE50B-3097-4A57-AB48-3586CF392D8B</string>
<string>0BA2B2F1-E767-4A03-9791-0AC0183251F1</string>
<string>A4E89D97-D5ED-48BB-B5FF-1BFB79211FCD</string>
@@ -577,7 +584,6 @@
<string>6D75102B-6E51-4360-8F12-BE12327B6AE6</string>
<string>AEDD6A5F-417F-4177-8589-B07518ACA9DE</string>
<string>1A7701FA-D866-498C-AD4C-7846538DB535</string>
- <string>6903A8A1-5B7C-440D-9658-BD84ED08EE45</string>
</array>
<key>uuid</key>
<string>467B298F-6227-11D9-BFB1-000D93589AF6</string>

0 comments on commit 7ba0db4

Please sign in to comment.