2011-09-14 07:51:52 +00:00
|
|
|
# Helper to find an image corresponding to the current
|
|
|
|
# article
|
2011-10-21 14:48:31 +00:00
|
|
|
def blogimage(filename,title="no name", divclass=nil)
|
|
|
|
imgpath=blogimagedir + filename
|
2011-09-14 07:51:52 +00:00
|
|
|
if not divclass.nil?
|
2012-05-02 12:00:39 +00:00
|
|
|
if divclass !~ /^\s*$/
|
2012-04-26 15:53:19 +00:00
|
|
|
cls=%{ class="#{divclass}"}
|
|
|
|
end
|
2011-09-14 07:51:52 +00:00
|
|
|
end
|
|
|
|
return %{<img alt="#{title}" src="#{imgpath}"#{cls}/>}
|
|
|
|
end
|
|
|
|
|
2012-04-05 11:47:30 +00:00
|
|
|
def blogfigure(filename,title="no name", divclass=nil)
|
|
|
|
imgpath=blogimagedir + filename
|
|
|
|
if not divclass.nil?
|
|
|
|
cls=%{ class="#{divclass}"}
|
|
|
|
end
|
|
|
|
return %{<figure><img alt="#{title}" src="#{imgpath}"#{cls}/><figcaption>#{title}</figcaption></figure>}
|
|
|
|
end
|
|
|
|
|
2011-09-14 07:51:52 +00:00
|
|
|
# Return a blog image with class left added
|
2011-10-21 14:48:31 +00:00
|
|
|
def leftblogimage(filename,title="no name")
|
|
|
|
return blogimage(filename, title, "left")
|
|
|
|
end
|
|
|
|
|
|
|
|
def blogimagedir
|
|
|
|
if depthOf( @item ) == 4
|
|
|
|
imgpath=@item.parent.path
|
|
|
|
else
|
|
|
|
imgpath=@item.path
|
|
|
|
end
|
|
|
|
imgpath=imgpath.sub(%r{#{@config[:webprefix]}/../},@config[:webprefix]+'/img/')
|
2011-09-14 07:51:52 +00:00
|
|
|
end
|