Skip to content

Commit

Permalink
修改 markdown 的生成路径以及其他
Browse files Browse the repository at this point in the history
  • Loading branch information
kahn1990 committed Jul 15, 2016
1 parent d8ccf17 commit f9dc7fd
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 108 deletions.
35 changes: 14 additions & 21 deletions lib/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ module.exports = function (options, callback) {
generateProjectPath : options.source.output,
generateGlobalPath : outputGlobalPath,
fileNameObject : fileNameObject,
sourceProjectPath : '',
staticLoadRelativePath: path.relative(outputGlobalPath, outputGlobalPath),
sourceProjectPath : '.',
staticLoadRelativePath: '.',
content : markdown(sourceFileContentCache),
indexs : getIndexs(sourceFileContentCache, 0, function (item, i) {
return item.level > (i - 1);
Expand All @@ -348,7 +348,7 @@ function writeJsdocListFile(outputGlobalPath, generateAllJsFileInfoForJson) {

function eachFuncObj(eachFuncObjParam) {
_.each(eachFuncObjParam, function (item) {
queryFuncName(item.fileList)
queryFuncName(item.fileList);
if (item.childDir.length > 0) {
eachFuncObj(item.childDir);
}
Expand All @@ -358,25 +358,18 @@ function writeJsdocListFile(outputGlobalPath, generateAllJsFileInfoForJson) {
function queryFuncName(itemParam) {
_.each(itemParam, function (fileItem) {
_.each(fileItem.content, function (fileContentItem) {
var ctxName = '';
if (fileContentItem.ctx) {
if (fileContentItem.ctx.name) {
ctxName = fileContentItem.ctx.name;
} else {
ctxName = null
generateAllJsFileInfoForJsonCache.push({
staticLoadRelativePath: fileItem.staticLoadRelativePath,
sourceProjectPath : fileItem.sourceProjectPath,
fileNameObject : fileItem.fileNameObject,
name : fileContentItem.ctx.name,
line : fileContentItem.line,
codeStart : fileContentItem.codeStart
})
}
} else {
ctxName = null
}

generateAllJsFileInfoForJsonCache.push({
staticLoadRelativePath: fileItem.staticLoadRelativePath,
sourceProjectPath : fileItem.sourceProjectPath,
fileNameObject : fileItem.fileNameObject,
name : ctxName,
line : fileContentItem.line,
codeStart : fileContentItem.codeStart
})
});
});
}
Expand All @@ -395,11 +388,11 @@ function writeJsdocListFile(outputGlobalPath, generateAllJsFileInfoForJson) {
*/
function creatFileFuncByMarkdown(projectHomePath, outputGlobalPath, dirsMarkdownArrContainer) {
_.each(dirsMarkdownArrContainer, function (item) {

item.fileNameObject.relativeProjectPathFile = path.relative(outputGlobalPath,item.generatePathFile);
markdownFileListIndexContainer.push(item.fileNameObject);

fs.writeFileSync(
path.join(outputGlobalPath,item.fileNameObject.generateFile),
item.generatePathFile,
swig.render(
getTemplates.markdown,
{
Expand All @@ -416,7 +409,7 @@ function creatFileFuncByMarkdown(projectHomePath, outputGlobalPath, dirsMarkdown
),
'utf8'
);
console.log('start write markdown file [' + path.join(outputGlobalPath,item.fileNameObject.generateFile) + '] done');
console.log('start write markdown file [' + item.generatePathFile + '] done');
});
}
// 生成文档
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsdoc-zero",
"version": "0.0.13",
"version": "0.0.14",
"description": "Generate documentation by jsdoc.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion templates/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="jumbotron headerBg">
<div class="container">
<div class="page-header">
<h1>index.html
<h1>JSDOC-ZERO
<small>
<a class="btn btn-primary btn-lg btn-back-home" href="./index.html" role="button">返回目录</a>
<a class="btn btn-primary btn-lg btn-back-roothome" href="{{staticLoadRelativePath}}/index.html"
Expand Down
2 changes: 1 addition & 1 deletion templates/indexZero.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1>{{fileName}} <small>目录索引</small></h1>
<div class="col-xs-12"><h1 class="text-center heading -page-download">Markdown 文件</h1></div>
{% for key, val in content.linkList %}
<div class="col-xs-12 col-sm-4">
<a href="./{{val.generateFile}}" class="col-xs-12 link -download">
<a href="./{{val.relativeProjectPathFile}}" class="col-xs-12 link -download">
<i class="icon-linux"></i>{{ val.fileHasExtname }}
</a>
</div>
Expand Down
1 change: 1 addition & 0 deletions templates/jsdoc_static/api/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ div.headerBg .panel-body h3 {

div.headerBg .panel-footer {
display: inline-block;
width: 100%;
}

.site-header {
Expand Down
62 changes: 62 additions & 0 deletions templates/jsdoc_static/markdown/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,66 @@
-webkit-box-shadow: inset 0 0 10px #0CC;
-moz-box-shadow: inset 0 0 10px #0CC;
box-shadow: inset 0 0 10px #0CC;
}
.forkme {
position: fixed;
right: -60px;
bottom: 50px;
z-index: 10;
line-height: 30px;
text-align: center;
width: 250px;
font-size: 16px;
text-decoration: none;
color: #f5f5f5 !important;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transition: none;
-moz-transition: none;
-ms-transition: none;
-o-transition: none;
transition: none;
font-weight: bold;
text-shadow: -1px 1px 1px rgba(0, 0, 0, 0.7);
-webkit-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-moz-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-ms-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-o-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
border-collapse: separate;
border: 1px solid #000;
background-color: #363644;
background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(#4c5b63), to(#363644));
background-image: -webkit-radial-gradient(circle, #4c5b63, #363644);
background-image: -moz-radial-gradient(circle, #4c5b63, #363644);
background-image: -ms-radial-gradient(circle, #4c5b63, #363644);
background-image: -o-radial-gradient(circle, #4c5b63, #363644);
background-repeat: no-repeat;
text-decoration: none;
display: inline-block;
padding: 2px;
margin: -2px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}

.forkme:hover {
text-decoration: none;
background-color: #4d4d60;
background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(#627680), to(#4d4d60));
background-image: -webkit-radial-gradient(circle, #627680, #4d4d60);
background-image: -moz-radial-gradient(circle, #627680, #4d4d60);
background-image: -ms-radial-gradient(circle, #627680, #4d4d60);
background-image: -o-radial-gradient(circle, #627680, #4d4d60);
background-repeat: no-repeat;
-webkit-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-moz-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-ms-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-o-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
border-collapse: separate
}
104 changes: 20 additions & 84 deletions templates/markdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,8 @@
<meta charset="utf-8">
<title>索引</title>
<link rel="stylesheet" href="{{staticLoadRelativePath}}/jsdoc_static/markdown/base.css">
<link id="linkstyle" rel='stylesheet' href='./jsdoc_static/markdown/markdown16.css'/>
<link rel="stylesheet" href="./jsdoc_static/prettify.min.css">
<style>
.forkme {
position: fixed;
right: -60px;
bottom: 50px;
z-index: 10;
line-height: 30px;
text-align: center;
width: 250px;
font-size: 16px;
text-decoration: none;
color: #f5f5f5 !important;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transition: none;
-moz-transition: none;
-ms-transition: none;
-o-transition: none;
transition: none;
font-weight: bold;
text-shadow: -1px 1px 1px rgba(0, 0, 0, 0.7);
-webkit-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-moz-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-ms-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-o-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
border-collapse: separate;
border: 1px solid #000;
background-color: #363644;
background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(#4c5b63), to(#363644));
background-image: -webkit-radial-gradient(circle, #4c5b63, #363644);
background-image: -moz-radial-gradient(circle, #4c5b63, #363644);
background-image: -ms-radial-gradient(circle, #4c5b63, #363644);
background-image: -o-radial-gradient(circle, #4c5b63, #363644);
background-repeat: no-repeat;
text-decoration: none;
display: inline-block;
padding: 2px;
margin: -2px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}

.forkme:hover {
text-decoration: none;
background-color: #4d4d60;
background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(#627680), to(#4d4d60));
background-image: -webkit-radial-gradient(circle, #627680, #4d4d60);
background-image: -moz-radial-gradient(circle, #627680, #4d4d60);
background-image: -ms-radial-gradient(circle, #627680, #4d4d60);
background-image: -o-radial-gradient(circle, #627680, #4d4d60);
background-repeat: no-repeat;
-webkit-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-moz-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-ms-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
-o-box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
box-shadow: 0 1px 3px rgba(54, 54, 68, 0.8), inset 0 -1px 3px rgba(246, 247, 248, 0.5);
border-collapse: separate
}
</style>
<link id="linkstyle" rel='stylesheet' href='{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown16.css'/>
<link rel="stylesheet" href="{{staticLoadRelativePath}}/jsdoc_static/prettify.min.css">
</head>
<body>
<div id="preview-box">
Expand All @@ -81,24 +17,24 @@ <h3>文件信息</h3>
<p>生成文件路径:{{generateProjectPath}}</p>
</div>
<div>
<span><a href="./index.html">返回根目录</a></span>
<span><a href="./index.html">返回目录</a></span>
<select id="themes">
<option value="{{staticLoadRelativePath}}jsdoc_static/markdown/markdown1.css">主题一</option>
<option value="./jsdoc_static/markdown/markdown2.css">主题二</option>
<option value="./jsdoc_static/markdown/markdown3.css">主题三</option>
<option value="./jsdoc_static/markdown/markdown4.css">主题四</option>
<option value="./jsdoc_static/markdown/markdown5.css">主题五</option>
<option value="./jsdoc_static/markdown/markdown6.css">主题六</option>
<option value="./jsdoc_static/markdown/markdown7.css">主题七</option>
<option value="./jsdoc_static/markdown/markdown8.css">主题八</option>
<option value="./jsdoc_static/markdown/markdown9.css">主题九</option>
<option value="./jsdoc_static/markdown/markdown10.css">主题十</option>
<option value="./jsdoc_static/markdown/markdown11.css">主题十一</option>
<option value="./jsdoc_static/markdown/markdown12.css">主题十二</option>
<option value="./jsdoc_static/markdown/markdown13.css">主题十三</option>
<option value="./jsdoc_static/markdown/markdown14.css">主题十四</option>
<option value="./jsdoc_static/markdown/markdown15.css">主题十五</option>
<option value="./jsdoc_static/markdown/markdown16.css">主题十六</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown2.css">主题二</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown3.css">主题三</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown4.css">主题四</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown5.css">主题五</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown6.css">主题六</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown7.css">主题七</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown8.css">主题八</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown9.css">主题九</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown10.css">主题十</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown11.css">主题十一</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown12.css">主题十二</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown13.css">主题十三</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown14.css">主题十四</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown15.css">主题十五</option>
<option value="{{staticLoadRelativePath}}/jsdoc_static/markdown/markdown16.css">主题十六</option>
</select>
</div>
</div>
Expand All @@ -112,8 +48,8 @@ <h3>文件信息</h3>
<footer>
<a class="forkme" href="https://github.com/kahn1990/jsdoc-zero">Fork me on GitHub</a>
</footer>
<script type="application/javascript" src="./jsdoc_static/jquery.min.js"></script>
<script type="application/javascript" src="./jsdoc_static/prettify.min.js"></script>
<script type="application/javascript" src="{{staticLoadRelativePath}}/jsdoc_static/jquery.min.js"></script>
<script type="application/javascript" src="{{staticLoadRelativePath}}/jsdoc_static/prettify.min.js"></script>

<script>
$(document).ready(function () {
Expand Down

0 comments on commit f9dc7fd

Please sign in to comment.