Module: TaggartHelp

Defined in:
lib/taggart_help.rb

Class Method Summary collapse

Class Method Details

.helpObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/taggart_help.rb', line 3

def self.help
  puts "Welcome to Taggart (#{Taggart::VERSION} Build #{Taggart::BUILD})"
  puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  puts "Taggart is a library that allows you to easily"
  puts "turn a string (or array) into an HTML tag or more tags"
  puts "by simply calling the 'tag-method' on the string."
  puts "Examples:"
  puts "  'Hello World!'.h1  -->  <h1>Hello World!</h1>'"
  puts "  'Important'.span(class: :important) " 
  puts "                     --> <span class=\"important\">Important</span>"
  puts "  'Break'.br         --> Break<br />"
  puts "  %w(a b c).ul       --> <ul><li>a</li><li>b</li><li>c</li></ul>"
  puts "\nFor a list of tags run Taggart.tags"
  puts "Other informational stuff:"
  puts "  - Version:  Taggart::VERSION"
  puts "  - Build:    Taggart::BUILD"
  puts "\nPlease note that Taggart is considered 'experimental' (but"
  puts "fairly stable) and in early development, so please help make"
  puts "Taggart better; send suggestions, bug fixes, improvements, etc"
  puts "to the author, and do fork the code and send pull requests if"
  puts "you've made an improvement - Thanks!"
  puts "\n\nAuthor: Jocke Selin <[email protected]> @jockeselin"
  true
end

.infoObject



29
30
31
# File 'lib/taggart_help.rb', line 29

def self.info
  self.help
end

.tagsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/taggart_help.rb', line 34

def self.tags
  "Taggart's tags:\n" +
  "~~~~~~~~~~~~~~~"
  "This is a list of the tags that Taggart can generate, for your pleasure\n" +
  "\nStandard tags:\n" +
  "--------------\n" +
  "These tags have a start- and end-tag and the take any number of\n" +
  "attributes in the form of a hash with key-value pairs.\n" +
  output_tags(Taggart::String::STANDARD_TAGS) +
  "\nSpecial tags\n" +
  "------------\n" +
  "These tags behave like the Standard tags, but there's already a\n" +
  "method defined for the String instance so these tags have to be\n" +
  "treated in a slightly special way, in that the tag that's ouputted\n" +
  "doesn't have the same method name. I.e to output <tr> you call '._tr'\n" +
  "however, you don't really need to bother with knowing this as Taggart\n" +
  "does some magic behind the scenes to determine wheter you are asking\n" +
  "for a Taggart tag or the original method.\n" +
  (Taggart::String::SPECIAL_TAGS.sort.map do |tag_pair|
    "  Tag: #{('<' + tag_pair[0] + '>').ljust(6)}  Method: .#{tag_pair[1]}"
  end).join("\n") +
  "\n\nSingle Tags\n" +
  "-------------\n" +
  "Single tags are tags that do not an end tag, <br> is one such tag\n" +
  "In Taggart Single Tags behave just like Standard tags; you can\n" +
  "add attributes to them.\n" +
  output_tags(Taggart::String::SINGLE_TAGS) +
  "\nSmart Tags\n" +
  "------------\n" +
  "These tags go to the gifted class and can speak elvish. They know what\n" +
  "you want from them. They don't behave like the other ones in the sense\n" +
  "that you have a string that you want to turn into something, not just a\n" +
  "simple tag.\n" +
  "Here's the pupils of the gifted class:\n" +
  ".img    - Turns a URL to an image into an img tag.\n" +
  ".href   - turns a URL into the href-portion of an A-tag, takes the link\n" +
  "          content as a parameter, and also other attributes as 2nd argument.\n" +
  ".script - Either turns a URL to a script file into a <script src..></script>\n" +
  "          tag, or embeds a script source in <script></script> tags. Smart!\n" +
  "\nArray tags\n" +
  "----------\n" +
  "The Array Tags generate HTML tags out of a list of strings in an array.\n" +
  "For example, you can turn an array into list items by callin the .li-\n" +
  "method on the array.\n" +
  "You can also pass attributes to the tags as with the Standard Tags\n" +
  "The tags are:\n" +
  "   td        li\n" +
  "\nSmart Array Tags\n" +
  "-----------------\n" +
  "The Smart Array Tags are all a bit more smartly dressed than the\n" +
  "proletarian Array Tags. Namely, they figure out what you do.\n" +
  "Here's the honour roll\n" +
  "Method   Tag   Special powers\n" +
  ".ol    - Turns an array into an ordered list, wrapping the array elements\n" +
  "         in <li> tags so you get your awesome list in one go\n" +
  ".ul    - The almost identical twin of .ol\n" +
  ".tr    - Like .ol and .li, but wraps the array in <tr> tags with every\n" +
  "         element wrapped in a <td> tag.\n" +
  ".table - The smartest of them all. Creates a complete table from a, one or\n" +
  "         two dimensional Array. Each array is wrapped in the <tr> tag with\n" +
  "         every element in the Array in <td> tags. It's all finished off\n" +
  "         with a decoration of <table>.\n" +
  "\nTag arrays and methods\n" +
  "----------------------\n" +
  "You can access the following arrays and methods containing the tags.\n" +
  "Tags           Array                            Method\n" +
  "Standard tags  Taggart::String::STANDARD_TAGS   Taggart.standard_tags\n" +
  "Special tags   Taggart::String::SPECIAL_TAGS    Taggart.special_tags\n" +
  "Single tags    Taggart::String::SINGLE_TAGS     Taggart.single_tags"
end