forked from flauschzelle/amazing-aces-bs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rules
executable file
·133 lines (117 loc) · 3.72 KB
/
Rules
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env ruby
preprocess do
@items.each do |item|
if item[:published]
item[:published] = DateTime.parse(item[:published].to_s)
end
if item[:updated]
item[:updated] = DateTime.parse(item[:updated].to_s)
end
if item[:eventdate]
item[:eventdate] = DateTime.parse(item[:eventdate].to_s)
end
if item[:tags]
item[:tags] = item[:tags].split(",").map{|t| t.strip}
end
if item[:title]
dir = item.identifier.to_s.split("/")[0..-2].join("/")+"/"
if item[:thumbnail]
if item[:thumbnail][0] != "/" # Thumbnail path is relative
item[:thumbnail] = dir+item[:thumbnail] # make path absolute
end
else
thumb = @items[dir+"*thumbnail*{png,jpg,gif,svg}"] ||
@items[dir+"*talk*.pdf"] ||
@items[dir+"*.{png,jpg,gif,svg,pdf}"]
if thumb
item[:thumbnail] = thumb.identifier
else
item[:thumbnail] = "/assets/images/amazing-aces-logo.png"
end
end
end
end
end
compile "/**/*.scss" do
filter :sass, syntax: :scss
write item.identifier.without_ext + ".css"
end
compile "/**/*.coffee" do
filter :coffeescript
write item.identifier.without_ext + ".js"
end
compile "/**/*.xml" do
filter :erb
write item.identifier.without_ext + ".html"
end
=begin
#this creates a thumbnail from the default thumbnail image (logo, in the assets dir):
compile "/assets/images/amazing-aces-logo.png", :rep => :thumbnail do
filter :thumbnailize, :width => 600
write item.identifier + "-thumbnail.jpg"
end
#this creates a mini thumbnail from the default thumbnail image (logo, in the assets dir):
compile "/assets/images/amazing-aces-logo.png", :rep => :minithumbnail do
filter :thumbnailize, :width => 350
write item.identifier + "-minithumbnail.jpg"
end
=end
#this creates thumbnails from all images used as thumbnails somewhere:
compile "/**/*.{png,jpg,gif,svg}", :rep => :thumbnail do
if @items.any?{|i| i[:thumbnail] == item.identifier}
if item.identifier.ext == "svg"
filter :thumbnailizesvg, :width => 600
end
filter :thumbnailize, :width => 600
write item.identifier + "-thumbnail.jpg"
end
end
#this creates mini thumbnails from all images used as thumbnails somewhere:
compile "/**/*.{png,jpg,gif,svg}", :rep => :minithumbnail do
if @items.any?{|i| i[:thumbnail] == item.identifier}
if item.identifier.ext == "svg"
filter :thumbnailizesvg, :width => 350
end
filter :thumbnailize, :width => 350
write item.identifier + "-minithumbnail.jpg"
end
end
compile "/**/*.md" do
filter :erb
filter :absolutize_paths
filter :kramdown
layout "/default.*"
# filter :tidy
write item.identifier.without_ext + ".html"
end
compile "/**/*.slim" do
filter :slim
layout "/default.*"
# filter :tidy
write item.identifier.without_ext + ".html"
end
#this creates svg files from the title pages of all pdfs:
compile "/**/*.pdf", :rep => :titlepage do
filter :titlepageize
write item.identifier + "-titlepage.svg"
end
#this creates thumbnail png images for the pdf title pages:
compile "/**/*.pdf", :rep => :thumbnail do
filter :titlepageize
filter :thumbnailizesvg, :width => 600
filter :thumbnailize, :width => 600
write item.identifier + "-titlepage.svg-thumbnail.jpg"
end
#this creates mini thumbnail png images for the pdf title pages:
compile "/**/*.pdf", :rep => :minithumbnail do
filter :titlepageize
filter :thumbnailizesvg, :width => 350
filter :thumbnailize, :width => 350
write item.identifier + "-titlepage.svg-minithumbnail.jpg"
end
#this puts the .htaccess file in the right place
compile "/htaccess.txt" do
write "/.htaccess"
end
passthrough "/**/*"
layout "/**/*", :slim