%s
\n" % esc(restaurant.human_name)
dist = ""
if "pos" in self.options and restaurant.pos and self.options.get("dist") :
dist = "
Distance: %.2f km
\n" % base.dist(options["pos"], restaurant.pos)
body = "\n".join([self.format_category(cat, it) for cat,it in food.items()])
return st+dist+body+"
"
def render (self, foods, **options) :
## Expects list of tuples with (Restaurant, Foodlist)
self.options = options
r = "\n".join([self.format_restaurant(restaurant, food) for restaurant, food in foods ])
if options.get("template") :
f = open(options["template"], "r")
template = f.read()
f.close()
print(template.replace("$$TEXT$$", r))
else :
print(r)
def register_renderer(self) :
base.register_renderer(base.Renderer("html", "HTML Renderer", self))