Improved publications jinja function

Now it's a class that only fetches the publications when requested, and caches
them.