pink_shirt 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/Rakefile +9 -0
- data/Readme.textile +33 -0
- data/changelog +3 -0
- data/lib/pink_shirt/sax/tables.rb +15 -2
- data/lib/pink_shirt/version.rb +1 -1
- data/pink_shirt.gemspec +1 -0
- metadata +21 -9
- data/Readme.txt +0 -26
data/.travis.yml
ADDED
data/Rakefile
CHANGED
@@ -1 +1,10 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
task :default => :spec
|
5
|
+
|
6
|
+
desc "Run specs"
|
7
|
+
RSpec::Core::RakeTask.new do |t|
|
8
|
+
# t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
9
|
+
# Put spec opts in a file named .rspec in root
|
10
|
+
end
|
data/Readme.textile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
h1. Pink Shirt
|
2
|
+
|
3
|
+
*wash out all that RedCloth*
|
4
|
+
|
5
|
+
h2. Usage
|
6
|
+
|
7
|
+
bc. text = "This is *my* text."
|
8
|
+
html = RedCloth.new(text).to_html
|
9
|
+
same = PinkShirt.new(html).to_textile
|
10
|
+
same #=> "This is *my* text."
|
11
|
+
|
12
|
+
h2. Motivation
|
13
|
+
|
14
|
+
I had a problem: some html needed to be textile
|
15
|
+
|
16
|
+
None of the available options could get back to exactly where you started.
|
17
|
+
They weren't 'reversable'.
|
18
|
+
|
19
|
+
I learned a lot by reading other's who went before.
|
20
|
+
I've looked at: "html2texile":https://github.com/thickpaddy/html2textile
|
21
|
+
I've looked at: "clothred":https://github.com/CynicalRyan/ClothRed
|
22
|
+
I've looked at: "a deeply buried module in humpyard":https://github.com/humpyard/humpyard
|
23
|
+
|
24
|
+
This library still has some problems with whitespace management, but the majority of the the tags convert.
|
25
|
+
|
26
|
+
It's based around "textile-spec":https://github.com/textile/textile-spec
|
27
|
+
and built to produce mirror images of html produced by
|
28
|
+
"RedCloth":https://github.com/jgarber/redcloth
|
29
|
+
|
30
|
+
|
31
|
+
"!https://secure.travis-ci.org/graemeworthy/pink_shirt.png!":http://travis-ci.org/graemeworthy/pink_shirt
|
32
|
+
|
33
|
+
|
data/changelog
CHANGED
@@ -1,13 +1,26 @@
|
|
1
1
|
class PinkShirt
|
2
2
|
class SAX::Tables < SAX::Base
|
3
|
-
TAGS = %w(table th tr td)
|
3
|
+
TAGS = %w(table th tr td tbody thead)
|
4
4
|
|
5
5
|
def start_table attrs
|
6
|
-
|
6
|
+
if add_attributes(attrs)
|
7
|
+
@output << "table#{add_attributes(attrs)}.\n"
|
8
|
+
end
|
7
9
|
end
|
8
10
|
|
9
11
|
def end_table
|
10
12
|
end
|
13
|
+
def start_tbody attrs
|
14
|
+
end
|
15
|
+
|
16
|
+
def end_tbody
|
17
|
+
end
|
18
|
+
|
19
|
+
def start_thead attrs
|
20
|
+
end
|
21
|
+
|
22
|
+
def end_thead
|
23
|
+
end
|
11
24
|
|
12
25
|
def start_tr attrs
|
13
26
|
end
|
data/lib/pink_shirt/version.rb
CHANGED
data/pink_shirt.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pink_shirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: RedCloth
|
16
|
-
requirement: &
|
16
|
+
requirement: &70163891102960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70163891102960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70163891102220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,21 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70163891102220
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &70163891101080 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70163891101080
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: nokogiri
|
38
|
-
requirement: &
|
49
|
+
requirement: &70163891100520 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,7 +54,7 @@ dependencies:
|
|
43
54
|
version: '0'
|
44
55
|
type: :runtime
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70163891100520
|
47
58
|
description: Converts Html to Textile, or as some say 'html2textile', it's built on
|
48
59
|
nokogiri
|
49
60
|
email:
|
@@ -53,9 +64,10 @@ extensions: []
|
|
53
64
|
extra_rdoc_files: []
|
54
65
|
files:
|
55
66
|
- .gitignore
|
67
|
+
- .travis.yml
|
56
68
|
- Gemfile
|
57
69
|
- Rakefile
|
58
|
-
- Readme.
|
70
|
+
- Readme.textile
|
59
71
|
- changelog
|
60
72
|
- lib/pink_shirt.rb
|
61
73
|
- lib/pink_shirt/attributes.rb
|
data/Readme.txt
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
I had a problem: some html needed to be textile
|
2
|
-
|
3
|
-
None of the available options could get back to exactly where you started.
|
4
|
-
They weren't 'reversable'
|
5
|
-
|
6
|
-
I learned a lot by reading other's who went before.
|
7
|
-
I've looked at: html2texile https://github.com/thickpaddy/html2textile
|
8
|
-
I've looked at: clothred https://github.com/CynicalRyan/ClothRed
|
9
|
-
I've looked at: a deeply buried module in humpyard https://github.com/humpyard/humpyard
|
10
|
-
|
11
|
-
This library still has some problems with whitespace management, but all the tags convert.
|
12
|
-
|
13
|
-
It's based around https://github.com/textile/textile-spec
|
14
|
-
and built to produce mirror images of html produced by
|
15
|
-
RedCloth https://github.com/jgarber/redcloth
|
16
|
-
|
17
|
-
Usage
|
18
|
-
============================
|
19
|
-
text = "This is *my* text."
|
20
|
-
html = RedCloth.new(text).to_html
|
21
|
-
same = PinkShirt.new(html).to_textile
|
22
|
-
same #=> "This is *my* text."
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|