Package liqp.tags
Class IncludeRelative
java.lang.Object
liqp.LValue
liqp.Insertion
liqp.tags.Tag
liqp.tags.Include
liqp.tags.IncludeRelative
class IncludeRelativeTag < IncludeTag
def tag_includes_dirs(context)
Array(page_path(context)).freeze
end
def page_path(context)
page, site = context.registers.values_at(:page, :site)
return site.source unless page
site.in_source_dir File.dirname(resource_path(page, site))
end
private
def resource_path(page, site)
path = page["path"]
path = File.join(site.config["collections_dir"], path) if page["collection"]
path.delete_suffix("/#excerpt")
end
end
-
Field Summary
Fields inherited from class liqp.LValue
BREAK, CONTINUE, rubyDateTimeFormat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CharStreamWithLocationdetectSource(TemplateContext context, String includeResource) Methods inherited from class liqp.LValue
areEqual, asAppendableObject, asArray, asBoolean, asFormattedNumber, asList, asMap, asNumber, asRubyDate, asStrictNumber, asString, asTemporal, canBeDouble, canBeInteger, canBeNumber, isArray, isBlank, isFalsy, isInteger, isMap, isNumber, isString, isTemporal, isTruthy, mapAsArray, temporalAsArray
-
Constructor Details
-
IncludeRelative
public IncludeRelative()
-
-
Method Details
-
detectSource
protected CharStreamWithLocation detectSource(TemplateContext context, String includeResource) throws IOException - Overrides:
detectSourcein classInclude- Throws:
IOException
-