blob: 4061165b13c43661cb33b0b5f007df97daf90d18 [file] [log] [blame]
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import easy_template
def CmpByName(x, y):
return cmp(x['NAME'], y['NAME'])
class LandingPage(object):
def __init__(self):
self.section_list = ['Getting Started', 'API', 'Demo', 'Tutorial']
self.section_map = collections.defaultdict(list)
def GeneratePage(self, template_path):
with open(template_path) as template_file:
template =
sec_map = {}
for section_name in self.section_map:
items = self.section_map[section_name]
items = sorted(items, cmp=CmpByName)
sec_map[section_name] = items
template_dict = { 'section_map': sec_map }
return easy_template.RunTemplateString(template, template_dict)
def AddDesc(self, desc):
group = desc['GROUP']
assert group in self.section_list