<commit_before>declare module td
{
    export interface IOptions
    {
        /**
         * The Google Analytics tracking ID that should be used. When not set, the tracking code
         * should be omitted.
         */
        gaID?:string;

        /**
         * Optional site name for Google Analytics. Defaults to `auto`.
         */
        gaSite?:string;

        /**
         * Should we hide the TypeDoc link at the end of the page?
         */
        hideGenerator?:boolean;

        /**
         * Specifies the fully qualified name of the root symbol. Defaults to global namespace.
         */
        entryPoint?:string;
    }
}


module td.output
{
    /**
     * Defines a mapping of a [[Models.Kind]] to a template file.
     *
     * Used by [[DefaultTheme]] to map reflections to output files.
     */
    export interface ITemplateMapping
    {
        /**
         * [[DeclarationReflection.kind]] this rule applies to.
         */
        kind:models.ReflectionKind[];

        /**
         * Can this mapping have children or should all further reflections be rendered
         * to the defined output page?
         */
        isLeaf:boolean;

        /**
         * The name of the directory the output files should be written to.
         */
        directory:string;

        /**
         * The name of the template that should be used to render the reflection.
         */
        template:string;
    }


    /**
     * Default theme implementation of TypeDoc. If a theme does not provide a custom
     * [[BaseTheme]] implementation, this theme class will be used.
     */
    export class DefaultTheme extends Theme implements IParameterProvider
    {
        /**
         * Mappings of reflections kinds to templates used by this theme.
         */
        static MAPPINGS:ITemplateMapping[] = [{
            kind:      [models.ReflectionKind.Class],
            isLeaf:    false,
            directory: 'classes',
            template:  'reflection.hbs'
        },{
            kind:      [models.ReflectionKind.Interface],
            isLeaf:    false,
            directory: 'interfaces',
            template:  'reflection.hbs'
        },{
            kind:      [models.ReflectionKind.Enum],
            isLeaf:    false,
            directory: 'enums',
            template:  'reflection.hbs'
        },{
            kind:      [models.ReflectionKind.Module, models.ReflectionKind.ExternalModule],
            isLeaf:    false,
            directory: 'modules',
            template:  'reflection.hbs'
        }];



        /**
         * Create a new DefaultTheme instance.
         *
         * @param renderer  The renderer this theme is attached to.
         * @param basePath  The base path of this theme.
         */
        constructor(renderer:Renderer, basePath:string) {
            super(renderer, basePath);
            renderer.on(Renderer.EVENT_BEGIN, this.onRendererBegin, this, 1024);
        }


        /**
         * Test whether the given path contains a documentation generated by this theme.
         *
         * @param path  The path of the directory that should be tested.
         * @returns     TRUE if the given path seems to be a previous output directory,
         *              otherwise FALSE.
         */
        isOutputDirectory(path:string):boolean {
            if (!FS.existsSync(Path.join(path, 'index.html'))) return false;
            if (!FS.existsSync(Path.join(path, 'assets'))) return false;
            if (!FS.existsSync(Path.join(path, 'assets', 'js', 'main.js'))) return false;
            if (!FS.existsSync(Path.join(path, 'assets', 'images', 'icons.png'))) return false;

            return true;
        }


        getParameters():IParameter[] {
            return <IParameter[]>[{
                name: 'gaID',
                help: 'Set the Google Analytics tracking ID and activate tracking code.'
            },{
                name: 'gaSite',
                help: 'Set the site name for Google Analytics. Defaults to `auto`.',
                defaultValue: 'auto'
            },{
                name: 'hideGenerator',
                help: 'Do not print the TypeDoc link at the end of the page.',
                type: ParameterType.Boolean
            },{
                name: 'entryPoint',
                help: 'Specifies the fully qualified name of the root symbol. Defaults to global namespace.',
                type: ParameterType.String
            }];
        }


        /**
         * Map the models of the given project to the desired output files.
         *
         * @param project  The project whose urls should be generated.
         * @returns        A list of [[UrlMapping]] instances defining which models
         *                 should be rendered to which files.
         */
        getUrls(project:models.ProjectReflection):UrlMapping[] {
            var urls = [];
            var entryPoint = this.getEntryPoint(project);

            if (this.renderer.application.options.readme == 'none') {
                entryPoint.url = 'index.html';
                urls.push(new UrlMapping('index.html', entryPoint, 'reflection.hbs'));
            } else {
                entryPoint.url = 'globals.html';
                urls.push(new UrlMapping('globals.html', entryPoint, 'reflection.hbs'));
                urls.push(new UrlMapping('index.html',   entryPoint, 'index.hbs'));
            }

            if (entryPoint.children) {
                entryPoint.children.forEach((child) => {
                    DefaultTheme.buildUrls(child, urls);
                });
            }

            return urls;
        }


