summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src/build_tools/generate_index.py
blob: 37c2a52d15f84c27f487f7d51c75425e5989eaef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

class LandingPage(object):
  def __init__(self):
    self.section_list = ['Tools', 'API', 'Concepts']
    self.section_map = collections.defaultdict(list)

  def GeneratePage(self, template_path):
    with open(template_path) as template_file:
      template = template_file.read()
    template_dict = { 'section_map': self.section_map }
    return easy_template.RunTemplateString(template, template_dict)

  def AddDesc(self, desc):
    group = desc['GROUP']
    assert group in self.section_list
    self.section_map[group].append(desc)