@@ -31,7 +31,7 @@ const darkMode: boolean = options.dark
31
31
function main ( ) {
32
32
const converter = new Converter ( layout , hardBreak , darkMode )
33
33
let errorCounter = 0
34
- let outputIndex = 0
34
+ let outputsIndex = 0
35
35
const outputFilenameSet = new Set < string > ( )
36
36
37
37
const isURL = ( s : string ) : URL | null = > {
@@ -67,19 +67,19 @@ function main() {
67
67
}
68
68
69
69
const generateOutputFilename = ( inputFilename : fs . PathLike ) : string => {
70
- // if `output ` is non-null, use `output ` as output file name
70
+ // if `outputs ` is non-null, use `outputs ` as output file name
71
71
let ret : string
72
72
if ( outputs !== null ) {
73
- if ( outputIndex < outputs . length ) {
74
- ret = outputs ! [ outputIndex ] ! . toString ( )
75
- outputIndex ++
73
+ if ( outputsIndex < outputs . length ) {
74
+ ret = outputs ! [ outputsIndex ] ! . toString ( )
75
+ outputsIndex ++
76
76
} else {
77
77
throw ( 'the number of --output is smaller than the number of --input' ) ;
78
78
}
79
79
} else {
80
80
ret = path . join ( dest . toString ( ) , path . basename ( inputFilename . toString ( ) ) . replace ( / \. m d $ / , '' ) + '.html' )
81
81
}
82
- // if `o` repeat , use hash function to generate new filename
82
+ // if `ret` is repeated , use a hash function to generate a new filename
83
83
let hashIn : string = inputFilename . toString ( )
84
84
const retExtname = path . extname ( ret ) // including leading dot '.'
85
85
const tmpRet = ret . replace ( new RegExp ( retExtname + "$" ) , '' )
@@ -91,7 +91,7 @@ function main() {
91
91
return ret
92
92
}
93
93
94
- // if `output ` is null, generate the output file in the directory `dest`
94
+ // if `outputs ` is null, generate the output file in the directory `dest`
95
95
// if `dest` existed, check `dest` is directory
96
96
// otherwise create the new directory `dest`
97
97
if ( outputs === null ) {
@@ -112,7 +112,7 @@ function main() {
112
112
// 1. http/https mode
113
113
const url = isURL ( fn . toString ( ) )
114
114
if ( url != null ) {
115
- if ( outputs !== null && outputIndex >= outputs ?. length ) {
115
+ if ( outputs !== null && outputsIndex >= outputs ?. length ) {
116
116
return
117
117
}
118
118
if ( url . protocol === 'https:' ) {
@@ -137,7 +137,6 @@ function main() {
137
137
try {
138
138
const stats = fs . statSync ( f )
139
139
if ( stats . isDirectory ( ) ) {
140
- // printError(fn, "not support directory path as input since v1.1.0")
141
140
return
142
141
}
143
142
} catch ( e ) {
@@ -161,4 +160,4 @@ function main() {
161
160
} )
162
161
}
163
162
164
- main ( )
163
+ main ( )
0 commit comments