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

Commit

Permalink
179 - Added support for branches
Browse files Browse the repository at this point in the history
  • Loading branch information
kptdobe authored Jun 18, 2018
2 parents 5595f9c + 46709cf commit 05c61cc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
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

0 comments on commit 05c61cc

Please sign in to comment.