fix(client): proper link to the guide for a hint button

This commit is contained in:
Valeriy
2019-01-15 01:44:42 +03:00
committed by Stuart Taylor
parent 9b75c1965a
commit 261b1e197f
4 changed files with 11 additions and 21 deletions

View File

@ -23,8 +23,8 @@ function NoArticles() {
Could you  Could you 
<a <a
href={ href={
'https://github.com/freeCodeCamp/guides/blob/master/README.md' + 'https://github.com/freeCodeCamp/freeCodeCamp/blob/master/docs/' +
'#freecodecamp-guide' 'how-to-work-on-guide-articles.md#how-to-work-on-guide-articles'
} }
rel='noopener noreferrer' rel='noopener noreferrer'
target='_blank' target='_blank'

View File

@ -1,7 +1,7 @@
const guideBase = 'https://guide.freecodecamp.org/certifications'; const guideBase = '/guide/certifications';
export function createGuideUrl(slug = '') { export function createGuideUrl(slug = '') {
return guideBase + slug; return guideBase + slug.replace(/^\/learn\//, '/');
} }
export function isGoodXHRStatus(status) { export function isGoodXHRStatus(status) {

View File

@ -2,9 +2,7 @@ exports.dasherize = function dasherize(name) {
return ('' + name) return ('' + name)
.toLowerCase() .toLowerCase()
.replace(/\s/g, '-') .replace(/\s/g, '-')
.replace(/[^a-z0-9\-.]/gi, '') .replace(/[^a-z0-9\-.]/gi, '');
.replace(/\./g, '-')
.replace(/:/g, '');
}; };
exports.nameify = function nameify(str) { exports.nameify = function nameify(str) {

View File

@ -1,6 +1,7 @@
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const matter = require('gray-matter'); const matter = require('gray-matter');
const { dasherize } = require('../../../client/utils');
const pass = true; const pass = true;
@ -36,22 +37,13 @@ exports.checkGuideFile = function checkGuideFile(file) {
function checkDirName(dirName, fullPath) { function checkDirName(dirName, fullPath) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (dirName.replace(/(\s|\_)/, '') !== dirName) { if (dasherize(dirName) !== dirName) {
return reject( return reject(
new Error(` new Error(`
Invalid character found in '${dirName}', please use '-' for spaces Invalid or upper case character found in '${dirName}', please use '-' for spaces
and all folder names must be lower case. Valid characters are [a-z0-9\\-.].
Found in: Found in:
${fullPath}
`)
);
}
if (dirName.toLowerCase() !== dirName) {
return reject(
new Error(`
Upper case characters found in ${dirName}, all folder names must be lower case
Found in :
${fullPath} ${fullPath}
`) `)
); );
@ -107,7 +99,7 @@ exports.checkFrontmatter = function checkFrontmatter(
} catch (e) { } catch (e) {
console.log(` console.log(`
The below occured in: The below occurred in:
${fullPath} ${fullPath}