Check that teaser isn't too long before compiling
This commit is contained in:
parent
3aed8e03c7
commit
d73e2f8b0c
2
Rules
2
Rules
|
@ -15,6 +15,8 @@ preprocess do
|
|||
|
||||
articles.each {|item| item[:page_type] = 'single-post'}
|
||||
@items.each {|item| item[:page_type] ||= 'static-page'}
|
||||
|
||||
validate_items
|
||||
end
|
||||
|
||||
# Compilation ##################################################################
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
def validate_items
|
||||
validate_teasers
|
||||
end
|
||||
|
||||
def validate_teasers
|
||||
@config[:validation] ||= {}
|
||||
@config[:validation][:teaser_length] ||= 120
|
||||
|
||||
@items.each do |i|
|
||||
if i.key? :teaser and i[:teaser].length > @config[:validation][:teaser_length]
|
||||
raise "Teaser too long for #{i.identifier}: #{i[:teaser].length} (should be #{@config[:validation][:teaser_length]})"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -15,6 +15,9 @@ openid_id: http://www.google.com/profiles/jez.cope
|
|||
|
||||
page_size: 10
|
||||
|
||||
validation:
|
||||
teaser_length: 110
|
||||
|
||||
# A list of file extensions that nanoc will consider to be textual rather than
|
||||
# binary. If an item with an extension not in this list is found, the file
|
||||
# will be considered as binary.
|
||||
|
|
Loading…
Reference in New Issue