Move theme options to renderer (#230)

This commit is contained in:
Kamran Ayub
2016-06-10 13:51:13 -05:00
committed by Blake Embrey
parent aab7af9e30
commit 5c8a666eb8
4 changed files with 35 additions and 38 deletions

View File

@@ -69,7 +69,7 @@ export class Renderer extends ChildableComponent<Application, RendererComponent>
type: ParameterType.String,
defaultValue: 'default'
})
themeName:string
themeName:string;
@Option({
name: 'disableOutputCheck',
@@ -78,7 +78,32 @@ export class Renderer extends ChildableComponent<Application, RendererComponent>
})
disableOutputCheck:boolean;
@Option({
name: 'gaID',
help: 'Set the Google Analytics tracking ID and activate tracking code.'
})
gaID:string;
@Option({
name: 'gaSite',
help: 'Set the site name for Google Analytics. Defaults to `auto`.',
defaultValue: 'auto'
})
gaSite:string;
@Option({
name: 'hideGenerator',
help: 'Do not print the TypeDoc link at the end of the page.',
type: ParameterType.Boolean
})
hideGenerator:boolean;
@Option({
name: 'entryPoint',
help: 'Specifies the fully qualified name of the root symbol. Defaults to global namespace.',
type: ParameterType.String
})
entryPoint:string;
/**
* Create a new Renderer instance.

View File

@@ -3,9 +3,9 @@ import {ProjectReflection} from "../models/reflections/project";
import {UrlMapping} from "./models/UrlMapping";
import {NavigationItem} from "./models/NavigationItem";
import {RendererComponent} from "./components";
import {Component} from "../utils/component";
import {Component, Option} from "../utils/component";
import {Resources} from "./utils/resources";
import {ParameterType} from "../utils/options/declaration";
/**
* Base class of all themes.
@@ -50,7 +50,7 @@ import {Resources} from "./utils/resources";
* of TypeDoc. If this file is not present, an instance of [[DefaultTheme]] will be used to render
* this theme.
*/
@Component({name:"rendrer:theme", internal:true})
@Component({name:"theme", internal:true})
export class Theme extends RendererComponent
{
/**

View File

@@ -8,9 +8,7 @@ import {ReflectionGroup} from "../../models/ReflectionGroup";
import {UrlMapping} from "../models/UrlMapping";
import {NavigationItem} from "../models/NavigationItem";
import {RendererEvent} from "../events";
import {Option} from "../../utils/component";
import {ParameterType} from "../../utils/options/declaration";
import {Component} from "../../utils/component";
/**
* Defines a mapping of a [[Models.Kind]] to a template file.
@@ -48,33 +46,6 @@ export interface ITemplateMapping
*/
export class DefaultTheme extends Theme
{
@Option({
name: 'gaID',
help: 'Set the Google Analytics tracking ID and activate tracking code.'
})
gaID:string;
@Option({
name: 'gaSite',
help: 'Set the site name for Google Analytics. Defaults to `auto`.',
defaultValue: 'auto'
})
gaSite:string;
@Option({
name: 'hideGenerator',
help: 'Do not print the TypeDoc link at the end of the page.',
type: ParameterType.Boolean
})
hideGenerator:boolean;
@Option({
name: 'entryPoint',
help: 'Specifies the fully qualified name of the root symbol. Defaults to global namespace.',
type: ParameterType.String
})
entryPoint:string;
/**
* Mappings of reflections kinds to templates used by this theme.
*/
@@ -170,7 +141,7 @@ export class DefaultTheme extends Theme
* @returns The reflection that should be used as the entry point.
*/
getEntryPoint(project:ProjectReflection):ContainerReflection {
var entryPoint = this.entryPoint;
var entryPoint = this.owner.entryPoint;
if (entryPoint) {
var reflection = project.getChildByName(entryPoint);
if (reflection) {

View File

@@ -62,9 +62,10 @@ describe('Renderer', function() {
it('constructs', function() {
app = new TypeDoc.Application({
mode: 'Modules',
logger: 'none',
logger: 'console',
target: 'ES5',
module: 'CommonJS',
gaSite: 'foo.com', // verify theme option without modifying output
noLib: true
});
});