Skip to content
This repository has been archived by the owner on Aug 27, 2019. It is now read-only.

Added support for branches #6

Merged
merged 2 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/default.htl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="/helpx/dist/styles.css"/>
<link rel="stylesheet" href="/${it.contextPath}/dist/styles.css"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,500,700"/>
</head>

<body>
<div class="header">
<h1><img src="/helpx/dist/adobe_logo.png"/>Launch, by Adobe, Documentation</h1>
<h1><img src="/${it.contextPath}/dist/adobe_logo.png"/>Launch, by Adobe, Documentation</h1>
</div>
<div class="main">
<div class="nav">
Expand Down
14 changes: 13 additions & 1 deletion src/default.pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ const moment = require('moment');
const request = require('request-promise');
const md2json = require('md2json');

/**
* Appends the context path to the resource based on the strain
* @param {RequestContext} ctx Context
*/
function setContextPath(ctx) {
ctx.resource.contextPath = ctx.strain;
return Promise.resolve(ctx);
};

/**
* Removes the first title from the resource children
* @param {RequestContext} ctx Context
Expand All @@ -25,7 +34,9 @@ function collectMetadata(ctx) {
ctx.strainConfig.urls.content.repo +
'/commits?path=' +
ctx.resourcePath +
'.md',
'.md' +
'&sha=' +
ctx.strainConfig.urls.content.ref,
headers: {
'User-Agent': 'Request-Promise'
},
Expand Down Expand Up @@ -107,6 +118,7 @@ module.exports.main = function (ctx) {
ctx.resource = ctx.resource || {};

return Promise.resolve(ctx)
.then(setContextPath)
.then(removeFirstTitle)
.then(collectMetadata)
.then(extractCommittersFromMetadata)
Expand Down