Fixed Jinja dependency scanning with dynamic deps

If a Jinja template contains an include or extends with a variable instead
of a constant string, find_referenced_templates yields None for that
dependency. This could cause the dependency scanning algorithm to crash.
Merge pull request #512 from koniiiik/jinja-dependencies2

Fixed Jinja dependency scanning with dynamic deps