markup_for 0.0.1
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/.gitignore +3 -0
- data/Gemfile +4 -0
- data/MIT-license.txt +23 -0
- data/README +26 -0
- data/README.markdown +26 -0
- data/lib/markup_for.rb +30 -0
- data/lib/markup_for/markup.rb +15 -0
- data/lib/markup_for/markups/creole.rb +1 -0
- data/lib/markup_for/markups/markdown.rb +1 -0
- data/lib/markup_for/markups/mediawiki.rb +1 -0
- data/lib/markup_for/markups/org.rb +1 -0
- data/lib/markup_for/markups/rdoc.rb +1 -0
- data/lib/markup_for/markups/textile.rb +1 -0
- data/lib/markup_for/version.rb +3 -0
- data/markup_for.gemspec +41 -0
- metadata +148 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-license.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2011 Andrés Borek
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any
|
4
|
+
person obtaining a copy of this software and associated
|
5
|
+
documentation files (the "Software"), to deal in the
|
6
|
+
Software without restriction, including without limitation
|
7
|
+
the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the
|
9
|
+
Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice
|
13
|
+
shall be included in all copies or substantial portions of
|
14
|
+
the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
17
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
18
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
19
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
20
|
+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
21
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
22
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Markup for
|
2
|
+
|
3
|
+
Markup for is a simple gem for use a markup language in a column.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
For example, for use textile in the column body, only you need:
|
8
|
+
|
9
|
+
<code>markup_for :body, :textile</code>
|
10
|
+
|
11
|
+
Now we write in the column.
|
12
|
+
|
13
|
+
<code>@post.body = "h1. An HTML first-level heading"</code>
|
14
|
+
|
15
|
+
Now for get the the html result:
|
16
|
+
|
17
|
+
<code>@post.body_html</code>
|
18
|
+
|
19
|
+
## Supported formats
|
20
|
+
|
21
|
+
* :creole
|
22
|
+
* :markup
|
23
|
+
* :mediawiki
|
24
|
+
* :org
|
25
|
+
* :rdoc
|
26
|
+
* :textile
|
data/README.markdown
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Markup for
|
2
|
+
|
3
|
+
Markup for is a simple gem for use a markup language in a column.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
For example, for use textile in the column body, only you need:
|
8
|
+
|
9
|
+
<code>markup_for :body, :textile</code>
|
10
|
+
|
11
|
+
Now we write in the column.
|
12
|
+
|
13
|
+
<code>@post.body = "h1. An HTML first-level heading"</code>
|
14
|
+
|
15
|
+
Now for get the the html result:
|
16
|
+
|
17
|
+
<code>@post.body_html</code>
|
18
|
+
|
19
|
+
## Supported formats
|
20
|
+
|
21
|
+
* :creole
|
22
|
+
* :markup
|
23
|
+
* :mediawiki
|
24
|
+
* :org
|
25
|
+
* :rdoc
|
26
|
+
* :textile
|
data/lib/markup_for.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "markup_for/version"
|
3
|
+
require "markup_for/markup"
|
4
|
+
require 'redcarpet'
|
5
|
+
require 'creole'
|
6
|
+
require 'wikicloth'
|
7
|
+
require 'rdoc'
|
8
|
+
require 'redcloth'
|
9
|
+
|
10
|
+
module MarkupFor
|
11
|
+
def self.included(base)
|
12
|
+
base.extend(ClassMethods)
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
def markup_for(column_name, markup)
|
17
|
+
|
18
|
+
class_eval <<-EOV
|
19
|
+
def #{column_name}_html
|
20
|
+
::MarkupFor::Markup.new.render #{column_name}, :#{markup}
|
21
|
+
end
|
22
|
+
|
23
|
+
EOV
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
ActiveRecord::Base.class_eval { include MarkupFor }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module MarkupFor
|
2
|
+
class Markup
|
3
|
+
def render(content, markup)
|
4
|
+
send markup.to_sym, content
|
5
|
+
end
|
6
|
+
|
7
|
+
Dir.glob(File.dirname(__FILE__) + '/markups/*.rb').each do |markup|
|
8
|
+
eval "
|
9
|
+
def #{File.basename markup, '.rb'}(content)
|
10
|
+
#{File.read markup}
|
11
|
+
end
|
12
|
+
"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Creole.creolize(content)
|
@@ -0,0 +1 @@
|
|
1
|
+
RedcarpetCompat.new(content).to_html
|
@@ -0,0 +1 @@
|
|
1
|
+
::WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true)
|
@@ -0,0 +1 @@
|
|
1
|
+
Orgmode::Parser.new(content).to_html
|
@@ -0,0 +1 @@
|
|
1
|
+
RDoc::Markup::ToHtml.new.convert(content)
|
@@ -0,0 +1 @@
|
|
1
|
+
RedCloth.new(content).to_html
|
data/markup_for.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "markup_for/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "markup_for"
|
7
|
+
s.version = MarkupFor::VERSION
|
8
|
+
s.authors = ["Andrés B."]
|
9
|
+
s.email = ["andres.b.dev@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Simple gem for use a markup language in a column}
|
12
|
+
s.description = %q{Simple gem for use a markup language in a column}
|
13
|
+
|
14
|
+
s.rubyforge_project = "markup_for"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "rspec"
|
23
|
+
|
24
|
+
# https://github.com/tanoku/redcarpet
|
25
|
+
s.add_dependency "redcarpet", "~> 2.0" # Markdown
|
26
|
+
# https://github.com/jgarber/redcloth
|
27
|
+
s.add_dependency "RedCloth", "~> 4.2" # Textile
|
28
|
+
# https://github.com/rdoc/rdoc
|
29
|
+
s.add_dependency "rdoc", "~> 3.11" # Rdoc
|
30
|
+
# https://github.com/bdewey/org-ruby
|
31
|
+
s.add_dependency "org-ruby", "~> 0.6" # .Org
|
32
|
+
# https://github.com/nricciar/wikicloth
|
33
|
+
s.add_dependency "wikicloth", "~> 0.7" # WikiMedia
|
34
|
+
# https://github.com/larsch/creole
|
35
|
+
s.add_dependency "creole", "~> 0.4" # Creole
|
36
|
+
|
37
|
+
# https://github.com/mileszs/wicked_pdf
|
38
|
+
s.add_dependency "wicked_pdf", "~> 0.7" # PDF
|
39
|
+
|
40
|
+
# s.add_runtime_dependency "rest-client"
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: markup_for
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrés B.
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &12487700 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *12487700
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: redcarpet
|
27
|
+
requirement: &12485260 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *12485260
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: RedCloth
|
38
|
+
requirement: &12482300 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.2'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *12482300
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rdoc
|
49
|
+
requirement: &12479860 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.11'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *12479860
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: org-ruby
|
60
|
+
requirement: &12478620 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0.6'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *12478620
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: wikicloth
|
71
|
+
requirement: &12476060 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0.7'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *12476060
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: creole
|
82
|
+
requirement: &12472920 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0.4'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *12472920
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: wicked_pdf
|
93
|
+
requirement: &12469180 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0.7'
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *12469180
|
102
|
+
description: Simple gem for use a markup language in a column
|
103
|
+
email:
|
104
|
+
- andres.b.dev@gmail.com
|
105
|
+
executables: []
|
106
|
+
extensions: []
|
107
|
+
extra_rdoc_files: []
|
108
|
+
files:
|
109
|
+
- .gitignore
|
110
|
+
- Gemfile
|
111
|
+
- MIT-license.txt
|
112
|
+
- README
|
113
|
+
- README.markdown
|
114
|
+
- lib/markup_for.rb
|
115
|
+
- lib/markup_for/markup.rb
|
116
|
+
- lib/markup_for/markups/creole.rb
|
117
|
+
- lib/markup_for/markups/markdown.rb
|
118
|
+
- lib/markup_for/markups/mediawiki.rb
|
119
|
+
- lib/markup_for/markups/org.rb
|
120
|
+
- lib/markup_for/markups/rdoc.rb
|
121
|
+
- lib/markup_for/markups/textile.rb
|
122
|
+
- lib/markup_for/version.rb
|
123
|
+
- markup_for.gemspec
|
124
|
+
homepage: ''
|
125
|
+
licenses: []
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project: markup_for
|
144
|
+
rubygems_version: 1.8.11
|
145
|
+
signing_key:
|
146
|
+
specification_version: 3
|
147
|
+
summary: Simple gem for use a markup language in a column
|
148
|
+
test_files: []
|