libc-tidy_ffi 0.0.2 → 0.0.3
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.
- data/CHANGELOG +1 -0
- data/README +9 -3
- data/Rakefile +1 -0
- data/lib/tidy_ffi/interface.rb +4 -0
- data/lib/tidy_ffi/tidy.rb +14 -1
- data/test/test_simple.rb +11 -2
- data/tidy_ffi.gemspec +3 -3
- metadata +3 -3
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
= Tidy FFI
|
2
2
|
|
3
|
-
==
|
3
|
+
== What is it all about?
|
4
4
|
|
5
5
|
I wanna clean and simple tidy library. For example:
|
6
6
|
TidyFFI::Tidy.new('a string').clean
|
7
7
|
|
8
|
-
For now it can't do anything else than clean :)
|
8
|
+
For now it can't do anything else than clean (and saves errors from it) :)
|
9
9
|
|
10
10
|
== Options
|
11
11
|
|
@@ -20,4 +20,10 @@ You can use different ways to set up options. These examples are produces the sa
|
|
20
20
|
tidy.options.show_body_only = true
|
21
21
|
tidy.clean
|
22
22
|
|
23
|
-
|
23
|
+
TidyFFI::Tidy.new('test', :show_body_only => true).clean
|
24
|
+
|
25
|
+
== Links
|
26
|
+
|
27
|
+
* Source code: http://github.com/libc/tidy_ffi
|
28
|
+
* Bug tracker: http://rubyforge.org/tracker/?atid=30230&group_id=7805&func=browse
|
29
|
+
* Rubyforge project: http://rubyforge.org/projects/tidy-ffi/
|
data/Rakefile
CHANGED
@@ -7,6 +7,7 @@ begin
|
|
7
7
|
p.url = 'http://github.com/libc/tidy_ffi'
|
8
8
|
p.runtime_dependencies = ['ffi >= 0.2.0']
|
9
9
|
# p.development_dependencies = ['rr', 'matchy', 'context']
|
10
|
+
p.project = 'tidy-ffi'
|
10
11
|
end
|
11
12
|
rescue LoadError => boom
|
12
13
|
puts "You are missing a dependency required for meta-operations on this gem."
|
data/lib/tidy_ffi/interface.rb
CHANGED
data/lib/tidy_ffi/tidy.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# Clean and simple interface to Tidy
|
2
2
|
class TidyFFI::Tidy
|
3
3
|
OptionsContainer = TidyFFI::OptionsContainer
|
4
|
-
|
4
|
+
|
5
|
+
#Initializing object.
|
6
|
+
#
|
7
|
+
#* str is a string to tidy
|
8
|
+
#* options are options for tidy
|
5
9
|
def initialize(str, options = {})
|
6
10
|
@string = str
|
7
11
|
@options = OptionsContainer.new(self.class.default_options)
|
@@ -14,10 +18,19 @@ class TidyFFI::Tidy
|
|
14
18
|
doc.apply_options(@options.to_hash!)
|
15
19
|
doc.string = @string
|
16
20
|
doc.clean
|
21
|
+
@errors = doc.errors
|
17
22
|
doc.output
|
18
23
|
end
|
19
24
|
end
|
20
25
|
|
26
|
+
# Returns errors for string
|
27
|
+
def errors
|
28
|
+
@errors ||= begin
|
29
|
+
clean
|
30
|
+
@errors
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
21
34
|
# Assigns options for tidy.
|
22
35
|
# It merges options, not deletes old ones.
|
23
36
|
# tidy.options= {:wrap_asp => true}
|
data/test/test_simple.rb
CHANGED
@@ -5,18 +5,27 @@ class TestSimple < Test::Unit::TestCase
|
|
5
5
|
context "TidyFFI::Tidy" do
|
6
6
|
context "public interface" do
|
7
7
|
[[:initialize, -2],
|
8
|
-
[:clean, 0]
|
8
|
+
[:clean, 0],
|
9
|
+
[:errors, 0]].each do |method, arity|
|
9
10
|
it "method #{method} has arity #{arity}" do
|
10
11
|
T.instance_method(method).arity.should == arity
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
14
|
-
|
15
|
+
|
15
16
|
context "simple cleanup" do
|
16
17
|
it "clean up text" do
|
17
18
|
T.new("test").clean.should =~ %r{<body>\s+test\s+</body>}
|
18
19
|
T.new("test").clean.should =~ %r{<meta name="generator" content=.+?Tidy.+?>}m
|
19
20
|
end
|
20
21
|
end
|
22
|
+
|
23
|
+
context "should have method for errors" do
|
24
|
+
it "have method for errors" do
|
25
|
+
t = T.new("test")
|
26
|
+
t.clean
|
27
|
+
t.errors.should == "line 1 column 1 - Warning: missing <!DOCTYPE> declaration\nline 1 column 1 - Warning: plain text isn't allowed in <head> elements\nline 1 column 1 - Warning: inserting missing 'title' element\n"
|
28
|
+
end
|
29
|
+
end
|
21
30
|
end
|
22
31
|
end
|
data/tidy_ffi.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{tidy_ffi}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Eugene Pimenov"]
|
9
|
-
s.date = %q{2009-02
|
9
|
+
s.date = %q{2009-03-02}
|
10
10
|
s.description = %q{Tidy library interface via FFI}
|
11
11
|
s.email = %q{}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/tidy_ffi/interface.rb", "lib/tidy_ffi/lib_tidy.rb", "lib/tidy_ffi/options_container.rb", "lib/tidy_ffi/tidy.rb", "lib/tidy_ffi/tidy_ffi_extensions.rb", "lib/tidy_ffi.rb"]
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.homepage = %q{http://github.com/libc/tidy_ffi}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tidy_ffi", "--main", "README"]
|
17
17
|
s.require_paths = ["lib"]
|
18
|
-
s.rubyforge_project = %q{
|
18
|
+
s.rubyforge_project = %q{tidy-ffi}
|
19
19
|
s.rubygems_version = %q{1.3.1}
|
20
20
|
s.summary = %q{Tidy library interface via FFI}
|
21
21
|
s.test_files = ["test/test_helper.rb", "test/test_options.rb", "test/test_simple.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libc-tidy_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugene Pimenov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02
|
12
|
+
date: 2009-03-02 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version:
|
84
84
|
requirements: []
|
85
85
|
|
86
|
-
rubyforge_project:
|
86
|
+
rubyforge_project: tidy-ffi
|
87
87
|
rubygems_version: 1.2.0
|
88
88
|
signing_key:
|
89
89
|
specification_version: 2
|