WIP: fix up path issues

This commit is contained in:
Peter Bacon Darwin 2015-12-01 23:31:36 +00:00 committed by Naomi Black
parent eb37614d68
commit 3759d6e6db
6 changed files with 25 additions and 17 deletions

View File

@ -23,10 +23,15 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
.factory(require('./services/packageInfo'))
// Configure rendering
.config(function(templateFinder, templateEngine) {
.config(function(templateFinder, templateEngine, renderDocsProcessor) {
templateFinder.templateFolders
.unshift(path.resolve(__dirname, 'templates'));
// helpers are made available to the nunjucks templates
renderDocsProcessor.helpers.relativePath = function(from, to) {
return path.relative(from, to);
};
})
.config(function(parseTagsProcessor) {
@ -71,20 +76,23 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe
computePathsProcessor.pathTemplates.push({
docTypes: ['module'],
getPath: function computeModulePath(doc) {
return doc.id.replace(/^angular2\//, '');
doc.moduleFolder = doc.id.replace(/^angular2\//, '');
return doc.moduleFolder + '/index.html';
},
outputPathTemplate: '${path}/index.jade'
getOutputPath: function computeModulePath(doc) {
return doc.moduleFolder + '/index.jade';
}
});
computePathsProcessor.pathTemplates.push({
docTypes: EXPORT_DOC_TYPES,
pathTemplate: '${moduleDoc.path}/${name}-${docType}.html',
outputPathTemplate:'${moduleDoc.path}/${name}-${docType}.jade',
pathTemplate: '${moduleDoc.moduleFolder}/${name}-${docType}.html',
outputPathTemplate:'${moduleDoc.moduleFolder}/${name}-${docType}.jade',
});
computePathsProcessor.pathTemplates.push({
docTypes: ['jade-data'],
pathTemplate: '${originalDoc.path}/_data',
pathTemplate: '${originalDoc.moduleFolder}/_data',
outputPathTemplate: '${path}.json'
});

View File

@ -71,6 +71,9 @@ module.exports = function addJadeDataDocsProcessor() {
.sortBy('name')
.value();
doc.childPages = modulePageInfo;
console.log(doc.childPages);
// ADD TO APP DATA DOC
appDataDoc.data[doc.id] = modulePageInfo;

View File

@ -3,7 +3,7 @@
{% extends 'layout/base.template.html' -%}
{% block body %}
include ../../_util-fns
include {$ relativePath(doc.path, '_util-fns') $}
h2(class="{$ doc.docType $} export")
pre.prettyprint

View File

@ -3,7 +3,7 @@
{% extends 'layout/base.template.html' -%}
{% block body %}
include ../../_util-fns
include {$ relativePath(doc.path, '_util-fns') $}
.l-main-section
h2(class="function export")
pre.prettyprint

View File

@ -1,16 +1,13 @@
{% include "lib/githubLinks.html" -%}
{% extends 'layout/base.template.html' -%}
{% block body -%}
include ../../_util-fns
include {$ relativePath(doc.path, '_util-fns') $}
p.location-badge.
defined in {$ githubViewLink(doc) $}
ul
for page, slug in public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]]._data
if slug != 'index'
- var url = "/docs/" + current.path[1] + "/" + current.path[2] + "/" + current.path[3] + "/" + current.path[4] + "/" + slug + ".html"
li
!= partial("../../../../../_includes/_hover-card", {name: page.title, url: url })
{% for page in doc.childPages -%}
li
!= partial("{$ relativePath(doc.path, '../../../_includes/_hover-card') $}", {name: "{$ page.title $}", url: "{$ relativePath(doc.moduleFolder, page.exportDoc.path) $}" })
{% endfor %}
{% endblock %}

View File

@ -3,7 +3,7 @@
{% extends 'layout/base.template.html' %}
{% block body %}
include ../../_util-fns
include {$ relativePath(doc.path, '_util-fns') $}
.l-main-section
h2(class="variable export")
pre.prettyprint