xbel
Introduces XBEL decorators for Nokogiri.
Features
- generates IDs for bookmarks and folders
- decorates a Nokogiri::XML::Node, all Nokogiri methods are available
- Ruby 1.8 and 1.9 compatible
Installation
gem install xbel
Using
require 'rubygems'
require 'xbel'
Reading
XBEL.open('test/wikipedia.xbel')[:test_1_1].bookmarks.
map do |bookmark|
link_to bookmark.title, bookmark.href
end
Note: See http://github.com/boof/habel to read *.haml into XBEL...
Writing
xbel = XBEL.new
xbel.build_folder 'XBEL' do |folder|
bm = folder.build_bookmark "boof's xbel", 'http://github.com/boof/xbel'
# nodes receive IDs and can be accessed via the :[] method
bm == xbel[bm.id]
end
File.open('my.xbel', 'w') { |file| file << xbel }
Note: You can use all Nokogiri::XML::Node methods.
Patches/Pull Requests:
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with rakefile, version, or history.
- Send me a pull request.
Copyright
Copyright (c) 2009-2010 Florian Aßmann. See LICENSE for details.