        /**
         * Return the entry point of the documentation.
         *
         * @param project  The current project.
         * @returns The reflection that should be used as the entry point.
         */
        getEntryPoint(project:models.ProjectReflection):models.ContainerReflection {
            var entryPoint = this.renderer.application.options.entryPoint;
            if (entryPoint) {
                var reflection = project.getChildByName(entryPoint);
                if (reflection) {
                    if (reflection instanceof models.ContainerReflection) {
                        return reflection;
                    } else {
                        this.renderer.application.logger.warn('The given entry point `%s` is not a container.', entryPoint);
                    }<commit_msg>Display readme in index.html even if entryPoint is specified, see #114<commit_after>declare module td
{
    export interface IOptions
    {
        /**
         * The Google Analytics tracking ID that should be used. When not set, the tracking code
         * should be omitted.
         */
        gaID?:string;

        /**
         * Optional site name for Google Analytics. Defaults to `auto`.
         */
        gaSite?:string;

        /**
         * Should we hide the TypeDoc link at the end of the page?
         */
        hideGenerator?:boolean;

        /**
         * Specifies the fully qualified name of the root symbol. Defaults to global namespace.
         */
        entryPoint?:string;
    }
}


module td.output
{
    /**
     * Defines a mapping of a [[Models.Kind]] to a template file.
     *
     * Used by [[DefaultTheme]] to map reflections to output files.
     */
    export interface ITemplateMapping
    {
        /**
         * [[DeclarationReflection.kind]] this rule applies to.
         */
        kind:models.ReflectionKind[];

        /**
         * Can this mapping have children or should all further reflections be rendered
         * to the defined output page?
         */
        isLeaf:boolean;

        /**
         * The name of the directory the output files should be written to.
         */
        directory:string;

        /**
         * The name of the template that should be used to render the reflection.
         */
        template:string;
    }


    /**
     * Default theme implementation of TypeDoc. If a theme does not provide a custom
     * [[BaseTheme]] implementation, this theme class will be used.
     */
    export class DefaultTheme extends Theme implements IParameterProvider
    {
        /**
         * Mappings of reflections kinds to templates used by this theme.
         */
        static MAPPINGS:ITemplateMapping[] = [{
            kind:      [models.ReflectionKind.Class],
            isLeaf:    false,
            directory: 'classes',
            template:  'reflection.hbs'
        },{
            kind:      [models.ReflectionKind.Interface],
            isLeaf:    false,
            directory: 'interfaces',
            template:  'reflection.hbs'
        },{
            kind:      [models.ReflectionKind.Enum],
            isLeaf:    false,
            directory: 'enums',
            template:  'reflection.hbs'
        },{
            kind:      [models.ReflectionKind.Module, models.ReflectionKind.ExternalModule],
            isLeaf:    false,
            directory: 'modules',
            template:  'reflection.hbs'
        }];



        /**
         * Create a new DefaultTheme instance.
         *
         * @param renderer  The renderer this theme is attached to.
         * @param basePath  The base path of this theme.
         */
        constructor(renderer:Renderer, basePath:string) {
            super(renderer, basePath);
            renderer.on(Renderer.EVENT_BEGIN, this.onRendererBegin, this, 1024);
        }


        /**
         * Test whether the given path contains a documentation generated by this theme.
         *
         * @param path  The path of the directory that should be tested.
         * @returns     TRUE if the given path seems to be a previous output directory,
         *              otherwise FALSE.
         */
        isOutputDirectory(path:string):boolean {
            if (!FS.existsSync(Path.join(path, 'index.html'))) return false;
            if (!FS.existsSync(Path.join(path, 'assets'))) return false;
            if (!FS.existsSync(Path.join(path, 'assets', 'js', 'main.js'))) return false;
            if (!FS.existsSync(Path.join(path, 'assets', 'images', 'icons.png'))) return false;

            return true;
        }


        getParameters():IParameter[] {
            return <IParameter[]>[{
                name: 'gaID',
                help: 'Set the Google Analytics tracking ID and activate tracking code.'
            },{
                name: 'gaSite',
                help: 'Set the site name for Google Analytics. Defaults to `auto`.',
                defaultValue: 'auto'
            },{
                name: 'hideGenerator',
                help: 'Do not print the TypeDoc link at the end of the page.',
                type: ParameterType.Boolean
            },{
                name: 'entryPoint',
                help: 'Specifies the fully qualified name of the root symbol. Defaults to global namespace.',
                type: ParameterType.String
            }];
        }


        /**
         * Map the models of the given project to the desired output files.
         *
         * @param project  The project whose urls should be generated.
         * @returns        A list of [[UrlMapping]] instances defining which models
         *                 should be rendered to which files.
         */
        getUrls(project:models.ProjectReflection):UrlMapping[] {
            var urls = [];
            var entryPoint = this.getEntryPoint(project);

            if (this.renderer.application.options.readme == 'none') {
                entryPoint.url = 'index.html';
                urls.push(new UrlMapping('index.html', entryPoint, 'reflection.hbs'));
            } else {
                entryPoint.url = 'globals.html';
                urls.push(new UrlMapping('globals.html', entryPoint, 'reflection.hbs'));
                urls.push(new UrlMapping('index.html',   project, 'index.hbs'));
            }

            if (entryPoint.children) {
                entryPoint.children.forEach((child) => {
                    DefaultTheme.buildUrls(child, urls);
                });
            }

            return urls;
        }


        /**
         * Return the entry point of the documentation.
         *
         * @param project  The current project.
         * @returns The reflection that should be used as the entry point.
         */
        getEntryPoint(project:models.ProjectReflection):models.ContainerReflection {
            var entryPoint = this.renderer.application.options.entryPoint;
            if (entryPoint) {
                var reflection = project.getChildByName(entryPoint);
                if (reflection) {
                    if (reflection instanceof models.ContainerReflection) {
                        return reflection;
                    } else {
                        this.renderer.application.logger.warn('The given entry point `%s` is not a container.', entryPoint);
                    }
{'fraction_non_alphanumeric': 0.09444872783346184, 'fraction_numerical': 0.0008481110254433307, 'mean_word_length': 1.6077603538399678, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7470186', 'n_tokens_mistral': 3242, 'n_tokens_neox': 3118, 'n_words': 992}