Skip to content

Commit

Permalink
Merge pull request #576 from stp-ip/fixLinking
Browse files Browse the repository at this point in the history
Fix linking in docs
  • Loading branch information
nzt-ventures authored Jan 24, 2020
2 parents 429a736 + c697ff4 commit 66d789d
Show file tree
Hide file tree
Showing 684 changed files with 162 additions and 3,166 deletions.
15 changes: 8 additions & 7 deletions _tests/align-generator/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs");
const path = require("path");
const prefix = "dev";
const { indexTemplate, index, content, list } = require('./templates');

const root = path.resolve(`${__dirname}/../..`);
Expand Down Expand Up @@ -105,7 +106,7 @@ Object.keys(fragments).forEach(fragment => {
alignments.forEach(alignment => {
fs.createReadStream(fragments[fragment].nested[dir][filename]).pipe(
fs.createWriteStream(
`${paths.devAligns}/${fragment}/${dir}-${alignment}/${filename}`
`${paths.devAligns}/${prefix}-${fragment}/${dir}-${alignment}/${filename}`
)
);
});
Expand All @@ -122,21 +123,21 @@ function parseBlackFriday(fragment, weight, content, filename, dir) {
return false;
}

if (!fs.existsSync(`${paths.devAligns}/${fragment}`)) {
fs.mkdirSync(`${paths.devAligns}/${fragment}`);
if (!fs.existsSync(`${paths.devAligns}/${prefix}-${fragment}`)) {
fs.mkdirSync(`${paths.devAligns}/${prefix}-${fragment}`);
}

if (dir && !fs.existsSync(`${paths.devAligns}/${fragment}/${dir}`)) {
if (dir && !fs.existsSync(`${paths.devAligns}/${prefix}-${fragment}/${dir}`)) {
alignments.forEach(alignment => {
const path = `${paths.devAligns}/${fragment}/${dir}-${alignment}`;
const path = `${paths.devAligns}/${prefix}-${fragment}/${dir}-${alignment}`;
if (!fs.existsSync(path)) {
fs.mkdirSync(path);
}
});
}

fs.writeFile(
`${paths.devAligns}/${fragment}/index.md`,
`${paths.devAligns}/${prefix}-${fragment}/index.md`,
indexTemplate.replace(/%fragment%/g, fragment),
"utf8",
() => {}
Expand All @@ -155,7 +156,7 @@ function parseBlackFriday(fragment, weight, content, filename, dir) {

// Write the edited config into the fragment, whether it's in a nested directory or not
fs.writeFile(
`${paths.devAligns}/${fragment +
`${paths.devAligns}/${prefix}${fragment +
(dir ? `/${dir}-${alignment}` : "")}/${filename +
(dir ? "" : `-${alignment}`)}.md`,
tmp,
Expand Down
2 changes: 1 addition & 1 deletion _tests/align-generator/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ headless = true
const list = `+++
fragment = "list"
weight = 110
section = "dev/alignments"
section = "dev/dev-alignments"
count = 1000
summary = false
tiled = true
Expand Down
15 changes: 8 additions & 7 deletions _tests/colors-generator/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs");
const path = require("path");
const prefix = "dev";
const { indexTemplate, index, content, list } = require('./templates');

const root = path.resolve(`${__dirname}/../..`);
Expand Down Expand Up @@ -104,7 +105,7 @@ Object.keys(fragments).forEach(fragment => {
backgrounds.forEach(background => {
fs.createReadStream(fragments[fragment].nested[dir][filename]).pipe(
fs.createWriteStream(
`${paths.devColors}/${fragment}/${dir}-${background}/${filename}`
`${paths.devColors}/${prefix}-${fragment}/${dir}-${background}/${filename}`
)
);
});
Expand All @@ -121,21 +122,21 @@ function parseBlackFriday(fragment, weight, content, filename, dir) {
return;
}

if (!fs.existsSync(`${paths.devColors}/${fragment}`)) {
fs.mkdirSync(`${paths.devColors}/${fragment}`);
if (!fs.existsSync(`${paths.devColors}/${prefix}-${fragment}`)) {
fs.mkdirSync(`${paths.devColors}/${prefix}-${fragment}`);
}

if (dir && !fs.existsSync(`${paths.devColors}/${fragment}/${dir}`)) {
if (dir && !fs.existsSync(`${paths.devColors}/${prefix}-${fragment}/${dir}`)) {
backgrounds.forEach(background => {
const path = `${paths.devColors}/${fragment}/${dir}-${background}`;
const path = `${paths.devColors}/${prefix}-${fragment}/${dir}-${background}`;
if (!fs.existsSync(path)) {
fs.mkdirSync(path);
}
});
}

fs.writeFile(
`${paths.devColors}/${fragment}/index.md`,
`${paths.devColors}/${prefix}-${fragment}/index.md`,
indexTemplate.replace(/%fragment%/g, fragment),
"utf8",
() => {}
Expand All @@ -146,7 +147,7 @@ function parseBlackFriday(fragment, weight, content, filename, dir) {
.replace(/background\s?=\s".*"/im, `background = "${background}"`)
.replace(/weight\s?=\s?"?\d+"?/im, `weight = ${weight + i}`);
fs.writeFile(
`${paths.devColors}/${fragment +
`${paths.devColors}/${prefix}-${fragment +
(dir ? `/${dir}-${background}` : "")}/${filename +
(dir ? "" : `-${background}`)}.md`,
tmp,
Expand Down
2 changes: 1 addition & 1 deletion _tests/colors-generator/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ headless = true
const list = `+++
fragment = "list"
weight = 110
section = "dev/colors"
section = "dev/dev-colors"
count = 1000
summary = false
tiled = true
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/content/dev/alignments/_index/list.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
fragment = "list"
weight = 110
section = "dev/alignments"
section = "dev/dev-alignments"
count = 1000
summary = false
tiled = true
Expand Down
51 changes: 0 additions & 51 deletions exampleSite/content/dev/alignments/buttons/buttons-center.md

This file was deleted.

51 changes: 0 additions & 51 deletions exampleSite/content/dev/alignments/buttons/buttons-left.md

This file was deleted.

This file was deleted.

51 changes: 0 additions & 51 deletions exampleSite/content/dev/alignments/buttons/buttons-outline-left.md

This file was deleted.

This file was deleted.

Loading

0 comments on commit 66d789d

Please sign in to comment.