html_writer 0.1.0 → 0.2.0

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. data/README.md +2 -0
  2. data/lib/html_writer.rb +9 -2
  3. metadata +2 -2
data/README.md CHANGED
@@ -14,6 +14,7 @@ HtmlWriter.new.write do |html|
14
14
  body.p 'hello, world'
15
15
  end
16
16
  end
17
+ ```
17
18
 
18
19
  ``` html
19
20
  <!DOCTYPE html>
@@ -25,6 +26,7 @@ end
25
26
  <p>hello, world</p>
26
27
  </body>
27
28
  </html>
29
+ ```
28
30
 
29
31
  ## todo
30
32
 
@@ -1,5 +1,7 @@
1
1
  class HtmlWriter
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
+
4
+ DEFAULT_DOCTYPE = 5
3
5
 
4
6
  VALID_TAGS = {
5
7
  5 => [
@@ -32,7 +34,8 @@ class HtmlWriter
32
34
  class InvalidTagError < StandardError; end
33
35
 
34
36
  def initialize
35
- @html = ''
37
+ @html = ''
38
+ @doctype = DEFAULT_DOCTYPE
36
39
  end
37
40
 
38
41
  def write
@@ -41,6 +44,10 @@ class HtmlWriter
41
44
  @html << '</html>'
42
45
  end
43
46
 
47
+ def write_inline
48
+ yield self
49
+ end
50
+
44
51
  def doctype(doctype)
45
52
  @doctype = doctype
46
53
  case @doctype
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_writer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-17 00:00:00.000000000 Z
12
+ date: 2012-04-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: a small DSL for writing HTML
15
15
  email: mportiz08@gmail.com