habl 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Florian Aßmann
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ # Habl
2
+
3
+ Shorten your XBEL by writing markup haiku.
4
+
5
+ This library simply renders markup haikus to xml before parsing it with XBEL.
6
+
7
+ ## Example
8
+
9
+ !!! XML utf-8
10
+
11
+ %xbel(version="1.0" id="de")
12
+ %title Deutsche Navigation
13
+
14
+ %folder
15
+ %title monkey-patch.me
16
+
17
+ %bookmark(href="http://www.monkey-patch.me")
18
+ %title monkey-patch.me
19
+
20
+
21
+ ## Install / Usage
22
+
23
+ $ gem install habl
24
+
25
+ This library depends on [xbel.gem](http://rubygems.org/gems/xbel) and
26
+ [haml.gem](http://rubygems.org/gems/haml).
27
+
28
+ $ irb
29
+ >> require 'habl'
30
+ >> xbel = Habl.open 'bookmarks.xbel.haml'
31
+
32
+ Learn more about [Haml](http://haml-lang.com/) and
33
+ [XML Bookmark Exchange Language](http://pyxml.sourceforge.net/topics/xbel/).
34
+
35
+ ## Note on Patches/Pull Requests
36
+
37
+ * Fork Habl.
38
+ * Make your feature addition or bug fix.
39
+ * Add tests for it. This is important so I don't break it in a future version
40
+ unintentionally.
41
+ * Commit, do not mess with rakefile, version, or history (if you want to have
42
+ your own version, that is fine but bump version in a commit by itself I can
43
+ ignore when I pull).
44
+ * Send me a pull request. Bonus points for topic branches.
45
+
46
+ ## Copyright
47
+
48
+ Copyright (c) 2010 Florian Aßmann. See LICENSE for details.
@@ -0,0 +1,58 @@
1
+ #Encoding: UTF-8
2
+ require 'rubygems'
3
+ require 'rake'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "habl"
9
+ gem.summary = %Q{Shorten your XBEL by writing markup haiku.}
10
+ gem.description = %Q{This library simply renders markup haikus to xml
11
+ before parsing it with XBEL. See http://github.com/boof/xbel and
12
+ http://en.wikipedia.org/wiki/XBEL for more information about XBEL and
13
+ http://haml-lang.com/ for Haml.}
14
+ gem.email = "florian.assmann@email.de"
15
+ gem.homepage = "http://github.com/boof/habl"
16
+ gem.authors = ["Florian Aßmann"]
17
+ gem.add_dependency "xbel", ">= 0.2.6"
18
+ gem.add_dependency "haml", ">= 2.2.23"
19
+ gem.add_development_dependency "riot", ">= 0"
20
+ gem.add_development_dependency "yard", ">= 0"
21
+ end
22
+ Jeweler::GemcutterTasks.new
23
+ rescue LoadError
24
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
25
+ end
26
+
27
+ require 'rake/testtask'
28
+ Rake::TestTask.new(:test) do |test|
29
+ test.libs << 'lib' << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = true
32
+ end
33
+
34
+ begin
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/*_test.rb'
39
+ test.verbose = true
40
+ end
41
+ rescue LoadError
42
+ task :rcov do
43
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
44
+ end
45
+ end
46
+
47
+ task :test => :check_dependencies
48
+
49
+ task :default => :test
50
+
51
+ begin
52
+ require 'yard'
53
+ YARD::Rake::YardocTask.new
54
+ rescue LoadError
55
+ task :yardoc do
56
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
57
+ end
58
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{habl}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Florian Aßmann"]
12
+ s.date = %q{2010-04-15}
13
+ s.description = %q{This library simply renders markup haikus to xml
14
+ before parsing it with XBEL. See http://github.com/boof/xbel and
15
+ http://en.wikipedia.org/wiki/XBEL for more information about XBEL and
16
+ http://haml-lang.com/ for Haml.}
17
+ s.email = %q{florian.assmann@email.de}
18
+ s.extra_rdoc_files = [
19
+ "LICENSE",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ ".document",
24
+ ".gitignore",
25
+ "LICENSE",
26
+ "README.md",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "habl.gemspec",
30
+ "lib/habl.rb",
31
+ "test/fixture.xbel.haml",
32
+ "test/habel_test.rb",
33
+ "test/teststrap.rb"
34
+ ]
35
+ s.homepage = %q{http://github.com/boof/habl}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.3.6}
39
+ s.summary = %q{Shorten your XBEL by writing markup haiku.}
40
+ s.test_files = [
41
+ "test/habel_test.rb",
42
+ "test/teststrap.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<xbel>, [">= 0.2.6"])
51
+ s.add_runtime_dependency(%q<haml>, [">= 2.2.23"])
52
+ s.add_development_dependency(%q<riot>, [">= 0"])
53
+ s.add_development_dependency(%q<yard>, [">= 0"])
54
+ else
55
+ s.add_dependency(%q<xbel>, [">= 0.2.6"])
56
+ s.add_dependency(%q<haml>, [">= 2.2.23"])
57
+ s.add_dependency(%q<riot>, [">= 0"])
58
+ s.add_dependency(%q<yard>, [">= 0"])
59
+ end
60
+ else
61
+ s.add_dependency(%q<xbel>, [">= 0.2.6"])
62
+ s.add_dependency(%q<haml>, [">= 2.2.23"])
63
+ s.add_dependency(%q<riot>, [">= 0"])
64
+ s.add_dependency(%q<yard>, [">= 0"])
65
+ end
66
+ end
67
+
@@ -0,0 +1,22 @@
1
+ require 'haml'
2
+ require 'xbel'
3
+
4
+ module Habl
5
+ INTRO = '<?xml version="1.0" encoding="utf-8" ?>' + $/
6
+ DOCTYPE = '<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">' + $/
7
+ OPTIONS = { :attr_wrapper => '"', :ugly => true, :autoclose => [], :preserve => [] }
8
+
9
+ def open(path)
10
+ engine = Haml::Engine.new File.read(path), OPTIONS
11
+ xml = engine.render
12
+
13
+ unless xml.include? 'DOCTYPE xbel'
14
+ offset = xml.index(INTRO) + INTRO.length
15
+ xml.insert offset, DOCTYPE
16
+ end
17
+
18
+ XBEL.parse xml
19
+ end
20
+ module_function :open
21
+
22
+ end
@@ -0,0 +1,10 @@
1
+ !!! XML utf-8
2
+
3
+ %xbel(version="1.0" id="de")
4
+ %title Deutsche Navigation
5
+
6
+ %folder
7
+ %title monkey-patch.me
8
+
9
+ %bookmark(href="http://www.monkey-patch.me")
10
+ %title monkey-patch.me
@@ -0,0 +1,16 @@
1
+ require 'teststrap'
2
+
3
+ context "habl" do
4
+ setup do
5
+ dirname = Pathname File.dirname(__FILE__)
6
+ dirname.join 'fixture.xbel.haml'
7
+ end
8
+ asserts("HAML => XBEL") { XBEL === Habl::open(topic) }
9
+
10
+ context "XBEL" do
11
+ setup { Habl::open(topic) }
12
+ asserts("title of first folder") { topic.root.folders.first.title }.
13
+ equals "monkey-patch.me"
14
+ end
15
+
16
+ end
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'riot'
3
+ require 'habl'
4
+ require 'pathname'
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: habl
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - "Florian A\xC3\x9Fmann"
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-15 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: xbel
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 2
30
+ - 6
31
+ version: 0.2.6
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: haml
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 2
44
+ - 23
45
+ version: 2.2.23
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: riot
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id003
60
+ - !ruby/object:Gem::Dependency
61
+ name: yard
62
+ prerelease: false
63
+ requirement: &id004 !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ type: :development
71
+ version_requirements: *id004
72
+ description: |-
73
+ This library simply renders markup haikus to xml
74
+ before parsing it with XBEL. See http://github.com/boof/xbel and
75
+ http://en.wikipedia.org/wiki/XBEL for more information about XBEL and
76
+ http://haml-lang.com/ for Haml.
77
+ email: florian.assmann@email.de
78
+ executables: []
79
+
80
+ extensions: []
81
+
82
+ extra_rdoc_files:
83
+ - LICENSE
84
+ - README.md
85
+ files:
86
+ - .document
87
+ - .gitignore
88
+ - LICENSE
89
+ - README.md
90
+ - Rakefile
91
+ - VERSION
92
+ - habl.gemspec
93
+ - lib/habl.rb
94
+ - test/fixture.xbel.haml
95
+ - test/habel_test.rb
96
+ - test/teststrap.rb
97
+ has_rdoc: true
98
+ homepage: http://github.com/boof/habl
99
+ licenses: []
100
+
101
+ post_install_message:
102
+ rdoc_options:
103
+ - --charset=UTF-8
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ requirements: []
121
+
122
+ rubyforge_project:
123
+ rubygems_version: 1.3.6
124
+ signing_key:
125
+ specification_version: 3
126
+ summary: Shorten your XBEL by writing markup haiku.
127
+ test_files:
128
+ - test/habel_test.rb
129
+ - test/teststrap.rb