yamlandar 1.0.10 → 1.0.11
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.
- checksums.yaml +4 -4
- data/lib/yamlandar.rb +19 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f0d606422735beeea654f1e6e564443cd338450
|
|
4
|
+
data.tar.gz: 8b57089ba664896cb0e96ae26b0fc1e92aaefad6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5c1fe982c8c0a6aff9b1b913f49eba862a341568e3acce5bb990fae1fdc6df187f35483e714897147c4ce135c8d30563a4a5a83e66c5004f91ce3172753faf2
|
|
7
|
+
data.tar.gz: b40db1c8b7dd3cb8e62fb1da60f8b231e9807d9274bce87c9a0b6a56578931bcb7a92ba05a896943e171117e21cef6472a5a59dd2f9f320edabca62a8173afb1
|
data/lib/yamlandar.rb
CHANGED
|
@@ -3,6 +3,10 @@ require 'yaml'
|
|
|
3
3
|
require 'erb'
|
|
4
4
|
|
|
5
5
|
class Yamlandar < Sinatra::Base
|
|
6
|
+
def self.urls string_or_hash
|
|
7
|
+
html = ''
|
|
8
|
+
html
|
|
9
|
+
end
|
|
6
10
|
def self.generate
|
|
7
11
|
weeknum = 1
|
|
8
12
|
@html = ""
|
|
@@ -24,21 +28,33 @@ class Yamlandar < Sinatra::Base
|
|
|
24
28
|
day["day"].each do |events|
|
|
25
29
|
events.each do |time, details|
|
|
26
30
|
title = details["title"]
|
|
27
|
-
|
|
31
|
+
if details["url"].class == String
|
|
32
|
+
urls = details["url"].split(",")
|
|
33
|
+
elsif details["url"].class == Array
|
|
34
|
+
urls = details["url"]
|
|
35
|
+
end
|
|
28
36
|
lead = details["lead"]
|
|
29
37
|
support = details["support"]
|
|
30
38
|
@html += "<div class='event'>"
|
|
31
39
|
@html += "<h3>"
|
|
32
40
|
if urls[0] != ""
|
|
33
|
-
|
|
41
|
+
@html += "<a href='#{urls[0]}'>#{title}</a>"
|
|
34
42
|
else
|
|
35
43
|
@html += "#{title}"
|
|
36
44
|
end
|
|
37
45
|
@html += "</h3><small>#{time}</small>"
|
|
46
|
+
|
|
47
|
+
|
|
38
48
|
if urls.length > 1
|
|
39
49
|
@html += "<ul>"
|
|
40
50
|
urls.each do |url|
|
|
41
|
-
|
|
51
|
+
if url.class == Hash
|
|
52
|
+
url.each_pair do |title, href|
|
|
53
|
+
@html += "<li><a href='#{href}'>#{title}</a></li>"
|
|
54
|
+
end
|
|
55
|
+
else
|
|
56
|
+
@html += "<li><a href='#{url}'>#{url}</a></li>"
|
|
57
|
+
end
|
|
42
58
|
end
|
|
43
59
|
@html += "</ul>"
|
|
44
60
|
end
|