1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const FS = require("fs");
|
4 | const Path = require("path");
|
5 | const DefaultTheme_1 = require("./DefaultTheme");
|
6 | const UrlMapping_1 = require("../models/UrlMapping");
|
7 | const index_1 = require("../../models/reflections/index");
|
8 | const events_1 = require("../events");
|
9 | const NavigationItem_1 = require("../models/NavigationItem");
|
10 | class MinimalTheme extends DefaultTheme_1.DefaultTheme {
|
11 | constructor(renderer, basePath) {
|
12 | super(renderer, basePath);
|
13 | renderer.removeComponent('assets');
|
14 | renderer.removeComponent('javascriptIndex');
|
15 | renderer.removeComponent('navigation');
|
16 | renderer.removeComponent('toc');
|
17 | this.listenTo(renderer, events_1.PageEvent.BEGIN, this.onRendererBeginPage);
|
18 | }
|
19 | isOutputDirectory(path) {
|
20 | if (!FS.existsSync(Path.join(path, 'index.html'))) {
|
21 | return false;
|
22 | }
|
23 | return true;
|
24 | }
|
25 | getUrls(project) {
|
26 | const urls = [];
|
27 | urls.push(new UrlMapping_1.UrlMapping('index.html', project, 'index.hbs'));
|
28 | project.url = 'index.html';
|
29 | project.anchor = undefined;
|
30 | project.hasOwnDocument = true;
|
31 | (project.children || []).forEach((child) => {
|
32 | DefaultTheme_1.DefaultTheme.applyAnchorUrl(child, project);
|
33 | });
|
34 | return urls;
|
35 | }
|
36 | onRendererBeginPage(page) {
|
37 | const model = page.model;
|
38 | if (!(model instanceof index_1.Reflection)) {
|
39 | return;
|
40 | }
|
41 | page.toc = new NavigationItem_1.NavigationItem();
|
42 | MinimalTheme.buildToc(page.model, page.toc);
|
43 | }
|
44 | static buildToc(model, parent) {
|
45 | const children = model.children || [];
|
46 | children.forEach((child) => {
|
47 | const item = NavigationItem_1.NavigationItem.create(child, parent, true);
|
48 | MinimalTheme.buildToc(child, item);
|
49 | });
|
50 | }
|
51 | }
|
52 | exports.MinimalTheme = MinimalTheme;
|
53 |
|
\ | No newline at end of file |