-
Notifications
You must be signed in to change notification settings - Fork 115
/
schedule_helpers.rb
61 lines (52 loc) · 1.5 KB
/
schedule_helpers.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
module Jekyll
module Tags
class TableSeparatorTag < Liquid::Tag
def initialize(tag_name, markup, tokens)
super
@cols = markup.strip
end
def render(context)
"<tr class=\"table-separator\"><td colspan=\"#{@cols}\"></td></tr>"
end
end
class ScheduleLabelTag < Liquid::Tag
def initialize(tag_name, markup, tokens)
super
@markup = markup.strip
end
def render(context)
css_class, text = @markup.split(' ')
"<span class=\"tag tag-#{css_class}\">#{text}</span>"
end
end
class KeynoteLabelTag < ScheduleLabelTag
def render(context)
@markup = 'info Keynote'
super
end
end
class ResearchLabelTag < ScheduleLabelTag
def render(context)
@markup = 'default Research'
super
end
end
class TalkLabelTag < ScheduleLabelTag
def render(context)
@markup = 'info Talk'
super
end
end
class HandsonLabelTag < ScheduleLabelTag
def render(context)
@markup = 'default Hands-On'
super
end
end
end
end
Liquid::Template.register_tag('table_separator', Jekyll::Tags::TableSeparatorTag)
Liquid::Template.register_tag('keynote_label', Jekyll::Tags::KeynoteLabelTag)
Liquid::Template.register_tag('research_label', Jekyll::Tags::ResearchLabelTag)
Liquid::Template.register_tag('talk_label', Jekyll::Tags::TalkLabelTag)
Liquid::Template.register_tag('handson_label', Jekyll::Tags::HandsonLabelTag)