markababy 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c4775ca27f58245a568660e12a4572198af501ab7a13bad54710a4ae582d857c
4
+ data.tar.gz: 2f99632a1418378806de4a487301b11f457c41673ce6518d7eadc7b44496f9c6
5
+ SHA512:
6
+ metadata.gz: bba5cca1630f2a33a995e73c449f46628ab591d003d87bab8d002e16e5c7786a38481114bd92b9d851970c19ffdad7aa0d97e34c6565e639c4b3d7ff0e87d15f
7
+ data.tar.gz: '0590353ce753f7e39e4e8d1b50522ad57e9e935dbcc1e9b6674dc9db9b6976e771dbc18fd6c6f5a0fb781d0a4f315de5b16f1b34af89258c26f00c3fa84c061d'
@@ -0,0 +1,4 @@
1
+ Copyright (c) 2011-2020 TIMCRAFT
2
+
3
+ This is an Open Source project licensed under the terms of the LGPLv3 license.
4
+ Please see <http://www.gnu.org/licenses/lgpl-3.0.html> for license text.
data/README.md CHANGED
@@ -1,15 +1,17 @@
1
- Markaby's little sister
2
- =======================
1
+ # markababy
3
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/markababy.svg)](https://badge.fury.io/rb/markababy) [![Build Status](https://api.travis-ci.org/timcraft/markababy.svg?branch=master)](https://travis-ci.org/timcraft/markababy)
4
4
 
5
- Installation
6
- ------------
5
+
6
+ Markaby's little sister. A small library for writing HTML in Ruby.
7
+
8
+
9
+ ## Installation
7
10
 
8
11
  $ gem install markababy
9
12
 
10
13
 
11
- Example
12
- -------
14
+ ## Example
13
15
 
14
16
  Usage is similar to [Markaby](http://en.wikipedia.org/wiki/Markaby),
15
17
  and easy to use directly from a Ruby script:
@@ -32,21 +34,20 @@ Markababy.markup do
32
34
  end
33
35
  ```
34
36
 
35
- Use `Markababy.capture` if you want to capture the output as a string
36
- instead of printing it to `$stdout`.
37
+ Use `Markababy.capture` if you want to capture
38
+ the output as a string instead of printing it to STDOUT.
39
+
37
40
 
41
+ ## Rails template usage
38
42
 
39
- Rails template usage
40
- --------------------
43
+ Add markababy as a dependency to your Gemfile; do the bundle dance; then change
44
+ the extension on your template files from .erb to .rb and you can start writing
45
+ your templates in Ruby!
41
46
 
42
- To use Markababy within a Rails 3 app: add markababy as a dependency to your
43
- Gemfile; do the bundle dance; then change the extension on your template files
44
- from .erb to .rb and you can start writing your templates in Ruby! Controller
45
- instance variables and helpers will be available as methods.
47
+ Controller instance variables and helpers will be available as methods.
46
48
 
47
49
 
48
- Less is more
49
- ------------
50
+ ## Less is more
50
51
 
51
52
  Some differences from Markaby:
52
53
 
@@ -54,3 +55,10 @@ Some differences from Markaby:
54
55
  * No element classes or IDs
55
56
  * No validation
56
57
  * No XHTML
58
+
59
+
60
+ ## Alternatives
61
+
62
+ * https://github.com/timcraft/hom
63
+ * https://github.com/judofyr/tubby
64
+ * https://github.com/digital-fabric/rubyoshka
@@ -1,11 +1,3 @@
1
- unless defined?(BasicObject)
2
- require 'backports/basic_object'
3
-
4
- class BasicObject
5
- undef_method :p
6
- end
7
- end
8
-
9
1
  module Markababy
10
2
  class Builder < BasicObject
11
3
  def initialize(options, &block)
@@ -20,14 +12,8 @@ module Markababy
20
12
  instance_eval(&block)
21
13
  end
22
14
 
23
- if ::Object.new.respond_to?(:respond_to_missing?)
24
- def context_responds_to?(name)
25
- @context.respond_to?(name)
26
- end
27
- else
28
- def context_responds_to?(name)
29
- @context.respond_to?(name) || (@context.respond_to?(:respond_to_missing?) && @context.respond_to_missing?(name))
30
- end
15
+ def context_responds_to?(name)
16
+ @context.respond_to?(name)
31
17
  end
32
18
 
33
19
  def method_missing(sym, *args, &block)
@@ -1,21 +1,19 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'markababy'
3
- s.version = '1.3.0'
3
+ s.version = '1.3.1'
4
+ s.license = 'LGPL-3.0'
4
5
  s.platform = Gem::Platform::RUBY
5
6
  s.authors = ['Tim Craft']
6
7
  s.email = ['mail@timcraft.com']
7
- s.homepage = 'http://github.com/timcraft/markababy'
8
+ s.homepage = 'https://github.com/timcraft/markababy'
8
9
  s.description = 'Markaby\'s little sister'
9
10
  s.summary = 'See description'
10
- s.files = Dir.glob('{lib,spec}/**/*') + %w(README.md Rakefile markababy.gemspec)
11
- s.add_development_dependency('rails', ['>= 3.0.3'])
11
+ s.files = Dir.glob('lib/**/*.rb') + %w(LICENSE.txt README.md markababy.gemspec)
12
+ s.required_ruby_version = '>= 1.9.3'
12
13
  s.require_path = 'lib'
13
-
14
- unless defined?(BasicObject)
15
- s.add_dependency('backports', '~> 2.8.2')
16
- end
17
-
18
- if RUBY_VERSION == '1.8.7'
19
- s.add_development_dependency('minitest', '>= 4.2.0')
20
- end
14
+ s.metadata = {
15
+ 'homepage' => 'https://github.com/timcraft/markababy',
16
+ 'source_code_uri' => 'https://github.com/timcraft/markababy',
17
+ 'bug_tracker_uri' => 'https://github.com/timcraft/markababy/issues'
18
+ }
21
19
  end
metadata CHANGED
@@ -1,32 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markababy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 1.3.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Craft
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-16 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 3.0.3
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 3.0.3
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
+ dependencies: []
30
13
  description: Markaby's little sister
31
14
  email:
32
15
  - mail@timcraft.com
@@ -34,39 +17,38 @@ executables: []
34
17
  extensions: []
35
18
  extra_rdoc_files: []
36
19
  files:
20
+ - LICENSE.txt
21
+ - README.md
22
+ - lib/markababy.rb
37
23
  - lib/markababy/builder.rb
38
24
  - lib/markababy/rails_template_context.rb
39
25
  - lib/markababy/rails_template_handler.rb
40
26
  - lib/markababy/railtie.rb
41
- - lib/markababy.rb
42
- - spec/markababy_rails_spec.rb
43
- - spec/markababy_spec.rb
44
- - spec/views/index.html.rb
45
- - README.md
46
- - Rakefile
47
27
  - markababy.gemspec
48
- homepage: http://github.com/timcraft/markababy
49
- licenses: []
50
- post_install_message:
28
+ homepage: https://github.com/timcraft/markababy
29
+ licenses:
30
+ - LGPL-3.0
31
+ metadata:
32
+ homepage: https://github.com/timcraft/markababy
33
+ source_code_uri: https://github.com/timcraft/markababy
34
+ bug_tracker_uri: https://github.com/timcraft/markababy/issues
35
+ post_install_message:
51
36
  rdoc_options: []
52
37
  require_paths:
53
38
  - lib
54
39
  required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
40
  requirements:
57
- - - ! '>='
41
+ - - ">="
58
42
  - !ruby/object:Gem::Version
59
- version: '0'
43
+ version: 1.9.3
60
44
  required_rubygems_version: !ruby/object:Gem::Requirement
61
- none: false
62
45
  requirements:
63
- - - ! '>='
46
+ - - ">="
64
47
  - !ruby/object:Gem::Version
65
48
  version: '0'
66
49
  requirements: []
67
- rubyforge_project:
68
- rubygems_version: 1.8.24
69
- signing_key:
70
- specification_version: 3
50
+ rubygems_version: 3.1.4
51
+ signing_key:
52
+ specification_version: 4
71
53
  summary: See description
72
54
  test_files: []
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- require 'rake/testtask'
2
-
3
- task :default => :spec
4
-
5
- Rake::TestTask.new(:spec) do |t|
6
- t.test_files = FileList['spec/*_spec.rb']
7
- t.warning = true
8
- end
@@ -1,33 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'rails/all'
3
- require 'markababy'
4
-
5
- class DummyApplication < Rails::Application
6
- config.active_support.deprecation = :log
7
- end
8
-
9
- DummyApplication.initialize!
10
-
11
- class DummyController < AbstractController::Base
12
- # cf. http://amberbit.com/blog/render-views-partials-outside-controllers-rails-3
13
-
14
- include AbstractController::Rendering
15
- include AbstractController::Layouts
16
- include AbstractController::Helpers
17
-
18
- self.view_paths = 'spec/views'
19
-
20
- def index
21
- @message = 'Controller says hello!'
22
-
23
- render :template => 'index'
24
- end
25
- end
26
-
27
- describe 'Rendering the DummyController index template' do
28
- it 'returns the correct markup' do
29
- output = '<html><head><title>Controller says hello!</title></head><body><p>12,345,678</p></body></html>'
30
-
31
- DummyController.new.index.must_equal(output)
32
- end
33
- end
@@ -1,83 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'markababy'
3
- require 'active_support/core_ext/string/output_safety'
4
-
5
- class ExampleContext
6
- def baconize(word)
7
- "#{word} bacon!"
8
- end
9
- end
10
-
11
- describe 'Markababy' do
12
- it 'renders tags without attributes or content' do
13
- Markababy.capture { br }.must_equal '<br>'
14
- end
15
-
16
- it 'renders tags with content' do
17
- Markababy.capture { title 'Untitled' }.must_equal '<title>Untitled</title>'
18
- end
19
-
20
- it 'escapes content' do
21
- Markababy.capture { h1 'Apples & Oranges' }.must_equal '<h1>Apples &amp; Oranges</h1>'
22
- end
23
-
24
- it 'renders tags with an attribute hash' do
25
- output = Markababy.capture { input :type => :text, :size => 40 }
26
-
27
- output.must_match(/<input .+>/)
28
- output.must_match(/ type="text"/)
29
- output.must_match(/ size="40"/)
30
- end
31
-
32
- it 'renders tags with an attribute array' do
33
- Markababy.capture { input [{:type => :text}, :disabled] }.must_equal '<input type="text" disabled>'
34
- end
35
-
36
- it 'renders tags with attributes and content' do
37
- Markababy.capture { div 'O hai', :class => 'name' }.must_equal '<div class="name">O hai</div>'
38
- end
39
-
40
- it 'renders nested tags' do
41
- Markababy.capture { h1 { span 'Chunky bacon!' } }.must_equal '<h1><span>Chunky bacon!</span></h1>'
42
- end
43
-
44
- it 'provides an option for specifying the output target' do
45
- output = []
46
-
47
- Markababy.markup(:output => output) { hr }
48
-
49
- output.join.must_equal '<hr>'
50
- end
51
-
52
- it 'provides an option for specifying the method lookup context' do
53
- output = Markababy.capture(:context => ExampleContext.new) { h1 baconize('Super chunky') }
54
-
55
- output.must_equal '<h1>Super chunky bacon!</h1>'
56
- end
57
-
58
- it 'provides an method for rendering text content inside a tag' do
59
- output = Markababy.capture { h1 { text 'Hello '; strong 'World' } }
60
-
61
- output.must_equal '<h1>Hello <strong>World</strong></h1>'
62
- end
63
-
64
- it 'does not escape content that has been marked as html safe' do
65
- Markababy.capture { text 'Hello&nbsp;World'.html_safe }.must_equal 'Hello&nbsp;World'
66
-
67
- output = Markababy.capture { h1 'Hello <strong>World</strong>'.html_safe }
68
-
69
- output.must_equal '<h1>Hello <strong>World</strong></h1>'
70
- end
71
-
72
- it 'provides an option for including a doctype declaration' do
73
- output = Markababy.capture(:doctype => true) { html { body { p 'INSERT CONTENT HERE' } } }
74
-
75
- output.must_equal "<!DOCTYPE html>\n<html><body><p>INSERT CONTENT HERE</p></body></html>"
76
- end
77
-
78
- it 'provides access to constants' do
79
- Something = Class.new
80
-
81
- Markababy.capture { h1 Something }.must_equal('<h1>Something</h1>')
82
- end
83
- end
@@ -1,8 +0,0 @@
1
- html {
2
- head {
3
- title message
4
- }
5
- body {
6
- p number_with_delimiter(12345678)
7
- }
8
- }