yamlandar 1.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.
- checksums.yaml +7 -0
- data/bin/yamlandar +2 -0
- data/lib/yamlandar.rb +101 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a5b4db04ff1f8de71551c27c63de394f33feca4
|
4
|
+
data.tar.gz: dc908b9f2b23ff0eec729b84494cad88eed3af78
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e6fc364f8b398612098ae3b2feb58406dd30d12aa32edfe458b950253187a008af82823ad5836062c60e999be0916ae361f9307ca5f815bfef8544b6ee1af85
|
7
|
+
data.tar.gz: bf2bd26977c5c1280918fa1c59ba66255875aac3582e32972e00d82d218ca9beba83bc48adaef214130677c92e178f6cf016a878b31d5f0ab8617b1892a45e15
|
data/bin/yamlandar
ADDED
data/lib/yamlandar.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
class Yamlandar < Sinatra::Base
|
5
|
+
get '/' do
|
6
|
+
html = "<!doctype html>
|
7
|
+
<html>
|
8
|
+
<head>
|
9
|
+
<title>Schedule</title>
|
10
|
+
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
11
|
+
<link rel='stylesheet' type='text/css' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>
|
12
|
+
<style>
|
13
|
+
h2 a{
|
14
|
+
color:inherit;
|
15
|
+
}
|
16
|
+
h1 img{
|
17
|
+
max-width:50px;
|
18
|
+
margin-right:.5em;
|
19
|
+
}
|
20
|
+
</style>
|
21
|
+
<script>
|
22
|
+
function formatDate(date) {
|
23
|
+
var d = new Date(date),
|
24
|
+
month = '' + (d.getMonth() + 1),
|
25
|
+
day = '' + d.getDate(),
|
26
|
+
year = d.getFullYear();
|
27
|
+
|
28
|
+
if (month.length < 2) month = '0' + month;
|
29
|
+
if (day.length < 2) day = '0' + day;
|
30
|
+
|
31
|
+
return [year, month, day].join('-');
|
32
|
+
}
|
33
|
+
|
34
|
+
window.onload = function(){
|
35
|
+
var jump = document.querySelector('.js-jump')
|
36
|
+
jump.addEventListener('click', function(event){
|
37
|
+
event.preventDefault()
|
38
|
+
var d = formatDate(new Date())
|
39
|
+
var target = document.getElementById(d);
|
40
|
+
window.scrollTo(target.offsetLeft,target.offsetTop);
|
41
|
+
window.location.hash = formatDate(new Date())
|
42
|
+
})
|
43
|
+
}
|
44
|
+
</script>
|
45
|
+
</head>
|
46
|
+
<body>
|
47
|
+
<div class='page-header'>
|
48
|
+
<h1 class='container'><img src='https://avatars2.githubusercontent.com/u/11040407?v=3&s=200'>Schedule</h1>
|
49
|
+
</div>
|
50
|
+
<div class='container'>
|
51
|
+
<a href='#' class='js-jump'>Jump to Today</a>
|
52
|
+
</div>"
|
53
|
+
days = YAML.load_file('schedule.yml')
|
54
|
+
counter = 0
|
55
|
+
start = Date.parse(days[0]["start-date"])
|
56
|
+
days[1]["days"].each_with_index do |day, index|
|
57
|
+
html += "<div class='day container'>"
|
58
|
+
is_saturday = (start + counter).wday == 6
|
59
|
+
counter += 2 if is_saturday
|
60
|
+
today = (start + counter).strftime("%A, %m/%d")
|
61
|
+
yyyymmdd = Date.parse(today).strftime("%F")
|
62
|
+
html += "<h2 id='#{yyyymmdd}'><a href='##{yyyymmdd}'>#{today}</a></h2>"
|
63
|
+
day["day"].each do |events|
|
64
|
+
events.each do |time, details|
|
65
|
+
title = details["title"]
|
66
|
+
urls = details["url"].split(",")
|
67
|
+
lead = details["lead"]
|
68
|
+
support = details["support"]
|
69
|
+
html += "<div class='event'>"
|
70
|
+
html += "<h3>"
|
71
|
+
if urls[0] != ""
|
72
|
+
html += "<a href='#{urls[0]}'>#{title}</a>"
|
73
|
+
else
|
74
|
+
html += "#{title}"
|
75
|
+
end
|
76
|
+
html += "</h3><small>#{time}</small>"
|
77
|
+
if urls.length > 1
|
78
|
+
html += "<ul>"
|
79
|
+
urls.each do |url|
|
80
|
+
html += "<li><a href='#{url}'>#{url}</a></li>"
|
81
|
+
end
|
82
|
+
html += "</ul>"
|
83
|
+
end
|
84
|
+
if lead != "" && support != ""
|
85
|
+
html += "<ul>
|
86
|
+
<li>#{lead}</li>
|
87
|
+
<li>#{support}</li>
|
88
|
+
</ul>
|
89
|
+
"
|
90
|
+
end
|
91
|
+
html += "</div>"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
html += "</div><hr>"
|
95
|
+
counter += 1
|
96
|
+
end
|
97
|
+
html
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
Viewer.run!
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yamlandar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Olds
|
8
|
+
- Jesse Shawl
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-06-18 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A simple yaml-to-html previewer
|
15
|
+
email: olds.solutions@gmail.com
|
16
|
+
executables:
|
17
|
+
- yamlandar
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/yamlandar
|
22
|
+
- lib/yamlandar.rb
|
23
|
+
homepage: http://rubygems.org/gems/yamlandar
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.4.8
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: Hola!
|
47
|
+
test_files: []
|