smklib 1.0.6

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 (102) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/images/add.png +0 -0
  3. data/app/assets/images/button_cancel.png +0 -0
  4. data/app/assets/images/button_ok.png +0 -0
  5. data/app/assets/images/cmseditor/16x16/text_block.png +0 -0
  6. data/app/assets/images/cmseditor/16x16/text_bold.png +0 -0
  7. data/app/assets/images/cmseditor/16x16/text_center.png +0 -0
  8. data/app/assets/images/cmseditor/16x16/text_italic.png +0 -0
  9. data/app/assets/images/cmseditor/16x16/text_left.png +0 -0
  10. data/app/assets/images/cmseditor/16x16/text_right.png +0 -0
  11. data/app/assets/images/cmseditor/16x16/text_strike.png +0 -0
  12. data/app/assets/images/cmseditor/16x16/text_sub.png +0 -0
  13. data/app/assets/images/cmseditor/16x16/text_super.png +0 -0
  14. data/app/assets/images/cmseditor/16x16/text_under.png +0 -0
  15. data/app/assets/images/cmseditor/22x22/text_block.png +0 -0
  16. data/app/assets/images/cmseditor/22x22/text_bold.png +0 -0
  17. data/app/assets/images/cmseditor/22x22/text_center.png +0 -0
  18. data/app/assets/images/cmseditor/22x22/text_italic.png +0 -0
  19. data/app/assets/images/cmseditor/22x22/text_left.png +0 -0
  20. data/app/assets/images/cmseditor/22x22/text_right.png +0 -0
  21. data/app/assets/images/cmseditor/22x22/text_strike.png +0 -0
  22. data/app/assets/images/cmseditor/22x22/text_sub.png +0 -0
  23. data/app/assets/images/cmseditor/22x22/text_super.png +0 -0
  24. data/app/assets/images/cmseditor/22x22/text_under.png +0 -0
  25. data/app/assets/images/trashcan_empty.png +0 -0
  26. data/app/assets/javascripts/collapsable.js +56 -0
  27. data/app/assets/javascripts/hide_show.js +39 -0
  28. data/app/assets/javascripts/jscalendar-1.0/calendar-setup.js +200 -0
  29. data/app/assets/javascripts/jscalendar-1.0/calendar.js +1806 -0
  30. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-af.js +39 -0
  31. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-al.js +101 -0
  32. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-bg.js +124 -0
  33. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-big5-utf8.js +123 -0
  34. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-big5.js +123 -0
  35. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-br.js +108 -0
  36. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-ca.js +123 -0
  37. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-cs-utf8.js +65 -0
  38. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-cs-win.js +65 -0
  39. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-da.js +123 -0
  40. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-de.js +124 -0
  41. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-du.js +45 -0
  42. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-el.js +89 -0
  43. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-en.js +127 -0
  44. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-es.js +129 -0
  45. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-fi.js +98 -0
  46. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-fr.js +125 -0
  47. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-he-utf8.js +123 -0
  48. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-hr-utf8.js +49 -0
  49. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-hr.js +0 -0
  50. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-hu.js +124 -0
  51. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-it.js +124 -0
  52. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-jp.js +45 -0
  53. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-ko-utf8.js +120 -0
  54. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-ko.js +120 -0
  55. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-lt-utf8.js +114 -0
  56. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-lt.js +114 -0
  57. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-lv.js +123 -0
  58. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-nl.js +73 -0
  59. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-no.js +114 -0
  60. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-pl-utf8.js +93 -0
  61. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-pl.js +56 -0
  62. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-pt.js +123 -0
  63. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-ro.js +66 -0
  64. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-ru.js +123 -0
  65. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-ru_win_.js +123 -0
  66. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-si.js +94 -0
  67. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-sk.js +99 -0
  68. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-sp.js +110 -0
  69. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-sv.js +93 -0
  70. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-tr.js +58 -0
  71. data/app/assets/javascripts/jscalendar-1.0/lang/calendar-zh.js +119 -0
  72. data/app/assets/javascripts/jscalendar-1.0/lang/cn_utf8.js +123 -0
  73. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/active-bg.gif +0 -0
  74. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/dark-bg.gif +0 -0
  75. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/hover-bg.gif +0 -0
  76. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/menuarrow.gif +0 -0
  77. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/normal-bg.gif +0 -0
  78. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/rowhover-bg.gif +0 -0
  79. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/status-bg.gif +0 -0
  80. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/theme.css +236 -0
  81. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/title-bg.gif +0 -0
  82. data/app/assets/stylesheets/jscalendar-1.0/skins/aqua/today-bg.gif +0 -0
  83. data/app/views/error_mailer/snapshot.rhtml +71 -0
  84. data/lib/smklib.rb +6 -0
  85. data/lib/smklib/array_ext.rb +76 -0
  86. data/lib/smklib/browsers.rb +69 -0
  87. data/lib/smklib/builder_ext.rb +103 -0
  88. data/lib/smklib/date_ext.rb +23 -0
  89. data/lib/smklib/debug_support.rb +27 -0
  90. data/lib/smklib/error_mailer.rb +70 -0
  91. data/lib/smklib/hash_ext.rb +19 -0
  92. data/lib/smklib/htmlutils.rb +604 -0
  93. data/lib/smklib/movable_children.rb +28 -0
  94. data/lib/smklib/object_ext.rb +34 -0
  95. data/lib/smklib/php_serialize.rb +309 -0
  96. data/lib/smklib/railtie.rb +6 -0
  97. data/lib/smklib/somekool_scaffold.rb +198 -0
  98. data/lib/smklib/super_looking_list.rb +63 -0
  99. data/lib/smklib/version.rb +11 -0
  100. data/vendor/calendar_helper.rb +100 -0
  101. data/vendor/htmltokenizer.rb +259 -0
  102. metadata +158 -0
