[txmt-dev] Re: GEDCOM bundle
Rob Burrowes
r.burrowes at auckland.ac.nz
Tue Jan 15 00:22:31 UTC 2013
Amiel,
I'll have to figure out how to upload it to Textmate then. I've never
done it before.
Meantime, you could use the bundle editor and paste in what I did.
Under the Bundles menu, select "Show Bundle Editor", which gives you the
bundle editor window.
Click on + (bottom left) and select "New Bundle" and name it Ged
With Ged selected, click on + again and select "New Language" and name
it Ged. You will get a default script in the edit part of the window.
Select all that script text and delete it.
Then paste in the script below. When you click back on the main Ged
entry, it should start working.
{ scopeName = 'source.ged';
firstLineMatch = '0 HEAD';
fileTypes = ( 'ged' );
patterns = (
{ name = 'keyword.control.ruby';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '\b(INDI|FAM|SOUR|NOTE|REPO|HEAD|TRLR|OBJE)\b$';
},
{ name = 'keyword.block.ruby';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '^0';
},
{ name = 'comment.xref.ged';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '^1 \b(FAMC|FAMS)\b';
},
{ name = 'entity.control.ged';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '^1 [A-Z]+(?![?!])';
},
{ name = 'string.control.ged';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '^2 [A-Z]+(?![?!])';
},
{ name = 'constant.control.ged';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '^3 [A-Z]+(?![?!])';
},
{ name = 'support.control.ged';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '^4 [A-Z]+(?![?!])';
},
{ name = 'storage.control.ged';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '^[5-9] [A-Z]+(?![?!])';
},
{ name = 'variable.xref.ged';
comment = "everything being a reserved word, not a value
and needing a 'end' is a..";
match = '@.*@';
},
);
}
Click on + again, and select "New Command" and name it validate.
In the "Activation" "Key Equivalent" text box (bottom right hand side)
add control shift V (standard for validation).
Select all the text in the Script Editor, and delete it, then paste in
the script below.
You will need to do an "sudo gem install gedcom" and "sudo gem install
VersionCheck" in a terminal window.
With a GEDCOM file open, you can type control shift V, and you should
get a new text window with the results of the GEDCOM parsers test of the
GEDCOM file.
#!/usr/bin/env ruby
# just to remind you of some useful environment variables
# see Help / Environment Variables for the full list
#echo File: "$TM_FILEPATH"
#echo Word: "$TM_CURRENT_WORD"
#echo Selection: "$TM_SELECTED_TEXT"
#
#sudo gem install VersionCheck
#sudo gem install gedcom
#
require 'rubygems'
require 'gedcom'
require 'versioncheck'
file = ENV["TM_FILEPATH"]
puts "###########################################"
puts "Gedcom opening #{file}"
puts "###########################################"
if VersionCheck.rubyversion.have_at_least_version?(1,9)
g = Gedcom.file("#{file}", "r:ASCII-8BIT") #OK with LF line endings.
else
g = Gedcom.file("#{file}", "r") #OK with LF line endings.
end
puts
puts "###########################################"
puts "Gedcom Consistency test"
puts "###########################################"
g.transmissions[0].self_check
puts
puts "###########################################"
puts "Gedcom Summary"
puts "###########################################"
g.transmissions[0].summary
On 15/01/13 10:01 AM, Amiel Martin wrote:
> Hi Rob,
>
> I'd be interested in your GEDCOM bundle and gem...
>
> -Amiel
>
> -Amiel
> http://carnesmedia.com
>
>
> On Sat, Jan 5, 2013 at 3:38 PM, Rob Burrowes
> <r.burrowes at auckland.ac.nz <mailto:r.burrowes at auckland.ac.nz>> wrote:
>
> I have been working with a lot of GEDCOM files lately, so
> yesterday i created a simple bundle to color the keywords (GEDCOM
> is a text database format for genealogy data). If anyone is
> interested, I can make it available to others.
>
> I had previously written a GEDCOM parser in ruby, and this is
> available as a Ruby Gem. The validation script requires the gem to
> be installed.
>
> --
> Rob Burrowes Ph: +64 9 923 2308
> <tel:%2B64%209%20923%202308> (Internal 82308)
> Research Data Services Cell: +64 27 4731856
> <tel:%2B64%2027%204731856> (internal 64209)
> Technical Lead
> Centre for eResearch
> The University of Auckland
> Private Bag 92019 http://www.sit.auckland.ac.nz/~rob
> <http://www.sit.auckland.ac.nz/%7Erob>
> Auckland Mail Centre http://www.burrowes.org/
> Auckland 1142 http://www.wikarekare.org/
> NEW ZEALAND
>
> _______________________________________________
> textmate-dev mailing list
> textmate-dev at lists.macromates.com
> <mailto:textmate-dev at lists.macromates.com>
> http://lists.macromates.com/listinfo/textmate-dev
>
>
>
>
> _______________________________________________
> textmate-dev mailing list
> textmate-dev at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate-dev
--
Rob Burrowes Ph: +64 9 923 2308 (Internal 82308)
Research Data Services Cell: +64 27 4731856 (internal 64209)
Technical Lead
Centre for eResearch
The University of Auckland
Private Bag 92019 http://www.sit.auckland.ac.nz/~rob
Auckland Mail Centre http://www.burrowes.org/
Auckland 1142 http://www.wikarekare.org/
NEW ZEALAND
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20130115/742294a8/attachment.html>
More information about the textmate-dev
mailing list