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YAC3B,2BAAY,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IAOO,0CAAmB,GAA3B,UAA4B,IAAe;QACvC,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,kBAAU,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,CAAC;QACX,CAAC;QAED,IAAI,CAAC,GAAG,GAAG,IAAI,+BAAc,EAAE,CAAC;QAChC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAQM,qBAAQ,GAAf,UAAgB,KAA4B,EAAE,MAAsB;QAChE,IAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;QACtC,QAAQ,CAAC,OAAO,CAAC,UAAC,KAA4B;YAC1C,IAAM,IAAI,GAAG,+BAAc,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YACxD,YAAY,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC;IACL,mBAAC;AAAD,CAAC,AAlFD,CAAkC,2BAAY,GAkF7C;AAlFY,oCAAY","sourcesContent":["import * as FS from 'fs';\nimport * as Path from 'path';\n\nimport {DefaultTheme} from './DefaultTheme';\nimport {Renderer} from '../renderer';\nimport {UrlMapping} from '../models/UrlMapping';\nimport {Reflection, DeclarationReflection, ProjectReflection} from '../../models/reflections/index';\nimport {PageEvent} from '../events';\nimport {NavigationItem} from '../models/NavigationItem';\n\nexport class MinimalTheme extends DefaultTheme {\n /**\n * Create a new DefaultTheme instance.\n *\n * @param renderer The renderer this theme is attached to.\n * @param basePath The base path of this theme.\n */\n constructor(renderer: Renderer, basePath: string) {\n super(renderer, basePath);\n\n renderer.removeComponent('assets');\n renderer.removeComponent('javascriptIndex');\n renderer.removeComponent('navigation');\n renderer.removeComponent('toc');\n\n this.listenTo(renderer, PageEvent.BEGIN, this.onRendererBeginPage);\n }\n\n /**\n * Test whether the given path contains a documentation generated by this theme.\n *\n * @param path The path of the directory that should be tested.\n * @returns TRUE if the given path seems to be a previous output directory,\n * otherwise FALSE.\n */\n isOutputDirectory(path: string): boolean {\n if (!FS.existsSync(Path.join(path, 'index.html'))) {\n return false;\n }\n return true;\n }\n\n /**\n * Map the models of the given project to the desired output files.\n *\n * @param project The project whose urls should be generated.\n * @returns A list of [[UrlMapping]] instances defining which models\n * should be rendered to which files.\n */\n getUrls(project: ProjectReflection): UrlMapping[] {\n const urls: UrlMapping[] = [];\n urls.push(new UrlMapping('index.html', project, 'index.hbs'));\n\n project.url = 'index.html';\n project.anchor = null;\n project.hasOwnDocument = true;\n\n project.children.forEach((child) => {\n DefaultTheme.applyAnchorUrl(child, project);\n });\n\n return urls;\n }\n\n /**\n * Triggered before a document will be rendered.\n *\n * @param page An event object describing the current render operation.\n */\n private onRendererBeginPage(page: PageEvent) {\n const model = page.model;\n if (!(model instanceof Reflection)) {\n return;\n }\n\n page.toc = new NavigationItem();\n MinimalTheme.buildToc(page.model, page.toc);\n }\n\n /**\n * Create a toc navigation item structure.\n *\n * @param model The models whose children should be written to the toc.\n * @param parent The parent [[Models.NavigationItem]] the toc should be appended to.\n */\n static buildToc(model: DeclarationReflection, parent: NavigationItem) {\n const children = model.children || [];\n children.forEach((child: DeclarationReflection) => {\n const item = NavigationItem.create(child, parent, true);\n MinimalTheme.buildToc(child, item);\n });\n }\n}\n"]}
|