markaby 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/README +189 -0
  2. data/Rakefile +15 -0
  3. data/doc/rdoc/classes/Markaby.html +192 -0
  4. data/doc/rdoc/classes/Markaby/ActionControllerHelper.html +145 -0
  5. data/doc/rdoc/classes/Markaby/ActionControllerHelper.src/M000005.html +20 -0
  6. data/doc/rdoc/classes/Markaby/Builder.html +480 -0
  7. data/doc/rdoc/classes/Markaby/Builder.src/M000008.html +44 -0
  8. data/doc/rdoc/classes/Markaby/Builder.src/M000009.html +18 -0
  9. data/doc/rdoc/classes/Markaby/Builder.src/M000010.html +19 -0
  10. data/doc/rdoc/classes/Markaby/Builder.src/M000012.html +24 -0
  11. data/doc/rdoc/classes/Markaby/Builder.src/M000013.html +18 -0
  12. data/doc/rdoc/classes/Markaby/Builder.src/M000014.html +22 -0
  13. data/doc/rdoc/classes/Markaby/Builder.src/M000015.html +38 -0
  14. data/doc/rdoc/classes/Markaby/Builder.src/M000016.html +18 -0
  15. data/doc/rdoc/classes/Markaby/Builder.src/M000017.html +18 -0
  16. data/doc/rdoc/classes/Markaby/Builder.src/M000018.html +21 -0
  17. data/doc/rdoc/classes/Markaby/Builder.src/M000019.html +24 -0
  18. data/doc/rdoc/classes/Markaby/Builder.src/M000021.html +18 -0
  19. data/doc/rdoc/classes/Markaby/CssProxy.html +177 -0
  20. data/doc/rdoc/classes/Markaby/CssProxy.src/M000006.html +19 -0
  21. data/doc/rdoc/classes/Markaby/CssProxy.src/M000007.html +33 -0
  22. data/doc/rdoc/classes/Markaby/Template.html +156 -0
  23. data/doc/rdoc/classes/Markaby/Template.src/M000022.html +18 -0
  24. data/doc/rdoc/classes/Markaby/Template.src/M000023.html +20 -0
  25. data/doc/rdoc/classes/Markaby/View.html +156 -0
  26. data/doc/rdoc/classes/Markaby/View.src/M000024.html +18 -0
  27. data/doc/rdoc/classes/Markaby/View.src/M000025.html +18 -0
  28. data/doc/rdoc/classes/Object.html +199 -0
  29. data/doc/rdoc/classes/Object.src/M000001.html +16 -0
  30. data/doc/rdoc/classes/Object.src/M000002.html +16 -0
  31. data/doc/rdoc/classes/Object.src/M000003.html +18 -0
  32. data/doc/rdoc/classes/Object.src/M000004.html +18 -0
  33. data/doc/rdoc/created.rid +1 -0
  34. data/doc/rdoc/files/CHANGELOG.html +136 -0
  35. data/doc/rdoc/files/README.html +326 -0
  36. data/doc/rdoc/files/lib/markaby/builder_rb.html +101 -0
  37. data/doc/rdoc/files/lib/markaby/cssproxy_rb.html +101 -0
  38. data/doc/rdoc/files/lib/markaby/helper_rb.html +101 -0
  39. data/doc/rdoc/files/lib/markaby/metaid_rb.html +107 -0
  40. data/doc/rdoc/files/lib/markaby/tags_rb.html +101 -0
  41. data/doc/rdoc/files/lib/markaby/template_rb.html +101 -0
  42. data/doc/rdoc/files/lib/markaby/view_rb.html +101 -0
  43. data/doc/rdoc/files/lib/markaby_rb.html +127 -0
  44. data/doc/rdoc/fr_class_index.html +33 -0
  45. data/doc/rdoc/fr_file_index.html +36 -0
  46. data/doc/rdoc/fr_method_index.html +51 -0
  47. data/doc/rdoc/index.html +24 -0
  48. data/doc/rdoc/rdoc-style.css +208 -0
  49. data/lib/markaby.rb +19 -1
  50. data/lib/markaby/builder.rb +106 -28
  51. data/lib/markaby/cssproxy.rb +9 -0
  52. data/lib/markaby/helper.rb +14 -0
  53. data/lib/markaby/tags.rb +3 -19
  54. data/setup.rb +1551 -0
  55. data/test/test_markaby.rb +53 -0
  56. data/tools/rakehelp.rb +100 -0
  57. metadata +103 -35