@@ -0,0 +1,63 @@
1
+ require 'smklib/builder_ext'
2
+
3
+ class SuperLookingList
4
+
5
+ attr_accessor :model, :list, :columns, :speed, :table_width, :options
6
+
7
+ def initialize(model, list, columns, speed, table_width, options = {})
8
+ @model, @list, @columns, @speed, @table_width, @options = model, list, columns, speed, table_width, options
9
+ end
10
+
11
+ def format_column(item, column)
12
+ c = column[:field]
13
+ val = item.send(c)
14
+ if column[:format]
15
+ val = column[:format].call(item, c)
16
+ else
17
+ if item.respond_to? :format_for_display
18
+ STDERR.puts "Warning: {model}::format_for_display is deprecated (#{item.to_s})"
19
+ val = item.format_for_display(c)
20
+ end
21
+ end
22
+ val = "n/a" if val.to_s.empty?
23
+ return val.to_s
24
+ end
25
+
26
+ def render(xml = nil, &block)
27
+ xml ||= Builder::XmlMarkup.new(:indent => 2)
28
+ xml.div do
29
+ xml.tight_table("border" => "1", "width" => table_width.to_s, "cellpadding" => "2", "class" => "SuperTableList #{@model.capitalize}") do
30
+ xml.tr do
31
+ columns.each { |c|
32
+ xml.th {
33
+ if options[:header_format]
34
+ options[:header_format].call(xml, c)
35
+ else
36
+ xml << c[:label]
37
+ end
38
+ }
39
+ }
40
+ end
41
+ idx = 0
42
+ for item in list
43
+ style = ((idx % 2 == 0) ? "even" : "odd") + " type_#{item.class}"
44
+ xml.tr("id" => "#{model}_row_#{idx}", "onclick" => "proceed_on_click(this, #{speed})", "onmouseover" => "show_details(this);", "class" => style, "onmouseout" => "hide_last_shown(this);") do
45
+ columns.each do |col|
46
+ xml.td("class" => "field_#{col[:field]}") { xml << format_column(item, col) }
47
+ end
48
+ end
49
+ xml.tr("class" => "current", "id" => "#{model}_row_#{idx}_details", "style" => "display: none;") do
50
+ xml.td("colspan" => columns.size) do
51
+ xml.div("style" => "overflow: auto;", "id" => "#{model}_row_#{idx}_block_details") do
52
+ yield(xml, item)
53
+ end
54
+ end
55
+ end
56
+ idx += 1
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+
@@ -0,0 +1,11 @@
1
+ module SMKLib #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ TINY = 6
6
+
7
+ def self.to_s
8
+ [MAJOR, MINOR, TINY].join('.')
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,100 @@
1
+ # CalendarHelper allows you to draw a databound calendar with fine-grained CSS formatting
2
+ # Copyright (C) 2005 Jeremy Voorhis, Shachaf Ben-Kiki
3
+ #
4
+ # This library is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU Lesser General Public
6
+ # License as published by the Free Software Foundation; either
7
+ # version 2.1 of the License, or (at your option) any later version.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+
18
+ module CalendarHelper
19
+ # Returns an HTML calendar. In its simplest form, this method generates a plain
20
+ # calendar (which can then be customized using CSS) for a given month and year.
21
+ # However, this may be customized in a variety of ways -- changing the default CSS
22
+ # classes, generating the individual day entries yourself, and so on.
23
+ #
24
+ # The following options are required:
25
+ # :year # The year number to show the calendar for.
26
+ # :month # The month number to show the calendar for.
27
+ #
28
+ # The following are optional, available for customizing the default behaviour:
29
+ # :table_class => "calendar" # The class for the <table> tag.
30
+ # :month_name_class => "monthName" # The class for the name of the month, at the top of the table.
31
+ # :other_month_class => "otherMonthClass" # Not implemented yet.
32
+ # :day_name_class => "dayName" # The class is for the names of the weekdays, at the top.
33
+ # :day_class => "day" # The class for the individual day number cells.
34
+ # This may or may not be used if you specify a block (see below).
35
+ # :abbrev => (0..2) # This option specifies how the day names should be abbreviated.
36
+ # Use (0..2) for the first three letters, (0..0) for the first, and
37
+ # (0..-1) for the entire name.
38
+ #
39
+ # For more customization, you can pass a code block to this method, that will get one argument, a Date object,
40
+ # and return a values for the individual table cells. The block can return an array, [cell_text, cell_attrs],
41
+ # cell_text being the text that is displayed and cell_attrs a hash containing the attributes for the <td> tag
42
+ # (this can be used to change the <td>'s class for customization with CSS).
43
+ # This block can also return the cell_text only, in which case the <td>'s class defaults to the value given in
44
+ # +:day_class+. If the block returns nil, the default options are used.
45
+ #
46
+ # Example usage:
47
+ # calendar(:year => 2005, :month => 6) # This generates the simplest possible calendar.
48
+ # calendar({:year => 2005, :month => 6, :table_class => "calendar_helper"}) # This generates a calendar, as
49
+ # # before, but the <table>'s class
50
+ # # is set to "calendar_helper".
51
+ # calendar(:year => 2005, :month => 6, :abbrev => (0..-1)) # This generates a simple calendar but shows the
52
+ # # entire day name ("Sunday", "Monday", etc.) instead
53
+ # # of only the first three letters.
54
+ # calendar(:year => 2005, :month => 5) do |d| # This generates a simple calendar, but gives special days
55
+ # if listOfSpecialDays.include?(d) # (days that are in the array listOfSpecialDays) one CSS class,
56
+ # [d.mday, {:class => "specialDay"}] # "specialDay", and gives the rest of the days another CSS class,
57
+ # else # "normalDay". You can also use this highlight today differently
58
+ # [d.mday, {:class => "normalDay"}] # from the rest of the days, etc.
59
+ # end
60
+ def calendar(options = {}, &block)
61
+ raise ArgumentError, "No year given" unless defined? options[:year]
62
+ raise ArgumentError, "No month given" unless defined? options[:month]
63
+
64
+ block ||= Proc.new {|d| nil}
65
+ options[:table_class ] ||= "calendar"
66
+ options[:month_name_class ] ||= "monthName"
67
+ options[:other_month_class ] ||= "otherMonth"
68
+ options[:day_name_class ] ||= "dayName"
69
+ options[:day_class ] ||= "day"
70
+ options[:abbrev ] ||= (0..2)
71
+
72
+ first = Date.civil(options[:year], options[:month], 1)
73
+ last = Date.civil(options[:year], options[:month], -1)
74
+
75
+ cal = <<EOF
76
+ <table class="#{options[:table_class]}">
77
+ <thead>
78
+ <tr class="#{options[:month_name_class]}">
79
+ <th colspan="7">#{Date::MONTHNAMES[options[:month]]}</th>
80
+ </tr>
81
+ <tr class="#{options[:day_name_class]}">
82
+ EOF
83
+ Date::DAYNAMES.each {|d| cal << " <th>#{d[options[:abbrev]]}</th>"}
84
+ cal << " </tr>
85
+ </thead>
86
+ <tbody>
87
+ <tr>"
88
+ 0.upto(first.wday - 1) {|d| cal << " <td class='#{options[:other_month_class]}'></td>"} unless first.wday == 0
89
+ first.upto(last) do |cur|
90
+ cell_text, cell_attrs = block.call(cur)
91
+ cell_text ||= cur.mday
92
+ cell_attrs ||= {:class => options[:day_class]}
93
+ cell_attrs = cell_attrs.map {|k, v| "#{k}='#{v}'"}.join(' ')
94
+ cal << " <td #{cell_attrs}>#{cell_text}</td>"
95
+ cal << " </tr>\n <tr>" if cur.wday == 6
96
+ end
97
+ last.wday.upto(5) {|d| cal << " <td class='#{options[:other_month_class]}'></td>"} unless last.wday == 6
98
+ cal << " </tr>\n </tbody>\n</table>"
99
+ end
100
+ end
@@ -0,0 +1,259 @@
1
+ # Copyright (C) 2003 Ben Giddings
2
+ #
3
+ # Author Ben Giddings
4
+ #
5
+ # This file may be used under the same license as Ruby
6
+ #
7
+ # Description:
8
+ # This is a partial port of the functionality behind Perl's TokeParser
9
+ # Provided a page it progressively returns tokens from that page
10
+
11
+ # $Id: htmltokenizer.rb,v 1.3 2004/03/04 21:28:16 merc Exp $
12
+ class HTMLTokenizer
13
+ attr_reader :page
14
+ def initialize(content)
15
+ @page = content
16
+ @cur_pos = 0
17
+ end
18
+
19
+ def reset
20
+ @cur_pos = 0
21
+ end
22
+
23
+ def peekNextToken
24
+ if @cur_pos == @page.length then return nil end
25
+
26
+ if ?< == @page[@cur_pos]
27
+ # Next token is a tag of some kind
28
+ if '!--' == @page[(@cur_pos + 1), 3]
29
+ # Token is a comment
30
+ tag_end = @page.index('-->', (@cur_pos + 1))
31
+ if tag_end.nil?
32
+ raise "No end found to started comment:\n#{@page[@cur_pos,80]}"
33
+ end
34
+ # p @page[@cur_pos .. (tag_end+2)]
35
+ HTMLComment.new(@page[@cur_pos .. (tag_end + 2)])
36
+ else
37
+ # Token is a html tag
38
+ tag_end = @page.index('>', (@cur_pos + 1))
39
+ if tag_end.nil?
40
+ raise "No end found to started tag:\n#{@page[@cur_pos,80]}"
41
+ end
42
+ # p @page[@cur_pos .. tag_end]
43
+ HTMLTag.new(@page[@cur_pos .. tag_end])
44
+ end
45
+ else
46
+ # Next token is text
47
+ text_end = @page.index('<', @cur_pos)
48
+ text_end = text_end.nil? ? -1 : (text_end - 1)
49
+ # p @page[@cur_pos .. text_end]
50
+ HTMLText.new(@page[@cur_pos .. text_end])
51
+ end
52
+ end
53
+
54
+ def getNextToken
55
+ token = peekNextToken
56
+ if token
57
+ # @page = @page[token.raw.length .. -1]
58
+ # @page.slice!(0, token.raw.length)
59
+ @cur_pos += token.raw.length
60
+ end
61
+ #p token
62
+ #print token.raw
63
+ return token
64
+ end
65
+
66
+ def getTag(*sought_tags)
67
+ sought_tags.collect! {|elm| elm.downcase}
68
+
69
+ while (tag = getNextToken)
70
+ if tag.kind_of?(HTMLTag) and
71
+ (0 == sought_tags.length or sought_tags.include?(tag.tag_name))
72
+ break
73
+ end
74
+ end
75
+ tag
76
+ end
77
+
78
+ def getText(until_tag = nil)
79
+ if until_tag.nil?
80
+ if ?< == @page[@cur_pos]
81
+ # Next token is a tag, not text
82
+ ""
83
+ else
84
+ # Next token is text
85
+ getNextToken.text
86
+ end
87
+ else
88
+ ret_str = ""
89
+
90
+ while (tag = peekNextToken)
91
+ if tag.kind_of?(HTMLTag) and tag.tag_name == until_tag
92
+ break
93
+ end
94
+
95
+ if ("" != tag.text)
96
+ ret_str << (tag.text + " ")
97
+ end
98
+ getNextToken
99
+ end
100
+
101
+ ret_str
102
+ end
103
+ end
104
+
105
+ def getTrimmedText(until_tag = nil)
106
+ getText(until_tag).strip.gsub(/\s+/m, " ")
107
+ end
108
+
109
+ end
110
+
111
+ class HTMLToken
112
+ attr_accessor :raw
113
+ def initialize(text)
114
+ @raw = text
115
+ end
116
+
117
+ def to_s
118
+ raw
119
+ end
120
+
121
+ def text
122
+ # By default tokens have no text representation
123
+ ""
124
+ end
125
+
126
+ def trimmed_text
127
+ text.strip.gsub(/\s+/m, " ")
128
+ end
129
+ end
130
+
131
+ class HTMLText < HTMLToken
132
+ def text
133
+ raw
134
+ end
135
+ end
136
+
137
+ class HTMLComment < HTMLToken
138
+ attr_accessor :contents
139
+ def initialize(text)
140
+ super(text)
141
+ temp_arr = text.scan(/^<!--\s*(.*?)\s*-->$/m)
142
+ if temp_arr[0].nil?
143
+ raise "Text passed to HTMLComment.initialize is not a comment"
144
+ end
145
+
146
+ @contents = temp_arr[0][0]
147
+ end
148
+ end
149
+
150
+ class HTMLTag < HTMLToken
151
+ attr_reader :end_tag, :tag_name
152
+ def initialize(text)
153
+ super(text)
154
+ if ?< != text[0] or ?> != text[-1]
155
+ raise "Text passed to HTMLComment.initialize is not a comment"
156
+ end
157
+
158
+ @attr_hash = Hash.new
159
+ @raw = text
160
+
161
+ tag_name = text.scan(/[\w:]+/)[0]
162
+ if tag_name.nil?
163
+ raise "Error, tag is nil: #{tag_name}"
164
+ end
165
+
166
+ if ?/ == text[1]
167
+ # It's an end tag
168
+ @end_tag = true
169
+ @tag_name = '/' + tag_name.downcase
170
+ else
171
+ @end_tag = false
172
+ @tag_name = tag_name.downcase
173
+ end
174
+
175
+ @hashed = false
176
+ end
177
+
178
+ def attr_hash
179
+ # Lazy initialize == don't build the hash until it's needed
180
+ if !@hashed
181
+ if !@end_tag
182
+ # Get the attributes
183
+ attr_arr = @raw.scan(/<[\w:]+\s+(.*)>/m)[0]
184
+ if attr_arr.kind_of?(Array)
185
+ # Attributes found, parse them
186
+ attrs = attr_arr[0]
187
+ attr_arr = attrs.scan(/\s*([\w:]+)(?:\s*=\s*("[^"]*"|'[^']*'|([^"'][^\s>]+)))?/m)
188
+ # clean up the array by:
189
+ # * setting all nil elements to true
190
+ # * removing enclosing quotes
191
+ attr_arr.each {
192
+ |item|
193
+ val = if item[1].nil?
194
+ true
195
+ elsif '"'[0] == item[1][0] or '\''[0] == item[1][0]
196
+ item[1][1 .. -2]
197
+ else
198
+ item[1]
199
+ end
200
+ @attr_hash[item[0].downcase] = val
201
+ }
202
+ end
203
+ end
204
+ @hashed = true
205
+ end
206
+
207
+ #p self
208
+
209
+ @attr_hash
210
+ end
211
+
212
+ def text
213
+ if !end_tag
214
+ case tag_name
215
+ when 'img'
216
+ if !attr_hash['alt'].nil?
217
+ return attr_hash['alt']
218
+ end
219
+ when 'applet'
220
+ if !attr_hash['alt'].nil?
221
+ return attr_hash['alt']
222
+ end
223
+ end
224
+ end
225
+ return ''
226
+ end
227
+ end
228
+
229
+ if $0 == __FILE__
230
+ page = "<HTML>
231
+ <HEAD>
232
+ <TITLE>This is the title</TITLE>
233
+ </HEAD>
234
+ <!-- Here comes the <a href=\"missing.link\">blah</a>
235
+ body
236
+ -->
237
+ <BODY>
238
+ <H1>This is the header</H1>
239
+ <P>
240
+ This is the paragraph, it contains
241
+ <a href=\"link.html\">links</a>,
242
+ <img src=\"blah.gif\" optional alt='images
243
+ are
244
+ really cool'>. Ok, here is some more text and
245
+ <A href=\"http://another.link.com/\">another link</A>.
246
+ </P>
247
+ </body>
248
+ </HTML>
249
+ "
250
+ toke = HTMLTokenizer.new(page)
251
+ p toke.getTag("IMG", "A")
252
+ p toke.getTrimmedText
253
+ #p toke.getTrimmedText("/P")
254
+ #while (t = toke.getNextToken)
255
+ # p t
256
+ # print t.trimmed_text + " "
257
+ #end
258
+ #p toke.page
259
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smklib
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Mathieu Jobin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email:
29
+ - mathieu@justbudget.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - app/assets/images/add.png
35
+ - app/assets/images/button_cancel.png
36
+ - app/assets/images/button_ok.png
37
+ - app/assets/images/cmseditor/16x16/text_block.png
38
+ - app/assets/images/cmseditor/16x16/text_bold.png
39
+ - app/assets/images/cmseditor/16x16/text_center.png
40
+ - app/assets/images/cmseditor/16x16/text_italic.png
41
+ - app/assets/images/cmseditor/16x16/text_left.png
42
+ - app/assets/images/cmseditor/16x16/text_right.png
43
+ - app/assets/images/cmseditor/16x16/text_strike.png
44
+ - app/assets/images/cmseditor/16x16/text_sub.png
45
+ - app/assets/images/cmseditor/16x16/text_super.png
46
+ - app/assets/images/cmseditor/16x16/text_under.png
47
+ - app/assets/images/cmseditor/22x22/text_block.png
48
+ - app/assets/images/cmseditor/22x22/text_bold.png
49
+ - app/assets/images/cmseditor/22x22/text_center.png
50
+ - app/assets/images/cmseditor/22x22/text_italic.png
51
+ - app/assets/images/cmseditor/22x22/text_left.png
52
+ - app/assets/images/cmseditor/22x22/text_right.png
53
+ - app/assets/images/cmseditor/22x22/text_strike.png
54
+ - app/assets/images/cmseditor/22x22/text_sub.png
55
+ - app/assets/images/cmseditor/22x22/text_super.png
56
+ - app/assets/images/cmseditor/22x22/text_under.png
57
+ - app/assets/images/trashcan_empty.png
58
+ - app/assets/javascripts/collapsable.js
59
+ - app/assets/javascripts/hide_show.js
60
+ - app/assets/javascripts/jscalendar-1.0/calendar-setup.js
61
+ - app/assets/javascripts/jscalendar-1.0/calendar.js
62
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-af.js
63
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-al.js
64
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-bg.js
65
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-big5-utf8.js
66
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-big5.js
67
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-br.js
68
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-ca.js
69
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-cs-utf8.js
70
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-cs-win.js
71
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-da.js
72
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-de.js
73
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-du.js
74
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-el.js
75
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-en.js
76
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-es.js
77
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-fi.js
78
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-fr.js
79
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-he-utf8.js
80
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-hr-utf8.js
81
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-hr.js
82
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-hu.js
83
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-it.js
84
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-jp.js
85
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-ko-utf8.js
86
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-ko.js
87
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-lt-utf8.js
88
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-lt.js
89
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-lv.js
90
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-nl.js
91
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-no.js
92
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-pl-utf8.js
93
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-pl.js
94
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-pt.js
95
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-ro.js
96
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-ru.js
97
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-ru_win_.js
98
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-si.js
99
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-sk.js
100
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-sp.js
101
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-sv.js
102
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-tr.js
103
+ - app/assets/javascripts/jscalendar-1.0/lang/calendar-zh.js
104
+ - app/assets/javascripts/jscalendar-1.0/lang/cn_utf8.js
105
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/active-bg.gif
106
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/dark-bg.gif
107
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/hover-bg.gif
108
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/menuarrow.gif
109
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/normal-bg.gif
110
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/rowhover-bg.gif
111
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/status-bg.gif
112
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/theme.css
113
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/title-bg.gif
114
+ - app/assets/stylesheets/jscalendar-1.0/skins/aqua/today-bg.gif
115
+ - app/views/error_mailer/snapshot.rhtml
116
+ - lib/smklib.rb
117
+ - lib/smklib/array_ext.rb
118
+ - lib/smklib/browsers.rb
119
+ - lib/smklib/builder_ext.rb
120
+ - lib/smklib/date_ext.rb
121
+ - lib/smklib/debug_support.rb
122
+ - lib/smklib/error_mailer.rb
123
+ - lib/smklib/hash_ext.rb
124
+ - lib/smklib/htmlutils.rb
125
+ - lib/smklib/movable_children.rb
126
+ - lib/smklib/object_ext.rb
127
+ - lib/smklib/php_serialize.rb
128
+ - lib/smklib/railtie.rb
129
+ - lib/smklib/somekool_scaffold.rb
130
+ - lib/smklib/super_looking_list.rb
131
+ - lib/smklib/version.rb
132
+ - vendor/calendar_helper.rb
133
+ - vendor/htmltokenizer.rb
134
+ homepage: https://bitbucket.org/somekool/smklib
135
+ licenses: []
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ - vendor
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.7.8
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: smklib is somekool's ruby library...
158
+ test_files: []