Comparing version 0.3.0 to 0.3.1
@@ -92,4 +92,10 @@ 'use strict'; | ||
function renderNavList(navTree, catName) { | ||
let catNames = catName.split(':'); | ||
catName = catNames[0]; | ||
let toSize = 0; | ||
if(catNames[1]) { | ||
toSize = Number(catNames[1]) || 0; | ||
} | ||
let reg = new RegExp(catName); | ||
let tree = getNavTree(navTree, reg, false); | ||
let tree = getNavTree(navTree, reg, false, toSize); | ||
let navTplPath = getTpl('nav.pug'); | ||
@@ -152,13 +158,3 @@ let navHtml = pug.renderFile(navTplPath, { | ||
function defineFile(item, docDir) { | ||
let { filepath, tabSize, basename, noFile } = item; | ||
if(noFile) { | ||
return { | ||
title: basename, | ||
tabSize: tabSize, | ||
url: 'javascript:;', | ||
basename: basename, | ||
filepath: filepath, | ||
keywords: [] | ||
}; | ||
} | ||
let { filepath, tabSize, basename } = item; | ||
let codeStr = fs.readFileSync(filepath, 'utf8'); | ||
@@ -210,3 +206,4 @@ let blocks = utils.getCodeBlocks(codeStr); | ||
function getNavTree(navTree, filterReg, isBlack) { | ||
function getNavTree(navTree, filterReg, isBlack, toSize) { | ||
toSize = toSize || 0; | ||
let tree = []; | ||
@@ -228,2 +225,3 @@ let baseSize = 1000; | ||
item.tabSize -= baseSize; | ||
item.tabSize += toSize; | ||
}); | ||
@@ -230,0 +228,0 @@ return tree; |
@@ -11,3 +11,2 @@ 'use strict'; | ||
let dirName = path.basename(treeDir); | ||
let hasIndex = false; | ||
for (let i = 0, l = files.length; i < l ; i++) { | ||
@@ -30,3 +29,2 @@ let filename = files[i]; | ||
items.unshift(item); | ||
hasIndex = true; | ||
} else if(isMarkdown) { | ||
@@ -37,10 +35,2 @@ items.push(item); | ||
} | ||
if(!hasIndex) { | ||
items.unshift({ | ||
tabSize: tabSize - 1, | ||
basename: dirName, | ||
filepath: treeDir, | ||
noFile: true, | ||
}); | ||
} | ||
return items; | ||
@@ -47,0 +37,0 @@ }); |
{ | ||
"name": "cldoc", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Example", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
866927
7113