module Jekyll::LiquidExtensions

def lookup_variable(context, variable)

or the variable name if not found.
Returns the value of the variable in the context

variable - the variable name, as a string.
context - the Liquid context in question.

Lookup a Liquid variable in the given context.
def lookup_variable(context, variable)
  lookup = context
  variable.split(".").each do |value|
    lookup = lookup[value]
  end
  lookup || variable
end