rubymarkup 0.2

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rubymarkup.rb +67 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d3a349e7d1c134bbdfebe127596e532830d14d78
4
+ data.tar.gz: 083b087199ae2a27c83b6e950e2942e5234262bf
5
+ SHA512:
6
+ metadata.gz: 166171cc2c920affea0d19d5a05706d1b46d1aabc0a77e4f30fa0af648ccfda73bed1c7a725193a13d4dafdeceb7275403cb039ebbe733364dd92b66cc5456d3
7
+ data.tar.gz: 2c7a74e4620a7e1109439171832f3a104f965e88502e0710847e5183742e89f7ddc7f6f9e9fc25ee23071763eb03a8ef265780ca6a7e7f8054b7bfbac8190ee9
data/lib/rubymarkup.rb ADDED
@@ -0,0 +1,67 @@
1
+ # Please note that this is an experimental version of RubyMarkup.
2
+ # It currently supports very few tags and does not support attributes.
3
+ # For more information, please visit http://christianjr.github.io/rbml
4
+ class RubyMarkup
5
+ # Initializes the document
6
+ $document = "<!-- Generated by RubyMarkup -->\n<!DOCTYPE html>\n<html>\n"
7
+ # All the head tags currently supported
8
+ def self.head
9
+ $document << "<head>\n"
10
+ # Allows for child elements
11
+ yield
12
+ $document << "</head>\n"
13
+ end
14
+ def self.title(title)
15
+ $document << "<title>#{title}</title>\n"
16
+ end
17
+ # All the body tags currently supported
18
+ def self.body
19
+ $document << "<body>\n"
20
+ # Allows for child elements
21
+ yield
22
+ $document << "</body>\n"
23
+ end
24
+ def self.h1(h1)
25
+ $document << "<h1>#{h1}</h1>\n"
26
+ end
27
+ def self.h2(h2)
28
+ $document << "<h2>#{h2}</h2>\n"
29
+ end
30
+ def self.h3(h3)
31
+ $document << "<h3>#{h3}</h3>\n"
32
+ end
33
+ def self.p(p)
34
+ $document << "<p>#{p}</p>\n"
35
+ end
36
+ def self.ul
37
+ $document << "<ul>\n"
38
+ yield # for list elements
39
+ $document << "</ul>\n"
40
+ end
41
+ def self.li(li)
42
+ $document << "<li>#{li}</li>\n"
43
+ end
44
+ def self.button(button)
45
+ $document << "<button>#{button}</button>\n"
46
+ end
47
+ # End of body tags
48
+ # Basic javascript support
49
+ def self.script
50
+ $document << "<script>\n"
51
+ yield
52
+ $document << "</script>\n"
53
+ end
54
+ # Allows you to embed javascript as a string
55
+ def self.embed(script)
56
+ $document << "#{script}\n"
57
+ end
58
+ # Deploys it to the destination
59
+ def self.deploy(file)
60
+ $document << "</html>"
61
+ puts "Deploying to #{file}..."
62
+ File.open file, "w" do |file|
63
+ file.write $document
64
+ end
65
+ puts "Successfully deployed to #{file}"
66
+ end
67
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubymarkup
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.2'
5
+ platform: ruby
6
+ authors:
7
+ - Christian Massa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: RubyMarkup is a useful library for coding your HTML documents within
14
+ ruby.
15
+ email: christianmassa23@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/rubymarkup.rb
21
+ homepage: http://christianjr.github.io/rubymarkup/
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.1
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Code HTML documents in ruby!
45
+ test_files: []