Skip to content

Commit 87350c8

Browse files
committed
增加语法错误
1 parent 20af40d commit 87350c8

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

lib/md_parser.js

+20-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var parser = function(string, callback, argvObj, queryObj, commonData) {
4242
callback = emptyFn;
4343
}
4444
var splitReg = /\[slide\s*(.*)\]/ig;
45-
var slidesSetting = string.match(splitReg);
45+
var slidesSetting = string.match(splitReg) ||[];
4646
var contents = string.split(/\[slide.*\]/i);
4747
// console.log(contents.length, slidesSetting);
4848
//第一个是封面
@@ -211,7 +211,13 @@ function parse(str, note, sAttrs) {
211211
}
212212
return tagStart + note + '<section class="slide-wrapper">' + content + '</section></slide>';
213213
}
214-
214+
/**
215+
* 替换属性
216+
* @param {[type]} str [description]
217+
* @param {Boolean} isArticle [description]
218+
* @param {[type]} noHead [description]
219+
* @return {[type]} [description]
220+
*/
215221
function doAttr(str, isArticle, noHead) {
216222
//input:## Title {:.build width="200px"}
217223
//output: <h2 class="build" width="200px">Title</h2>
@@ -228,7 +234,12 @@ function doAttr(str, isArticle, noHead) {
228234

229235
return str;
230236
}
231-
237+
/**
238+
* 合并attr
239+
* @param {string} oldAttr 老属性
240+
* @param {string} newAttr 新属性
241+
* @return {[type]} [description]
242+
*/
232243
function mergeAttr(oldAttr, newAttr) {
233244
if (!oldAttr) {
234245
return newAttr;
@@ -273,7 +284,12 @@ function mergeAttr(oldAttr, newAttr) {
273284
});
274285
return back.join(' ');
275286
}
276-
287+
/**
288+
* 解析自定义属性
289+
* @param {[type]} idinput [description]
290+
* @param {[type]} attrs [description]
291+
* @return {[type]} [description]
292+
*/
277293
function parseAttr(idinput, attrs) {
278294
attrs = attrs.split(/\s+/);
279295
// console.log(attrs);

lib/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function pptlist(res, dir, argvObj) {
274274
$.recurse(dir, function(abspath, rootdir, subdir, filename) {
275275
count++;
276276
var content = fs.readFileSync(abspath, 'utf-8').toString();
277-
var title = content.match(/<title>(.*?)<\/title>/);
277+
var title = content.match(/<title>(.*?)<\/title>/) || [];
278278
if (title[1]) {
279279
title = title[1];
280280
} else {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nodeppt",
33
"jsname": "nodeppt",
44
"description": "A simple, in-browser, markdown-driven presentation framework",
5-
"version": "0.9.2",
5+
"version": "0.9.3",
66
"site": "https://github.com/ksky521/nodePPT",
77
"author": {
88
"name": "Theo Wang",

0 commit comments

Comments
 (0)