malt 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +15 -1
- data/Syckfile +80 -0
- data/lib/malt.rb +1 -1
- data/lib/malt/config.rb +12 -0
- data/lib/malt/engines.rb +1 -1
- data/lib/malt/engines/abstract.rb +2 -2
- data/lib/malt/engines/bluecloth.rb +1 -1
- data/lib/malt/engines/erb.rb +1 -1
- data/lib/malt/engines/erubis.rb +1 -1
- data/lib/malt/engines/haml.rb +1 -1
- data/lib/malt/engines/kramdown.rb +1 -1
- data/lib/malt/engines/less.rb +1 -1
- data/lib/malt/engines/liquid.rb +1 -1
- data/lib/malt/engines/radius.rb +1 -1
- data/lib/malt/engines/rdiscount.rb +1 -1
- data/lib/malt/engines/rdoc.rb +1 -1
- data/lib/malt/engines/redcloth.rb +1 -1
- data/lib/malt/engines/rtals.rb +1 -1
- data/lib/malt/engines/ruby.rb +1 -1
- data/lib/malt/engines/sass.rb +1 -1
- data/lib/malt/engines/tenjin.rb +1 -1
- data/lib/malt/formats.rb +1 -1
- data/lib/malt/formats/abstract.rb +5 -3
- data/lib/malt/formats/abstract_template.rb +45 -0
- data/lib/malt/formats/css.rb +1 -1
- data/lib/malt/formats/erb.rb +3 -3
- data/lib/malt/formats/haml.rb +2 -2
- data/lib/malt/formats/html.rb +1 -1
- data/lib/malt/formats/latex.rb +1 -1
- data/lib/malt/formats/less.rb +2 -2
- data/lib/malt/formats/liquid.rb +2 -2
- data/lib/malt/formats/markdown.rb +4 -4
- data/lib/malt/formats/pdf.rb +1 -1
- data/lib/malt/formats/radius.rb +2 -2
- data/lib/malt/formats/rbhtml.rb +52 -0
- data/lib/malt/formats/rdoc.rb +2 -2
- data/lib/malt/formats/rhtml.rb +86 -0
- data/lib/malt/formats/rtals.rb +2 -2
- data/lib/malt/formats/ruby.rb +2 -2
- data/lib/malt/formats/sass.rb +2 -2
- data/lib/malt/formats/scss.rb +57 -0
- data/lib/malt/formats/tenjin.rb +2 -2
- data/lib/malt/formats/text.rb +1 -1
- data/lib/malt/formats/textile.rb +2 -2
- data/lib/malt/formats/yaml.rb +1 -1
- data/lib/malt/markup.rb +9 -0
- data/lib/malt/meta/gemfile +2 -2
- data/lib/malt/render.rb +65 -0
- data/lib/malt/template.rb +12 -0
- data/meta/gemfile +2 -2
- data/qed/01_overview.rdoc +6 -42
- data/qed/02_formats.rdoc +39 -0
- data/qed/03_formats/01_overview.rdoc +7 -0
- data/qed/03_formats/02_rdoc.rdoc +83 -0
- data/qed/03_formats/03_textile.rdoc +48 -0
- data/qed/03_formats/04_markdown.rdoc +66 -0
- data/qed/03_formats/05_erb.rdoc +65 -0
- data/qed/03_formats/06_liquid.rdoc +54 -0
- data/qed/03_formats/07_haml.rdoc +44 -0
- data/qed/03_formats/08_rtal.rdoc +15 -0
- data/qed/03_formats/09_radius.rdoc +43 -0
- data/qed/03_formats/11_tenjin.rdoc +47 -0
- data/qed/03_formats/12_rbhtml.rdoc +55 -0
- data/qed/03_formats/13_sass.rdoc +55 -0
- data/qed/03_formats/14_scss.rdoc +58 -0
- data/qed/03_formats/15_less.rdoc +46 -0
- data/qed/03_formats/16_ruby.rdoc +48 -0
- data/qed/samples/data.yml +4 -0
- data/qed/samples/output-erb.txt +1 -0
- data/qed/samples/output-liquid.txt +1 -0
- data/qed/samples/output-mustache.txt +1 -0
- data/qed/samples/output-radius.txt +1 -0
- data/qed/samples/sample.erb +1 -0
- data/qed/samples/sample.liquid +1 -0
- data/qed/samples/sample.mustache +1 -0
- data/qed/samples/sample.radius +1 -0
- data/test/samples/sample.md +308 -0
- data/test/samples/sample.rdoc +8 -0
- metadata +40 -4
data/History.rdoc
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
-
== 0.1.
|
3
|
+
== 0.1.1 | 2010-09-21
|
4
|
+
|
5
|
+
This release simple fixes two bugs. One to handle variant arity
|
6
|
+
in format class #render methods. Currently the interface can vary
|
7
|
+
dependent on whether they accept interpolation data or not (this will
|
8
|
+
probably be uniform in the future). The other fix raises an error if
|
9
|
+
no engine exists to handle a given format.
|
10
|
+
|
11
|
+
Changes:
|
12
|
+
|
13
|
+
* Bug fix to raise error if format not handled by any engine.
|
14
|
+
* Bug fix to underlying #render calls to handle variant arities.
|
15
|
+
|
16
|
+
|
17
|
+
== 0.1.0 | 2010-08-23
|
4
18
|
|
5
19
|
This if the initial release of Malt. I have no doubt the code base
|
6
20
|
still needs some fine-tuning --hence the 0.1 version, but I have put
|
data/Syckfile
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
---
|
2
|
+
box:
|
3
|
+
service: Box
|
4
|
+
types : [gem]
|
5
|
+
active : true
|
6
|
+
|
7
|
+
dnote:
|
8
|
+
service : DNote
|
9
|
+
loadpath : ~
|
10
|
+
labels : ~
|
11
|
+
output : ~
|
12
|
+
format : ~
|
13
|
+
active : true
|
14
|
+
|
15
|
+
stats:
|
16
|
+
service : Stats
|
17
|
+
title : ~
|
18
|
+
loadpath : ~
|
19
|
+
exclude : ~
|
20
|
+
output : ~
|
21
|
+
active : true
|
22
|
+
|
23
|
+
rdoc:
|
24
|
+
service : rdoc
|
25
|
+
template: newfish
|
26
|
+
exclude : [Syckfile]
|
27
|
+
output : site/docs/api
|
28
|
+
active : true
|
29
|
+
|
30
|
+
ridoc:
|
31
|
+
service : RIDoc
|
32
|
+
include : ~
|
33
|
+
exclude : ~
|
34
|
+
output : ri
|
35
|
+
active : true
|
36
|
+
|
37
|
+
qedoc:
|
38
|
+
service : Custom
|
39
|
+
cycle : main
|
40
|
+
document: |
|
41
|
+
system 'qedoc -o site/docs/qed -t "Malt Demonstrandum" qed/'
|
42
|
+
|
43
|
+
testrb:
|
44
|
+
service : testrb
|
45
|
+
tests : ~
|
46
|
+
exclude : ~
|
47
|
+
loadpath : ~
|
48
|
+
requires : ~
|
49
|
+
live : false
|
50
|
+
active : false
|
51
|
+
|
52
|
+
grancher:
|
53
|
+
service: Grancher
|
54
|
+
active: true
|
55
|
+
|
56
|
+
gemcutter:
|
57
|
+
active: true
|
58
|
+
|
59
|
+
email:
|
60
|
+
service : Email
|
61
|
+
file : ~
|
62
|
+
subject : ~
|
63
|
+
mailto : ruby-talk@ruby-lang.org
|
64
|
+
# from : transfire@gmail.com
|
65
|
+
# server : <%= ENV['EMAIL_SERVER'] %>
|
66
|
+
# port : <%= ENV['EMAIL_PORT'] %>
|
67
|
+
# account : <%= ENV['EMAIL_ACCOUNT'] %>
|
68
|
+
# domain : <%= ENV['EMAIL_DOMAIN'] %>
|
69
|
+
# login : <%= ENV['EMAIL_LOGIN'] %>
|
70
|
+
# secure : <%= ENV['EMAIL_SECURE'] %>
|
71
|
+
active : true
|
72
|
+
|
73
|
+
vclog:
|
74
|
+
service : VClog
|
75
|
+
format : html # xml, txt
|
76
|
+
layout : rel # gnu
|
77
|
+
typed : false
|
78
|
+
output : ~
|
79
|
+
active : false
|
80
|
+
|
data/lib/malt.rb
CHANGED
@@ -38,7 +38,7 @@ module Malt
|
|
38
38
|
end
|
39
39
|
type = options[:type] || options[:format] || ext
|
40
40
|
type = ext_to_type(type)
|
41
|
-
malt_class = registry[type] ||
|
41
|
+
malt_class = registry[type] || Format::Text
|
42
42
|
#raise "unkown type -- #{type}" unless malt_class
|
43
43
|
malt_class.new(options.merge(:text=>text,:file=>file,:type=>type))
|
44
44
|
end
|
data/lib/malt/config.rb
ADDED
data/lib/malt/engines.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'malt/kernel'
|
2
2
|
|
3
3
|
module Malt
|
4
|
-
module
|
4
|
+
module Engine
|
5
5
|
|
6
6
|
class << self
|
7
7
|
include Malt::Kernel
|
@@ -31,7 +31,7 @@ module Engines
|
|
31
31
|
|
32
32
|
# Register the class to an extension type.
|
33
33
|
def self.register(*exts)
|
34
|
-
|
34
|
+
Engine.register(self, *exts)
|
35
35
|
end
|
36
36
|
|
37
37
|
# Register and set as the default for given extensions.
|
data/lib/malt/engines/erb.rb
CHANGED
data/lib/malt/engines/erubis.rb
CHANGED
data/lib/malt/engines/haml.rb
CHANGED
data/lib/malt/engines/less.rb
CHANGED
data/lib/malt/engines/liquid.rb
CHANGED
data/lib/malt/engines/radius.rb
CHANGED
data/lib/malt/engines/rdoc.rb
CHANGED
data/lib/malt/engines/rtals.rb
CHANGED
data/lib/malt/engines/ruby.rb
CHANGED
data/lib/malt/engines/sass.rb
CHANGED
data/lib/malt/engines/tenjin.rb
CHANGED
data/lib/malt/formats.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'malt/kernel'
|
2
2
|
|
3
3
|
module Malt
|
4
|
-
module
|
4
|
+
module Format
|
5
5
|
|
6
6
|
# Abstract format class serves as the base
|
7
7
|
# class for all other format classes.
|
@@ -87,7 +87,9 @@ module Formats
|
|
87
87
|
# it is taken to be the database for rendering template variables.
|
88
88
|
def render(*type_and_data, &yld)
|
89
89
|
type, data = parse_type_and_data(type_and_data)
|
90
|
-
|
90
|
+
meth = method(type || default)
|
91
|
+
#__send__(type || default, data, &yld)
|
92
|
+
meth.arity == 0 ? meth.call(&yld) : meth.call(data, &yld)
|
91
93
|
end
|
92
94
|
|
93
95
|
#
|
@@ -178,7 +180,7 @@ module Formats
|
|
178
180
|
|
179
181
|
end
|
180
182
|
|
181
|
-
#
|
183
|
+
# TODO: Is this needed anymore, if so where?
|
182
184
|
class UnsupportedConversion < Exception
|
183
185
|
def initialize(from_type, to_type)
|
184
186
|
@from_type = from_type
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'malt/formats/abstract'
|
2
|
+
|
3
|
+
module Malt
|
4
|
+
module Format
|
5
|
+
|
6
|
+
# An AbstractTemplate is a subclass of Abstract. It is used as the base class
|
7
|
+
# for general purpose template formats which can be used to render any other
|
8
|
+
# type of format.
|
9
|
+
class AbstractTemplate < Abstract
|
10
|
+
|
11
|
+
#
|
12
|
+
def to(type, data=nil, &yld)
|
13
|
+
new_class = Malt.registry[type.to_sym]
|
14
|
+
new_text = render(type, data, &yld)
|
15
|
+
new_file = refile(type)
|
16
|
+
new_options = options.merge(:text=>new_text, :file=>new_file, :type=>type)
|
17
|
+
new_class.new(new_options)
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
def render(*type_and_data, &yld)
|
22
|
+
type, data = parse_type_and_data(type_and_data)
|
23
|
+
opts = options.merge(:format=>type, :text=>text, :file=>file, :data=>data)
|
24
|
+
render_engine.render(opts, &yld)
|
25
|
+
#opts = options.merge(:format=>type, :text=>text, :file=>file, :data=>data, :engine=>engine)
|
26
|
+
#Malt.render(opts, &yld)
|
27
|
+
end
|
28
|
+
|
29
|
+
# ERB templates can be any type.
|
30
|
+
def method_missing(sym, *args, &yld)
|
31
|
+
if Malt.registry.key?(sym)
|
32
|
+
return render(sym, *args, &yld).to_s
|
33
|
+
elsif md = /^to_/.match(sym.to_s)
|
34
|
+
type = md.post_match.to_sym
|
35
|
+
if Malt.registry.key?(type)
|
36
|
+
return to(type, *args, &yld)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
super(sym, *args, &yld)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
data/lib/malt/formats/css.rb
CHANGED
data/lib/malt/formats/erb.rb
CHANGED
@@ -3,7 +3,7 @@ require 'malt/formats/html'
|
|
3
3
|
require 'malt/engines/erb'
|
4
4
|
require 'malt/engines/erubis'
|
5
5
|
|
6
|
-
module Malt::
|
6
|
+
module Malt::Format
|
7
7
|
|
8
8
|
#
|
9
9
|
class Erb < AbstractTemplate
|
@@ -90,9 +90,9 @@ module Malt::Formats
|
|
90
90
|
@render_engine ||= (
|
91
91
|
case engine
|
92
92
|
when :erubis
|
93
|
-
Malt::
|
93
|
+
Malt::Engine::Erubis.new(options)
|
94
94
|
else
|
95
|
-
Malt::
|
95
|
+
Malt::Engine::Erb.new(options)
|
96
96
|
end
|
97
97
|
)
|
98
98
|
end
|
data/lib/malt/formats/haml.rb
CHANGED
@@ -2,7 +2,7 @@ require 'malt/formats/abstract'
|
|
2
2
|
require 'malt/formats/html'
|
3
3
|
require 'malt/engines/haml'
|
4
4
|
|
5
|
-
module Malt::
|
5
|
+
module Malt::Format
|
6
6
|
|
7
7
|
# Haml looks like a Markup format, but it turns out to be
|
8
8
|
# a template format too.
|
@@ -44,7 +44,7 @@ module Malt::Formats
|
|
44
44
|
|
45
45
|
#
|
46
46
|
def render_engine
|
47
|
-
@render_engine ||= Malt::
|
47
|
+
@render_engine ||= Malt::Engine::Haml.new(options)
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
data/lib/malt/formats/html.rb
CHANGED
data/lib/malt/formats/latex.rb
CHANGED
data/lib/malt/formats/less.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'malt/formats/abstract'
|
2
2
|
require 'malt/engines/less'
|
3
3
|
|
4
|
-
module Malt::
|
4
|
+
module Malt::Format
|
5
5
|
|
6
6
|
# = LESS
|
7
7
|
#
|
@@ -37,7 +37,7 @@ module Malt::Formats
|
|
37
37
|
|
38
38
|
#
|
39
39
|
def render_engine
|
40
|
-
@render_engine ||= Malt::
|
40
|
+
@render_engine ||= Malt::Engine::Less.new(options)
|
41
41
|
end
|
42
42
|
|
43
43
|
# LESS default output type is CSS.
|