Support for built-in layouts, with examples
This commit is contained in:
+10
-3
@@ -112,9 +112,16 @@ module Squib
|
||||
@layout = {}
|
||||
Squib::logger.info { " using layout(s): #{files}" }
|
||||
Array(files).each do |file|
|
||||
yml = @layout.merge(YAML.load_file(file))
|
||||
yml.each do |key, value|
|
||||
@layout[key] = recurse_extends(yml, key, {})
|
||||
thefile = file
|
||||
thefile = "#{File.dirname(__FILE__)}/layouts/#{file}" unless File.exists?(file)
|
||||
if File.exists? thefile
|
||||
yml = @layout.merge(YAML.load_file(thefile))
|
||||
yml.each do |key, value|
|
||||
@layout[key] = recurse_extends(yml, key, {})
|
||||
end
|
||||
else
|
||||
puts "the file: #{thefile}"
|
||||
Squib::logger.error { "Layout file not found: #{file}" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
title:
|
||||
x: 275
|
||||
y: 75
|
||||
width: 475
|
||||
height: 125
|
||||
art:
|
||||
x: 275
|
||||
y: 225
|
||||
width: 475
|
||||
height: 475
|
||||
description:
|
||||
x: 275
|
||||
y: 725
|
||||
width: 475
|
||||
height: 200
|
||||
snark:
|
||||
x: 275
|
||||
y: 950
|
||||
width: 475
|
||||
height: 100
|
||||
bonus1:
|
||||
x: 75
|
||||
y: 75
|
||||
width: 175
|
||||
height: 175
|
||||
bonus2:
|
||||
extends: bonus1
|
||||
y: += 198
|
||||
bonus3:
|
||||
extends: bonus2
|
||||
y: += 198
|
||||
bonus4:
|
||||
extends: bonus3
|
||||
y: += 198
|
||||
bonus5:
|
||||
extends: bonus4
|
||||
y: += 198
|
||||
@@ -0,0 +1,17 @@
|
||||
bonus_ul:
|
||||
x: 75
|
||||
y: 75
|
||||
width: 200
|
||||
height: 200
|
||||
bonus_lr:
|
||||
extends: bonus_ul
|
||||
x: 750
|
||||
y: 1050
|
||||
angle: 3.14159
|
||||
art:
|
||||
x: 150
|
||||
y: 275
|
||||
width: 525
|
||||
height: 575
|
||||
valign: middle
|
||||
align: center
|
||||
Reference in New Issue
Block a user