-
-
Save aktau/9101127 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def image_link(identifier, rep_name) | |
item = @items[identifier] | |
rep = item.rep_named(rep_name) | |
# Create soft dependency | |
# (i.e. when the image changes, this page will be recompiled) | |
Nanoc::NotificationCenter.post(:visit_started, item) | |
Nanoc::NotificationCenter.post(:visit_ended, item) | |
# Create hard dependency | |
# (i.e. this page requires the item to be compiled already) | |
if !rep.compiled? | |
raise Nanoc::Errors::UnmetDependency.new(rep) | |
end | |
# TODO: implement #extract_dimensions | |
width, height = extract_dimensions(rep.raw_path) | |
%[<img src="#{rep.path}" width="#{width}" height="#{height}">] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment