forked from turingschool/curriculum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
window_tag.rb
45 lines (36 loc) · 971 Bytes
/
window_tag.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
require './plugins/highlight_code'
#
# Generates a Mac OS X window around the specified content.
#
# @see TerminalTag
# @see IrbTag
#
module Jekyll
class WindowTag < Liquid::Block
include HighlightCode
include TemplateWrapper
attr_reader :window_type
def initialize(tag_name, markup, tokens)
@window_type = tag_name
super
end
def render(context)
output = super(context)
%{<div class="window">
<nav class="control-window">
<a href="#finder" class="close" data-rel="close">close</a>
<a href="#" class="minimize">minimize</a>
<a href="#" class="deactivate">deactivate</a>
</nav>
<h1 class="titleInside">#{title}</h1>
<div class="container"><div class="#{window_type}">#{format(output)}</div></div>
</div>}
end
def format(output)
promptize(output)
end
def title
@window_type.capitalize
end
end
end