def construct_article_list()

in scripts/generate_api_docs.py [0:0]


def construct_article_list(modules_and_symbols):
    # Construct list of articles (converting symbols to lower-case and collating)
    # NOTE: Webservers and Windows machines can't seem to distinguish addresses by
    # case...
    articles = {}
    symbol_to_article = {}

    for mod_name, (module, symbols) in modules_and_symbols.items():
        if len(symbols):
            article_name = mod_name.lower()
            # Find a unique name
            if article_name in articles:
                suffix = 1
                while article_name + str(suffix) in articles:
                    suffix += 1
                article_name = article_name + str(suffix)

            articles[article_name] = (mod_name, module)
            symbol_to_article[mod_name] = article_name

            suffix = 0
            for symbol_name, symbol in symbols:
                full_name = mod_name + "." + symbol_name
                article_name = full_name.lower()

                # Find a unique name
                if article_name in articles:
                    suffix += 1
                    while article_name + str(suffix) in articles:
                        suffix += 1
                    article_name = article_name + str(suffix)

                articles[article_name] = (full_name, symbol)
                symbol_to_article[full_name] = article_name

    return articles, symbol_to_article