@@ -0,0 +1,53 @@
1
+ require 'test/unit'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'markaby'))
3
+
4
+ class MarkabyTest < Test::Unit::TestCase
5
+
6
+ def mab(string, assigns = {}, helpers = nil)
7
+ Markaby::Template.new(string.to_s).render(assigns, helpers)
8
+ end
9
+
10
+ def setup
11
+ @helpers = Module.new do
12
+ def link_to(obj)
13
+ %{<a href="">#{obj}</a>}
14
+ end
15
+ def pluralize(n, string)
16
+ n == 1 ? string : string + "s"
17
+ end
18
+ module_function :link_to, :pluralize
19
+ end
20
+ @helpers_ohf = @helpers.dup
21
+ @helpers_ohf.instance_variable_set("@output_helpers", false)
22
+ end
23
+
24
+ def test_simple
25
+ assert_equal "<hr/>\n", mab("hr")
26
+ assert_equal "<p>foo</p>\n", mab("p 'foo'")
27
+ assert_equal "<p>\nfoo</p>\n", mab("p { 'foo' }")
28
+ end
29
+
30
+ def test_classes_and_ids
31
+ assert_equal %{<div class="one"></div>\n}, mab("div.one ''")
32
+ assert_equal %{<div class="one two"></div>\n}, mab("div.one.two ''")
33
+ assert_equal %{<div id="three"></div>\n}, mab("div.three! ''")
34
+ end
35
+
36
+ def test_escaping
37
+ assert_equal "<h1>Apples &amp; Oranges</h1>\n", mab("h1 'Apples & Oranges'")
38
+ assert_equal "<h1>\nApples & Oranges</h1>\n", mab("h1 { 'Apples & Oranges' }")
39
+ end
40
+
41
+ def test_capture
42
+ html = "<div>\n<h1>hello world</h1>\n</div>\n"
43
+ assert_equal html, mab("div { h1 'hello world' }")
44
+ assert_equal html, mab("div { capture { h1 'hello world' } }")
45
+ assert mab("capture { h1 'hello world' }").empty?
46
+ end
47
+
48
+ def test_output_helpers
49
+ assert_equal %{<a href="">edit</a>}, mab("link_to('edit')", {}, @helpers)
50
+ assert mab("link_to('edit')", {}, @helpers_ohf).empty?
51
+ end
52
+
53
+ end
@@ -0,0 +1,100 @@
1
+
2
+ def make(makedir)
3
+ Dir.chdir(makedir) do
4
+ sh 'make'
5
+ end
6
+ end
7
+
8
+
9
+ def extconf(dir)
10
+ Dir.chdir(dir) do ruby "extconf.rb" end
11
+ end
12
+
13
+
14
+ def setup_tests
15
+ Rake::TestTask.new do |t|
16
+ t.libs << "test"
17
+ t.test_files = FileList['test/test*.rb']
18
+ t.verbose = true
19
+ end
20
+ end
21
+
22
+
23
+ def setup_clean otherfiles
24
+ files = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log'] + otherfiles
25
+ CLEAN.include(files)
26
+ end
27
+
28
+
29
+ def setup_rdoc files
30
+ Rake::RDocTask.new do |rdoc|
31
+ rdoc.rdoc_dir = 'doc/rdoc'
32
+ rdoc.options << '--line-numbers'
33
+ rdoc.rdoc_files.add(files)
34
+ end
35
+ end
36
+
37
+
38
+ def setup_extension(dir, extension)
39
+ ext = "ext/#{dir}"
40
+ ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
41
+ ext_files = FileList[
42
+ "#{ext}/*.c",
43
+ "#{ext}/*.h",
44
+ "#{ext}/extconf.rb",
45
+ "#{ext}/Makefile",
46
+ "lib"
47
+ ]
48
+
49
+ task "lib" do
50
+ directory "lib"
51
+ end
52
+
53
+ desc "Builds just the #{extension} extension"
54
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
55
+
56
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
57
+ extconf "#{ext}"
58
+ end
59
+
60
+ file ext_so => ext_files do
61
+ make "#{ext}"
62
+ cp ext_so, "lib"
63
+ end
64
+ end
65
+
66
+
67
+ def setup_gem(pkg_name, pkg_version, author, summary, dependencies, test_file)
68
+ pkg_version = pkg_version
69
+ pkg_name = pkg_name
70
+ pkg_file_name = "#{pkg_name}-#{pkg_version}"
71
+
72
+ spec = Gem::Specification.new do |s|
73
+ s.name = pkg_name
74
+ s.version = pkg_version
75
+ s.platform = Gem::Platform::RUBY
76
+ s.author = author
77
+ s.summary = summary
78
+ s.test_file = test_file
79
+ s.has_rdoc = true
80
+ s.extra_rdoc_files = [ "README" ]
81
+ dependencies.each do |dep|
82
+ s.add_dependency(dep)
83
+ end
84
+ s.files = %w(README Rakefile setup.rb) +
85
+ Dir.glob("{bin,doc,test,lib}/**/*") +
86
+ Dir.glob("ext/**/*.{h,c,rb}") +
87
+ Dir.glob("examples/**/*.rb") +
88
+ Dir.glob("tools/*.rb")
89
+
90
+ s.require_path = "lib"
91
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
92
+
93
+ s.bindir = "bin"
94
+ end
95
+
96
+ Rake::GemPackageTask.new(spec) do |p|
97
+ p.gem_spec = spec
98
+ p.need_tar = true
99
+ end
100
+ end
metadata CHANGED
@@ -3,55 +3,123 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: markaby
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.2"
7
- date: 2006-01-17 00:00:00 -07:00
8
- summary: "Markup as Ruby, write HTML in your native Ruby tongue"
6
+ version: "0.3"
7
+ date: 2006-02-01 00:00:00 -07:00
8
+ summary: Markup as Ruby, write HTML in your native Ruby tongue
9
9
  require_paths:
10
- - lib
11
- email: why@ruby-lang.org
12
- homepage: http://whytheluckystiff.net/markaby/
13
- rubyforge_project: hobix
10
+ - lib
11
+ email:
12
+ homepage:
13
+ rubyforge_project:
14
14
  description:
15
- autorequire: markaby
15
+ autorequire:
16
16
  default_executable:
17
17
  bindir: bin
18
- has_rdoc: false
18
+ has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
25
24
  version:
26
25
  platform: ruby
27
26
  signing_key:
28
27
  cert_chain:
29
28
  authors:
30
- - why the lucky stiff
29
+ - Tim Fletcher and _why
31
30
  files:
32
- - test/example.rb
33
- - lib/markaby
34
- - lib/markaby.rb
35
- - lib/markaby/metaid.rb
36
- - lib/markaby/tags.rb
37
- - lib/markaby/builder.rb
38
- - lib/markaby/cssproxy.rb
39
- - lib/markaby/view.rb
40
- - lib/markaby/template.rb
41
- test_files: []
31
+ - README
32
+ - Rakefile
33
+ - setup.rb
34
+ - doc/rdoc
35
+ - doc/rdoc/created.rid
36
+ - doc/rdoc/rdoc-style.css
37
+ - doc/rdoc/files
38
+ - doc/rdoc/classes
39
+ - doc/rdoc/fr_file_index.html
40
+ - doc/rdoc/fr_class_index.html
41
+ - doc/rdoc/fr_method_index.html
42
+ - doc/rdoc/index.html
43
+ - doc/rdoc/files/README.html
44
+ - doc/rdoc/files/CHANGELOG.html
45
+ - doc/rdoc/files/lib
46
+ - doc/rdoc/files/lib/markaby_rb.html
47
+ - doc/rdoc/files/lib/markaby
48
+ - doc/rdoc/files/lib/markaby/metaid_rb.html
49
+ - doc/rdoc/files/lib/markaby/tags_rb.html
50
+ - doc/rdoc/files/lib/markaby/builder_rb.html
51
+ - doc/rdoc/files/lib/markaby/cssproxy_rb.html
52
+ - doc/rdoc/files/lib/markaby/view_rb.html
53
+ - doc/rdoc/files/lib/markaby/template_rb.html
54
+ - doc/rdoc/files/lib/markaby/helper_rb.html
55
+ - doc/rdoc/classes/Object.src
56
+ - doc/rdoc/classes/Markaby
57
+ - doc/rdoc/classes/Object.html
58
+ - doc/rdoc/classes/Markaby.html
59
+ - doc/rdoc/classes/Object.src/M000001.html
60
+ - doc/rdoc/classes/Object.src/M000002.html
61
+ - doc/rdoc/classes/Object.src/M000003.html
62
+ - doc/rdoc/classes/Object.src/M000004.html
63
+ - doc/rdoc/classes/Markaby/ActionControllerHelper.src
64
+ - doc/rdoc/classes/Markaby/CssProxy.src
65
+ - doc/rdoc/classes/Markaby/Builder.src
66
+ - doc/rdoc/classes/Markaby/Template.src
67
+ - doc/rdoc/classes/Markaby/View.src
68
+ - doc/rdoc/classes/Markaby/ActionControllerHelper.html
69
+ - doc/rdoc/classes/Markaby/CssProxy.html
70
+ - doc/rdoc/classes/Markaby/Builder.html
71
+ - doc/rdoc/classes/Markaby/Template.html
72
+ - doc/rdoc/classes/Markaby/View.html
73
+ - doc/rdoc/classes/Markaby/ActionControllerHelper.src/M000005.html
74
+ - doc/rdoc/classes/Markaby/CssProxy.src/M000006.html
75
+ - doc/rdoc/classes/Markaby/CssProxy.src/M000007.html
76
+ - doc/rdoc/classes/Markaby/Builder.src/M000008.html
77
+ - doc/rdoc/classes/Markaby/Builder.src/M000009.html
78
+ - doc/rdoc/classes/Markaby/Builder.src/M000010.html
79
+ - doc/rdoc/classes/Markaby/Builder.src/M000012.html
80
+ - doc/rdoc/classes/Markaby/Builder.src/M000013.html
81
+ - doc/rdoc/classes/Markaby/Builder.src/M000014.html
82
+ - doc/rdoc/classes/Markaby/Builder.src/M000015.html
83
+ - doc/rdoc/classes/Markaby/Builder.src/M000016.html
84
+ - doc/rdoc/classes/Markaby/Builder.src/M000017.html
85
+ - doc/rdoc/classes/Markaby/Builder.src/M000018.html
86
+ - doc/rdoc/classes/Markaby/Builder.src/M000019.html
87
+ - doc/rdoc/classes/Markaby/Builder.src/M000021.html
88
+ - doc/rdoc/classes/Markaby/Template.src/M000022.html
89
+ - doc/rdoc/classes/Markaby/Template.src/M000023.html
90
+ - doc/rdoc/classes/Markaby/View.src/M000024.html
91
+ - doc/rdoc/classes/Markaby/View.src/M000025.html
92
+ - test/test_markaby.rb
93
+ - test/example.rb
94
+ - lib/markaby
95
+ - lib/markaby.rb
96
+ - lib/markaby/metaid.rb
97
+ - lib/markaby/tags.rb
98
+ - lib/markaby/builder.rb
99
+ - lib/markaby/cssproxy.rb
100
+ - lib/markaby/view.rb
101
+ - lib/markaby/template.rb
102
+ - lib/markaby/helper.rb
103
+ - tools/rakehelp.rb
104
+ test_files:
105
+ - test/test_markaby.rb
42
106
  rdoc_options: []
43
- extra_rdoc_files: []
107
+
108
+ extra_rdoc_files:
109
+ - README
44
110
  executables: []
111
+
45
112
  extensions: []
113
+
46
114
  requirements: []
115
+
47
116
  dependencies:
48
- - !ruby/object:Gem::Dependency
49
- name: builder
50
- version_requirement:
51
- version_requirements: !ruby/object:Gem::Version::Requirement
52
- requirements:
53
- -
54
- - ">"
55
- - !ruby/object:Gem::Version
56
- version: 0.0.0
57
- version:
117
+ - !ruby/object:Gem::Dependency
118
+ name: builder
119
+ version_requirement:
120
+ version_requirements: !ruby/object:Gem::Version::Requirement
121
+ requirements:
122
+ - - ">"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.0.0
125
+ version: