html_tagger 0.0.2 → 0.0.3

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.
data/README.md CHANGED
@@ -2,9 +2,40 @@
2
2
 
3
3
  Several convience methods monkey patched on String to wrap in HTML formatting.
4
4
 
5
- Method chaining is possible, but produces a lot of embedded SPAN tags. New methods to be added later will allow for a call for a single SPAN tag.
5
+ Method chaining is possible, but produces a lot of embedded SPAN tags.
6
6
 
7
+ ### Wrapper methods that will wrap a string in a span tag with the appropriate attributes:
7
8
 
9
+ * bold
10
+ * italics
11
+ * underline, underscore
12
+ * strikeout
13
+ * oblique
14
+ * color(text_color)
15
+ * subscript
16
+ * superscript
17
+ * class(class_to_set)
18
+ * tag_id(id_to_set)
19
+
20
+ ### These methods are proxied to the method:
21
+
22
+ * styles(*list_of_sytles)
23
+ The _list_of_styles_ is a list of strings, which are mentioned above. The will all go on the same span tag.
24
+
25
+ ### The #styles method can take an optional first argument of a symbol which will determine the block type:
26
+
27
+ * styles(:block_type, *list_of_styles) -- :block_type can be :p, :div or :span. :span is the same as no first argument.
28
+
29
+ ### A link can be created with
30
+
31
+ * link(linked_to_url), or an element in the
32
+ * styles('link:linked_to_url', *other_style_elements)
33
+
34
+ ## Exceptions
35
+
36
+ * When an attempt to add more than one ID element to the same tag
37
+ * When a block type other than SPAN, DIV, or P is specified
38
+ * When an unknown trait is specified to #styles
8
39
 
9
40
 
10
41
  ## Installation
@@ -1,3 +1,3 @@
1
1
  module HtmlTagger
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/html_tagger.rb CHANGED
@@ -38,6 +38,10 @@ class String
38
38
  styles('subscript')
39
39
  end
40
40
 
41
+ def tag_id(id_to_set)
42
+ styles('id:'+id_to_set)
43
+ end
44
+
41
45
  def superscript
42
46
  styles('superscript')
43
47
  end
@@ -50,7 +54,7 @@ class String
50
54
 
51
55
  tag_attrs = {}
52
56
 
53
- supported_wrapper_tags = ['span', 'div']
57
+ supported_wrapper_tags = ['span', 'div', 'p']
54
58
 
55
59
  wrap_tags = { 'before' => [], 'after' => []}
56
60
 
@@ -59,6 +59,10 @@ describe "HtmlTagger" do
59
59
  text.superscript.should == "<span style=\"font-size:xx-small; vertical-align:top\">#{text}</span>"
60
60
  end
61
61
 
62
+ it "wraps in a span to add an ID tag" do
63
+ text.tag_id('foo').should == "<span id=\"foo\">Text to Markup</span>"
64
+ end
65
+
62
66
  end
63
67
 
64
68
  context "it can add multiple stylings at once." do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-19 00:00:00.000000000 Z
12
+ date: 2012-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec-expectations