-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.rb
More file actions
31 lines (22 loc) · 743 Bytes
/
render.rb
File metadata and controls
31 lines (22 loc) · 743 Bytes
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
require_relative './lib/background.rb'
def parse_args
theme = ARGV[0]
return theme
end
background = Background.new
background.clean_temp
if ARGV[0].nil?
theme = background.set_theme("default")
else
theme = background.set_theme(parse_args.to_s)
end
puts "Generating HTML from Markdown"
resolution = background.get_screen_resolution
file_name = background.generate_file_name(10)
raw_html = background.mdown_to_html(File.read('./EDIT_ME.md'))
html = background.prepare_html(raw_html)
puts "generating Image from HTML"
# run `wkhtmltoimage --extended-help` for a full list of option
scale = background.get_scale(html,resolution)
background.render_to_image(html,scale,resolution,file_name)
background.set_wallpaper(file_name)