fix for issue with check-deploy failing
This commit is contained in:
parent
61c6b7d5af
commit
09597710c7
|
@ -51,7 +51,7 @@
|
||||||
"marked": "^0.3.5",
|
"marked": "^0.3.5",
|
||||||
"minimatch": "^2.0.10",
|
"minimatch": "^2.0.10",
|
||||||
"node-html-encoder": "0.0.2",
|
"node-html-encoder": "0.0.2",
|
||||||
"nodegit": "0.4.1",
|
"nodegit": "0.5.0",
|
||||||
"path": "^0.11.14",
|
"path": "^0.11.14",
|
||||||
"prompt": "^0.2.14",
|
"prompt": "^0.2.14",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
|
|
|
@ -21,12 +21,13 @@ module.exports = function checkUnbalancedBackTicks(log, createDocMessage) {
|
||||||
var BACKTICK_REGEX = /^ *```/gm;
|
var BACKTICK_REGEX = /^ *```/gm;
|
||||||
|
|
||||||
// captures below
|
// captures below
|
||||||
// 1st is entire ``` with leading 2 blanks
|
// 1st is entire ``` including leading whitespace
|
||||||
// 2nd is the name of the language (if any) specified after the ```
|
// 2nd is the leading whitespace on the line before the ``` fence
|
||||||
// 3nd is the contents of the ``` block up until but not including the first non whitespace char after the end ```
|
// 3rd is the name of the language (if any) specified after the ```
|
||||||
// 4th is the padding of the first nonblank line following the backtick block
|
// 4th is the contents of the ``` block up until but not including the first non whitespace char after the end ```
|
||||||
// 5th is the first char on the next line.
|
// 5th is the padding of the first nonblank line following the backtick block
|
||||||
var BACKTICK_CAPTURE = /( ```(.*$)([^]*?)```\s*)^(\s*)(\S)/m;
|
// 6th is the first char on the next line.
|
||||||
|
var BACKTICK_CAPTURE = /(( *)```(.*$)([^]*?)```\s*)^(\s*)(\S)/m;
|
||||||
|
|
||||||
var CODE_EXAMPLE = 'code-example(format="linenums" language="js").';
|
var CODE_EXAMPLE = 'code-example(format="linenums" language="js").';
|
||||||
return {
|
return {
|
||||||
|
@ -45,19 +46,23 @@ module.exports = function checkUnbalancedBackTicks(log, createDocMessage) {
|
||||||
var captures = BACKTICK_CAPTURE.exec(doc.renderedContent);
|
var captures = BACKTICK_CAPTURE.exec(doc.renderedContent);
|
||||||
while (captures) {
|
while (captures) {
|
||||||
var entireBlock = captures[1];
|
var entireBlock = captures[1];
|
||||||
var language = captures[2];
|
var prePad = captures[2];
|
||||||
var blockContents = captures[3];
|
var language = captures[3];
|
||||||
var pad = captures[4];
|
var blockContents = captures[4];
|
||||||
var nextBlockStartChar = captures[5];
|
var postPad = captures[5];
|
||||||
|
var nextBlockStartChar = captures[6];
|
||||||
var codeExamplePrefix = language.length ? CODE_EXAMPLE.replace('js', language) : CODE_EXAMPLE;
|
var codeExamplePrefix = language.length ? CODE_EXAMPLE.replace('js', language) : CODE_EXAMPLE;
|
||||||
var replaceVal = codeExamplePrefix + escapeHtml(blockContents) + '\n';
|
// modulo op in next line insures that pad is always a multiple of 2 ( jade whitespace).
|
||||||
|
var newPrePad = prePad.substr(2 + (prePad.length % 2)); // exdent
|
||||||
|
var replaceVal = '\n' + newPrePad + codeExamplePrefix + escapeHtml(blockContents) + '\n';
|
||||||
// if nextBlock does NOT start with a '.' then we want to restart a markdown block.
|
// if nextBlock does NOT start with a '.' then we want to restart a markdown block.
|
||||||
// and that block needs to be exdented from the preceding code-example content.
|
// and that block needs to be exdented from the preceding code-example content.
|
||||||
if (nextBlockStartChar != '.') {
|
if (nextBlockStartChar != '.') {
|
||||||
if (pad.length >= 2) {
|
if (postPad.length >= 2) {
|
||||||
pad = pad.substr(2); // exdent
|
// modulo op in next line insures that pad is always a multiple of 2 ( jade whitespace).
|
||||||
|
postPad = postPad.substr(2 + (postPad.length % 2)); // exdent
|
||||||
}
|
}
|
||||||
replaceVal = replaceVal + pad + ':markdown\n';
|
replaceVal = replaceVal + postPad + ':markdown\n';
|
||||||
}
|
}
|
||||||
doc.renderedContent = doc.renderedContent.replace(entireBlock, replaceVal);
|
doc.renderedContent = doc.renderedContent.replace(entireBlock, replaceVal);
|
||||||
captures = BACKTICK_CAPTURE.exec(doc.renderedContent);
|
captures = BACKTICK_CAPTURE.exec(doc.renderedContent);
|
||||||
|
|
Loading…
Reference in New Issue