1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
10 return cmp(x
['NAME'], y
['NAME'])
12 class LandingPage(object):
14 self
.section_list
= ['Getting Started', 'API', 'Benchmarks', 'Demo',
16 self
.section_map
= collections
.defaultdict(list)
18 def GeneratePage(self
, template_path
):
19 with
open(template_path
) as template_file
:
20 template
= template_file
.read()
23 for section_name
in self
.section_map
:
24 items
= self
.section_map
[section_name
]
25 items
= sorted(items
, cmp=CmpByName
)
26 sec_map
[section_name
] = items
28 template_dict
= { 'section_map': sec_map
}
29 return easy_template
.RunTemplateString(template
, template_dict
)
31 def AddDesc(self
, desc
):
33 assert group
in self
.section_list
34 self
.section_map
[group
].append(desc
)