markdown-maker 1.10.0 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.vscode/launch.json +4 -22
- package/package.json +14 -37
- package/src/cltool.ts +48 -106
- package/src/commands.ts +56 -2
- package/src/main.ts +122 -0
- package/src/{parse.ts → parser.ts} +39 -38
- package/test/advanced.test.js +0 -3
- package/test/basic.test.js +0 -1
- package/test/errors.test.js +0 -1
- package/test/hooks.js +1 -1
- package/test/hooks.test.js +114 -0
- package/test/line.test.js +2 -4
- package/test/target.test.js +40 -32
- package/test/tester.test.js +4 -2
- package/test/vars.test.js +22 -30
- package/tsconfig.json +2 -2
- package/build/cltool.d.ts +0 -1
- package/build/cltool.js +0 -161
- package/build/cltool.js.map +0 -1
- package/build/commands.d.ts +0 -43
- package/build/commands.js +0 -223
- package/build/commands.js.map +0 -1
- package/build/parse.d.ts +0 -65
- package/build/parse.js +0 -281
- package/build/parse.js.map +0 -1
- package/build/templates.d.ts +0 -10
- package/build/templates.js +0 -20
- package/build/templates.js.map +0 -1
- package/doc/.mdmconfig.json +0 -7
- package/doc/main.md +0 -2
- package/doc/other.md +0 -1
- package/re-test.js +0 -10
package/build/commands.js
DELETED
@@ -1,223 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
3
|
-
var extendStatics = function (d, b) {
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
-
return extendStatics(d, b);
|
8
|
-
};
|
9
|
-
return function (d, b) {
|
10
|
-
if (typeof b !== "function" && b !== null)
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
-
extendStatics(d, b);
|
13
|
-
function __() { this.constructor = d; }
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
-
};
|
16
|
-
})();
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
18
|
-
if (k2 === undefined) k2 = k;
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
22
|
-
}
|
23
|
-
Object.defineProperty(o, k2, desc);
|
24
|
-
}) : (function(o, m, k, k2) {
|
25
|
-
if (k2 === undefined) k2 = k;
|
26
|
-
o[k2] = m[k];
|
27
|
-
}));
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
30
|
-
}) : function(o, v) {
|
31
|
-
o["default"] = v;
|
32
|
-
});
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
34
|
-
if (mod && mod.__esModule) return mod;
|
35
|
-
var result = {};
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
37
|
-
__setModuleDefault(result, mod);
|
38
|
-
return result;
|
39
|
-
};
|
40
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
41
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
42
|
-
};
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
44
|
-
exports.new_command = exports.load_extensions = exports.Command = exports.TargetType = exports.CommandType = exports.commands = exports.MDMError = void 0;
|
45
|
-
var path = __importStar(require("path"));
|
46
|
-
var parse_1 = __importDefault(require("./parse"));
|
47
|
-
var fs = __importStar(require("fs"));
|
48
|
-
var templates_1 = __importStar(require("./templates"));
|
49
|
-
var require_runtime_1 = __importDefault(require("require-runtime"));
|
50
|
-
var MDMError = /** @class */ (function (_super) {
|
51
|
-
__extends(MDMError, _super);
|
52
|
-
function MDMError(message, match) {
|
53
|
-
var _this = _super.call(this, message) || this;
|
54
|
-
_this.name = "MDMError";
|
55
|
-
_this.match = match;
|
56
|
-
return _this;
|
57
|
-
}
|
58
|
-
return MDMError;
|
59
|
-
}(Error));
|
60
|
-
exports.MDMError = MDMError;
|
61
|
-
exports.commands = {
|
62
|
-
preparse: [],
|
63
|
-
parse: [],
|
64
|
-
postparse: [],
|
65
|
-
};
|
66
|
-
var CommandType;
|
67
|
-
(function (CommandType) {
|
68
|
-
CommandType[CommandType["PREPARSE"] = 0] = "PREPARSE";
|
69
|
-
CommandType[CommandType["PARSE"] = 1] = "PARSE";
|
70
|
-
CommandType[CommandType["POSTPARSE"] = 2] = "POSTPARSE";
|
71
|
-
})(CommandType = exports.CommandType || (exports.CommandType = {}));
|
72
|
-
var TargetType;
|
73
|
-
(function (TargetType) {
|
74
|
-
TargetType[TargetType["HTML"] = 0] = "HTML";
|
75
|
-
TargetType[TargetType["MARKDOWN"] = 1] = "MARKDOWN";
|
76
|
-
})(TargetType = exports.TargetType || (exports.TargetType = {}));
|
77
|
-
var Command = /** @class */ (function () {
|
78
|
-
function Command(validator, acter, type) {
|
79
|
-
this.type = type;
|
80
|
-
this.validator = validator;
|
81
|
-
this.acter = acter;
|
82
|
-
/* add this function to appropriate file */
|
83
|
-
switch (type) {
|
84
|
-
case CommandType.PARSE:
|
85
|
-
exports.commands.parse.push(this);
|
86
|
-
break;
|
87
|
-
case CommandType.PREPARSE:
|
88
|
-
exports.commands.preparse.push(this);
|
89
|
-
break;
|
90
|
-
case CommandType.POSTPARSE:
|
91
|
-
exports.commands.postparse.push(this);
|
92
|
-
break;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
Command.prototype.act = function (match, parser) {
|
96
|
-
return this.acter(match, parser);
|
97
|
-
};
|
98
|
-
return Command;
|
99
|
-
}());
|
100
|
-
exports.Command = Command;
|
101
|
-
/* variable shorthand */
|
102
|
-
new Command(/(\s|^)<(.+)>/, function (match, parser) { return "".concat(match[1], "#mdvar<").concat(match[2], ">"); }, CommandType.PREPARSE);
|
103
|
-
/* mddef */
|
104
|
-
new Command(/#mddef< *(.+?) *= *(.+?) *>/ /* first .+ is lazy so as to not match following spaces */, function (match, parser) {
|
105
|
-
parser.opts.defs[match[1]] = match[2].replace("_", " ");
|
106
|
-
}, CommandType.PARSE);
|
107
|
-
/* mdvar */
|
108
|
-
new Command(/#mdvar<(.+?)>/, function (match, parser) {
|
109
|
-
var value = parser.opts.defs[match[1]];
|
110
|
-
if (!value && !parser.opts.allow_undefined)
|
111
|
-
throw new Error("Undefined variable: ".concat(match[1]));
|
112
|
-
return (value = value || "<".concat(match[1], ">"));
|
113
|
-
}, CommandType.PARSE);
|
114
|
-
/** mdinclude */
|
115
|
-
new Command(/#mdinclude<([\w.\/-]+)(?:[,\s]+([\w]+))?>/, function (match, parser) {
|
116
|
-
/* increase the current recursive depth */
|
117
|
-
parser.opts.depth++;
|
118
|
-
if (parser.opts.depth > parser.opts.max_depth) {
|
119
|
-
throw new Error("max depth exceeded!");
|
120
|
-
}
|
121
|
-
/* get the matching group */
|
122
|
-
var _ = match[0], name = match[1], condition = match[2];
|
123
|
-
/* implement conditional imports */
|
124
|
-
if (condition && !parser.opts.args.includes(condition))
|
125
|
-
return;
|
126
|
-
var fsstat = fs.lstatSync(path.join(parser.wd, name));
|
127
|
-
if (fsstat.isDirectory()) {
|
128
|
-
/* check if a file with the same name of the
|
129
|
-
* exists in the folder */
|
130
|
-
if (fs.existsSync(path.join(parser.wd, name, "".concat(name, ".md")))) {
|
131
|
-
name = path.join(name, "".concat(name, ".md"));
|
132
|
-
}
|
133
|
-
else {
|
134
|
-
throw new Error("No entry file found in folder \"".concat(name, "\". Looking for \"").concat(name, ".md\""));
|
135
|
-
}
|
136
|
-
}
|
137
|
-
var recursiveParser = new parse_1.default(path.join(parser.wd, name), parser.opts, {
|
138
|
-
parent: parser,
|
139
|
-
});
|
140
|
-
/* keep the options the same */
|
141
|
-
recursiveParser.opts = parser.opts;
|
142
|
-
recursiveParser.parent = parser;
|
143
|
-
var fileType = path.extname(recursiveParser.file);
|
144
|
-
var blob = fileType === ".md"
|
145
|
-
? recursiveParser.get(parser.opts.targetType)
|
146
|
-
: recursiveParser.raw;
|
147
|
-
parser.opts.depth--;
|
148
|
-
return blob;
|
149
|
-
}, CommandType.PARSE);
|
150
|
-
/* mdlabel */
|
151
|
-
new Command(/#mdlabel<(\d+),\s?(.+)>/, function (match, parser) {
|
152
|
-
if (parser.opts.targetType !== TargetType.HTML)
|
153
|
-
return "";
|
154
|
-
var level = Number.parseInt(match[1]);
|
155
|
-
var title = match[2];
|
156
|
-
var link = parser.titleId(title);
|
157
|
-
parser.opts.secs.push({ level: level, title: title });
|
158
|
-
return "<span id=\"".concat(link, "\"></span>");
|
159
|
-
}, CommandType.PREPARSE);
|
160
|
-
/* mdref */
|
161
|
-
new Command(/#mdref<(.+)>/, function (match, parser) {
|
162
|
-
for (var i = 0; i < parser.opts.secs.length; i++) {
|
163
|
-
var title = parser.opts.secs[i].title;
|
164
|
-
if (title === match[1])
|
165
|
-
break;
|
166
|
-
if (i === parser.opts.secs.length - 1)
|
167
|
-
throw new Error("Reference to [".concat(match[1], "] could not be resolved!"));
|
168
|
-
}
|
169
|
-
match[1] = match[1].replace("_", " ");
|
170
|
-
var link = parser.titleId(match[1]);
|
171
|
-
if (parser.opts.targetType === TargetType.HTML)
|
172
|
-
return "<a href=\"#".concat(link, "\">").concat(match[1], "</a>");
|
173
|
-
else if (parser.opts.targetType === TargetType.MARKDOWN)
|
174
|
-
return "[".concat(match[1], "](#").concat(link, ")");
|
175
|
-
}, CommandType.PARSE);
|
176
|
-
/* mdtemplate */
|
177
|
-
new Command(/#mdtemplate<(\w+?)>/, function (match, parser) {
|
178
|
-
var template = match[1];
|
179
|
-
var replacement = templates_1.default[template];
|
180
|
-
if (replacement !== undefined) {
|
181
|
-
return replacement;
|
182
|
-
}
|
183
|
-
else {
|
184
|
-
throw new MDMError("Template \"".concat(template, "\" not found!"), match);
|
185
|
-
}
|
186
|
-
}, CommandType.PARSE);
|
187
|
-
new Command(/#mdmaketoc(?:<>)?/, function (match, parser) { return parser.gen_toc(); }, CommandType.POSTPARSE);
|
188
|
-
var loaded_extentions = [];
|
189
|
-
function load_extension(parser, file) {
|
190
|
-
if (loaded_extentions.includes(file))
|
191
|
-
return;
|
192
|
-
if (fs.existsSync(file)) {
|
193
|
-
var extensions = (0, require_runtime_1.default)(file);
|
194
|
-
loaded_extentions.push(file);
|
195
|
-
extensions.main(templates_1.new_template, new_command);
|
196
|
-
if (parser.opts.verbose)
|
197
|
-
console.log("Loaded extensions from ".concat(file).yellow);
|
198
|
-
}
|
199
|
-
else if (parser.opts.debug) {
|
200
|
-
console.log("No extensions found at ".concat(file).red);
|
201
|
-
}
|
202
|
-
}
|
203
|
-
function load_extensions(parser) {
|
204
|
-
/* global extention */
|
205
|
-
var global_extensions_path = path.join(__dirname, "extensions.js");
|
206
|
-
load_extension(parser, global_extensions_path);
|
207
|
-
/* project extention */
|
208
|
-
var project_extensions_path = path.join(parser.wd_full, "extensions.js");
|
209
|
-
load_extension(parser, project_extensions_path);
|
210
|
-
}
|
211
|
-
exports.load_extensions = load_extensions;
|
212
|
-
/**
|
213
|
-
*
|
214
|
-
* @param regex The regex to match the command
|
215
|
-
* @param acter The function called when a match is found. Takes two arguments, `match` and `parser`. `match` is the result of the regex match, and `parser` is the parser instance. The function should return the replacement string.
|
216
|
-
* @param type When the command should be run. Can be `CommandType.PREPARSE`, `CommandType.PARSE`, or `CommandType.POSTPARSE`. Defaults to `CommandType.PARSE`.
|
217
|
-
*/
|
218
|
-
function new_command(regex, acter, type) {
|
219
|
-
new Command(regex, acter, type || CommandType.PARSE);
|
220
|
-
}
|
221
|
-
exports.new_command = new_command;
|
222
|
-
exports.default = { commands: exports.commands, load_extensions: load_extensions };
|
223
|
-
//# sourceMappingURL=commands.js.map
|
package/build/commands.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.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AAC;AACzD,CAAC;AAND,kCAMC;AAED,kBAAe,EAAE,QAAQ,kBAAA,EAAE,eAAe,iBAAA,EAAE,CAAC"}
|
package/build/parse.d.ts
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
import { Command } from "./commands";
|
2
|
-
declare enum TargetType {
|
3
|
-
HTML = 0,
|
4
|
-
MARKDOWN = 1
|
5
|
-
}
|
6
|
-
declare class Parser {
|
7
|
-
file: string;
|
8
|
-
parent?: Parser;
|
9
|
-
line_num: number;
|
10
|
-
wd: string;
|
11
|
-
wd_full: string;
|
12
|
-
blobs: {
|
13
|
-
[key: number]: string | undefined;
|
14
|
-
};
|
15
|
-
opts: {
|
16
|
-
defs: {
|
17
|
-
[key: string]: string;
|
18
|
-
};
|
19
|
-
secs: {
|
20
|
-
level: number;
|
21
|
-
title: string;
|
22
|
-
}[];
|
23
|
-
args: string[];
|
24
|
-
depth: number;
|
25
|
-
verbose: boolean;
|
26
|
-
debug: boolean;
|
27
|
-
max_depth: number;
|
28
|
-
use_underscore: boolean;
|
29
|
-
toc_level: number;
|
30
|
-
allow_undefined: boolean;
|
31
|
-
html: boolean;
|
32
|
-
watch: boolean;
|
33
|
-
targetType: TargetType | undefined;
|
34
|
-
only_warn: boolean;
|
35
|
-
parent?: Parser;
|
36
|
-
isFileCallback: (s: string) => false | string;
|
37
|
-
};
|
38
|
-
raw: string;
|
39
|
-
static TOKEN: string;
|
40
|
-
constructor(filename: any, clargs: any, opts?: {
|
41
|
-
parent?: Parser;
|
42
|
-
isFileCallback?: (s: string) => false | string;
|
43
|
-
});
|
44
|
-
/**
|
45
|
-
* parse wrapper for handling
|
46
|
-
* preprocessing, parsing and postprocess
|
47
|
-
**/
|
48
|
-
parse(): any;
|
49
|
-
mainparse(blob: string): string;
|
50
|
-
preprocess(blob: string): string;
|
51
|
-
postprocess(blob: string): string;
|
52
|
-
parse_commands(blob: string, commands: Command[]): string;
|
53
|
-
parse_all_commands(blob: string, commands: {
|
54
|
-
[key: string]: Command[];
|
55
|
-
}): string;
|
56
|
-
titleId(title: string): string;
|
57
|
-
gen_toc(): string;
|
58
|
-
line_num_from_index(index: number): number;
|
59
|
-
remove_double_blank_lines(blob: any): any;
|
60
|
-
to(bundleName: string, callback: (fileName: string) => void): void;
|
61
|
-
html(): any;
|
62
|
-
get(targetType?: TargetType, callback?: (blob: string) => void): string;
|
63
|
-
}
|
64
|
-
export declare function splice(str: string, startIndex: number, width: number, newSubStr: string): string;
|
65
|
-
export default Parser;
|
package/build/parse.js
DELETED
@@ -1,281 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.splice = void 0;
|
4
|
-
var fs = require("fs"); /* for handling reading of files */
|
5
|
-
var path = require("path"); /* for handling file paths */
|
6
|
-
var Colors = require("colors.ts"); /* for adding colours to strings */
|
7
|
-
Colors.enable();
|
8
|
-
var marked = require("marked");
|
9
|
-
var commands_1 = require("./commands");
|
10
|
-
var TargetType;
|
11
|
-
(function (TargetType) {
|
12
|
-
TargetType[TargetType["HTML"] = 0] = "HTML";
|
13
|
-
TargetType[TargetType["MARKDOWN"] = 1] = "MARKDOWN";
|
14
|
-
})(TargetType || (TargetType = {}));
|
15
|
-
/* parse some md
|
16
|
-
* recursively with extra options */
|
17
|
-
var Parser = /** @class */ (function () {
|
18
|
-
function Parser(filename, clargs, opts) {
|
19
|
-
/* this.working_directory */
|
20
|
-
this.file = filename;
|
21
|
-
if (!opts)
|
22
|
-
opts = {};
|
23
|
-
/* the parent parser */
|
24
|
-
this.parent = opts.parent;
|
25
|
-
this.line_num = 0;
|
26
|
-
this.wd = path.dirname(filename);
|
27
|
-
this.wd_full = path.resolve(this.wd);
|
28
|
-
/* finished blob */
|
29
|
-
this.blobs = {};
|
30
|
-
/* all options */
|
31
|
-
this.opts = {
|
32
|
-
defs: {},
|
33
|
-
secs: [],
|
34
|
-
args: [],
|
35
|
-
depth: 0,
|
36
|
-
verbose: false,
|
37
|
-
debug: false,
|
38
|
-
max_depth: 5,
|
39
|
-
use_underscore: false,
|
40
|
-
toc_level: 3,
|
41
|
-
allow_undefined: false,
|
42
|
-
html: false,
|
43
|
-
watch: false,
|
44
|
-
targetType: undefined,
|
45
|
-
only_warn: false,
|
46
|
-
parent: undefined,
|
47
|
-
isFileCallback: function (f) {
|
48
|
-
if (!fs.existsSync(f))
|
49
|
-
return false;
|
50
|
-
return fs.readFileSync(f, "utf-8") + "\n";
|
51
|
-
},
|
52
|
-
};
|
53
|
-
if (!clargs) {
|
54
|
-
clargs = {};
|
55
|
-
}
|
56
|
-
/* append all commandline arguments to this */
|
57
|
-
Object.assign(this.opts, clargs);
|
58
|
-
Object.assign(this.opts, opts);
|
59
|
-
this.raw = this.opts.isFileCallback(filename) || filename;
|
60
|
-
}
|
61
|
-
/**
|
62
|
-
* parse wrapper for handling
|
63
|
-
* preprocessing, parsing and postprocess
|
64
|
-
**/
|
65
|
-
Parser.prototype.parse = function () {
|
66
|
-
(0, commands_1.load_extensions)(this);
|
67
|
-
if (this.opts.verbose || this.opts.debug) {
|
68
|
-
console.log(Colors.colors("magenta", "parsing " + this.file + ": depth=" + this.opts.depth));
|
69
|
-
}
|
70
|
-
if (this.opts.debug) {
|
71
|
-
console.log("Parsing options:");
|
72
|
-
console.log(this.opts);
|
73
|
-
}
|
74
|
-
/* reset sections for beginning parse */
|
75
|
-
if (this.opts.depth === 0)
|
76
|
-
this.opts.secs = [];
|
77
|
-
var __blob;
|
78
|
-
/* apply preproccessing to raw file */
|
79
|
-
__blob = this.preprocess(this.raw);
|
80
|
-
/* main parser instance call */
|
81
|
-
__blob = this.mainparse(__blob);
|
82
|
-
/**
|
83
|
-
* apply postprocessing after */
|
84
|
-
__blob = this.postprocess(__blob);
|
85
|
-
return __blob;
|
86
|
-
};
|
87
|
-
Parser.prototype.mainparse = function (blob) {
|
88
|
-
var _this = this;
|
89
|
-
if (this.opts.verbose || this.opts.debug) {
|
90
|
-
console.debug("beginning mainparse of '".concat(this.file, "'").blue);
|
91
|
-
}
|
92
|
-
/* main parser instance loop */
|
93
|
-
blob.split("\n").forEach(function (line, lnum) {
|
94
|
-
_this.line_num = lnum;
|
95
|
-
/* if line looks like a title */
|
96
|
-
var titleMatch = line.trim().match(/^(#+) (.+)$/);
|
97
|
-
if (titleMatch) {
|
98
|
-
if (_this.opts.verbose || _this.opts.debug)
|
99
|
-
console.log("found toc element: " + line);
|
100
|
-
/* implement toc level */
|
101
|
-
var level = titleMatch[1].length;
|
102
|
-
var title = titleMatch[2];
|
103
|
-
_this.opts.secs.push({ level: level, title: title });
|
104
|
-
if (_this.opts.debug) {
|
105
|
-
console.log("updated sections:", { level: level, title: title });
|
106
|
-
}
|
107
|
-
}
|
108
|
-
});
|
109
|
-
return this.parse_commands(blob, commands_1.commands.parse);
|
110
|
-
};
|
111
|
-
Parser.prototype.preprocess = function (blob) {
|
112
|
-
if (this.opts.verbose || this.opts.debug) {
|
113
|
-
console.debug("beginning preprocess of '".concat(this.file, "'").blue);
|
114
|
-
}
|
115
|
-
return this.parse_commands(blob, commands_1.commands.preparse);
|
116
|
-
};
|
117
|
-
Parser.prototype.postprocess = function (blob) {
|
118
|
-
if (this.opts.verbose || this.opts.debug) {
|
119
|
-
console.debug("beginning postprocess of '".concat(this.file, "'").blue);
|
120
|
-
}
|
121
|
-
blob = this.parse_commands(blob, commands_1.commands.postparse);
|
122
|
-
/* remove double empty lines */
|
123
|
-
blob = this.remove_double_blank_lines(blob);
|
124
|
-
blob = blob.trimEnd() + "\n\n";
|
125
|
-
return blob;
|
126
|
-
};
|
127
|
-
Parser.prototype.parse_commands = function (blob, commands) {
|
128
|
-
var _this = this;
|
129
|
-
commands.forEach(function (command) {
|
130
|
-
/* Add global flag to RegExp */
|
131
|
-
var re = new RegExp(command.validator.source, (command.validator.flags || "") + "g");
|
132
|
-
blob = blob.replace(re, function () {
|
133
|
-
var args = [];
|
134
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
135
|
-
args[_i] = arguments[_i];
|
136
|
-
}
|
137
|
-
return command.act(args, _this) || "";
|
138
|
-
});
|
139
|
-
});
|
140
|
-
return blob;
|
141
|
-
};
|
142
|
-
Parser.prototype.parse_all_commands = function (blob, commands) {
|
143
|
-
var _this = this;
|
144
|
-
Object.keys(commands).forEach(function (key) {
|
145
|
-
blob = _this.parse_commands(blob, commands[key]);
|
146
|
-
});
|
147
|
-
return blob;
|
148
|
-
};
|
149
|
-
Parser.prototype.titleId = function (title) {
|
150
|
-
var sep = this.opts.use_underscore ? "_" : "-";
|
151
|
-
title = title
|
152
|
-
.toLowerCase()
|
153
|
-
.replace(/[^\w\s]+/g, "")
|
154
|
-
.replace(/[\s_]+/g, sep);
|
155
|
-
return title;
|
156
|
-
};
|
157
|
-
Parser.prototype.gen_toc = function () {
|
158
|
-
var _this = this;
|
159
|
-
var __blob = [];
|
160
|
-
var tabSize = 2;
|
161
|
-
var beg = "* ";
|
162
|
-
var hor = " ".repeat(tabSize);
|
163
|
-
this.opts.secs.forEach(function (sec) {
|
164
|
-
if (sec.level > _this.opts.toc_level)
|
165
|
-
return;
|
166
|
-
var title = sec.title.replace(/_/g, " ");
|
167
|
-
title = _this.parse_all_commands(title, commands_1.commands);
|
168
|
-
var link = _this.titleId(title);
|
169
|
-
var __line = hor.repeat(Math.max(sec.level - 1, 0)) + beg + "[".concat(title, "](#").concat(link, ")");
|
170
|
-
__blob.push(__line);
|
171
|
-
});
|
172
|
-
return __blob.join("\n");
|
173
|
-
};
|
174
|
-
Parser.prototype.line_num_from_index = function (index) {
|
175
|
-
return this.raw.substring(0, index).split("\n").length + 1;
|
176
|
-
};
|
177
|
-
Parser.prototype.remove_double_blank_lines = function (blob) {
|
178
|
-
/* replace all triple newlines, and EOF by double newline */
|
179
|
-
blob = blob.replace(/(\r\n|\n){3,}/g, "\n\n");
|
180
|
-
return blob;
|
181
|
-
};
|
182
|
-
/* output the parsed document to bundle */
|
183
|
-
Parser.prototype.to = function (bundleName, callback) {
|
184
|
-
var dir = path.dirname(bundleName);
|
185
|
-
if (callback === undefined)
|
186
|
-
callback = function () { };
|
187
|
-
if (!fs.existsSync(dir)) {
|
188
|
-
fs.mkdirSync(dir, { recursive: true });
|
189
|
-
}
|
190
|
-
if (!this.opts.html) {
|
191
|
-
this.get(TargetType.MARKDOWN, function (blob) {
|
192
|
-
fs.writeFile(bundleName, blob, function () { return callback(bundleName); });
|
193
|
-
});
|
194
|
-
}
|
195
|
-
else {
|
196
|
-
var htmlFileName_1 = bundleName.replace(".md", ".html");
|
197
|
-
fs.writeFile(htmlFileName_1, this.html(), function () { return callback(htmlFileName_1); });
|
198
|
-
}
|
199
|
-
};
|
200
|
-
Parser.prototype.html = function () {
|
201
|
-
var htmlFormatted = marked(this.get(TargetType.HTML));
|
202
|
-
if (this.opts.watch) {
|
203
|
-
return ("<script>w=new WebSocket(\"ws:localhost:7788\");w.addEventListener(\"message\",(e)=>{if(e.data==\"refresh\")location.reload();});</script>\n" +
|
204
|
-
htmlFormatted);
|
205
|
-
}
|
206
|
-
return htmlFormatted;
|
207
|
-
};
|
208
|
-
Parser.prototype.get = function (targetType, callback) {
|
209
|
-
/* If target type is undefined, markdown is the default */
|
210
|
-
if (targetType === undefined)
|
211
|
-
targetType = TargetType.MARKDOWN;
|
212
|
-
if (this.blobs[targetType]) {
|
213
|
-
if (callback) {
|
214
|
-
callback(this.blobs[targetType]);
|
215
|
-
}
|
216
|
-
return this.blobs[targetType];
|
217
|
-
}
|
218
|
-
else {
|
219
|
-
try {
|
220
|
-
this.opts.targetType = targetType;
|
221
|
-
var blob = this.parse();
|
222
|
-
this.opts.targetType = undefined;
|
223
|
-
if (callback)
|
224
|
-
callback(blob);
|
225
|
-
return blob;
|
226
|
-
}
|
227
|
-
catch (error) {
|
228
|
-
/* Compile a traceback of error */
|
229
|
-
var traceback = "";
|
230
|
-
var p = this;
|
231
|
-
do {
|
232
|
-
if (error instanceof commands_1.MDMError)
|
233
|
-
traceback += "\n...on line ".concat(p.line_num_from_index(error.match.index), " in ").concat(p.file).grey(15);
|
234
|
-
else
|
235
|
-
traceback += "\n...on line ".concat(p.line_num, " in ").concat(p.file).grey(15);
|
236
|
-
if (p.parent)
|
237
|
-
p = p.parent;
|
238
|
-
} while (p.parent);
|
239
|
-
error.message += traceback;
|
240
|
-
/* only interested in node stacktrace when debugging */
|
241
|
-
if (!this.opts.debug)
|
242
|
-
error.stack = "";
|
243
|
-
if (this.opts.only_warn)
|
244
|
-
console.error(error);
|
245
|
-
else
|
246
|
-
throw error;
|
247
|
-
}
|
248
|
-
}
|
249
|
-
};
|
250
|
-
Parser.TOKEN = "#md";
|
251
|
-
return Parser;
|
252
|
-
}());
|
253
|
-
function splice(str, startIndex, width, newSubStr) {
|
254
|
-
var start = str.slice(0, startIndex);
|
255
|
-
var end = str.slice(startIndex + width);
|
256
|
-
return start + newSubStr + end;
|
257
|
-
}
|
258
|
-
exports.splice = splice;
|
259
|
-
/* add extention to marked for classed blockquotes*/
|
260
|
-
marked.use({
|
261
|
-
renderer: {
|
262
|
-
blockquote: function (quote) {
|
263
|
-
/* find the ending, and if not, return the default */
|
264
|
-
var ending = quote.match(/\{(.+)\}\s*<\/p>/);
|
265
|
-
if (!ending)
|
266
|
-
return "<blockquote>".concat(quote, "</blockquote>");
|
267
|
-
var args = ending[1].split(" ");
|
268
|
-
var classes = args.filter(function (arg) { return arg.startsWith("."); });
|
269
|
-
var id = args.filter(function (arg) { return arg.startsWith("#"); });
|
270
|
-
var classNames = classes.map(function (c) { return c.slice(1); });
|
271
|
-
var classText = classes.length > 0 ? "class=\"".concat(classNames.join(" "), "\"") : "";
|
272
|
-
var idText = id.length > 0 ? "id=\"".concat(id[0].slice(1), "\"") : "";
|
273
|
-
/* remove the ending from the quote */
|
274
|
-
quote = quote.replace(/\{(.+)\}\s*<\/p>/, "</p>");
|
275
|
-
return "<blockquote ".concat(classText, " ").concat(idText, ">\n").concat(quote.trim(), "</blockquote>");
|
276
|
-
},
|
277
|
-
},
|
278
|
-
});
|
279
|
-
module.exports = Parser;
|
280
|
-
exports.default = Parser;
|
281
|
-
//# sourceMappingURL=parse.js.map
|
package/build/parse.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":";;;AAAA,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAmC;AAC7D,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,6BAA6B;AAE3D,kCAAqC,CAAC,mCAAmC;AACzE,MAAM,CAAC,MAAM,EAAE,CAAC;AAChB,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,uCAA0E;AAE1E,IAAK,UAGJ;AAHD,WAAK,UAAU;IACX,2CAAI,CAAA;IACJ,mDAAQ,CAAA;AACZ,CAAC,EAHI,UAAU,KAAV,UAAU,QAGd;AAED;oCACoC;AACpC;IAoCI,gBACI,QAAQ,EACR,MAAM,EACN,IAGC;QAED,4BAA4B;QAC5B,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QAErB,IAAI,CAAC,IAAI;YAAE,IAAI,GAAG,EAAE,CAAC;QAErB,uBAAuB;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE1B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAErC,mBAAmB;QACnB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAEhB,iBAAiB;QACjB,IAAI,CAAC,IAAI,GAAG;YACR,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,KAAK;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G,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,eAAO,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAE7D,sCAAsC;YACtC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;YAElD,OAAO,sBAAe,SAAS,cAAI,MAAM,gBAAM,KAAK,CAAC,IAAI,EAAE,kBAAe,CAAC;QAC/E,CAAC;KACJ;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;AAExB,kBAAe,MAAM,CAAC"}
|
package/build/templates.d.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
declare const templates: {
|
2
|
-
[key: string]: string;
|
3
|
-
};
|
4
|
-
/**
|
5
|
-
* Function to add a template to the templates object. Similar to definitions and variables, but reside as an extension.
|
6
|
-
* @param name The name of the template
|
7
|
-
* @param content The replacement string
|
8
|
-
*/
|
9
|
-
export declare function new_template(name: string, content: string): void;
|
10
|
-
export default templates;
|
package/build/templates.js
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.new_template = void 0;
|
4
|
-
var templates = {};
|
5
|
-
/**
|
6
|
-
* Function to add a template to the templates object. Similar to definitions and variables, but reside as an extension.
|
7
|
-
* @param name The name of the template
|
8
|
-
* @param content The replacement string
|
9
|
-
*/
|
10
|
-
function new_template(name, content) {
|
11
|
-
templates[name] = content;
|
12
|
-
}
|
13
|
-
exports.new_template = new_template;
|
14
|
-
/* initialize default templates */
|
15
|
-
var presentation_template = require("../src/templates/presentation.js");
|
16
|
-
var mathjax_template = require("../src/templates/mathjax.js");
|
17
|
-
new_template("presentation", presentation_template);
|
18
|
-
new_template("mathjax", mathjax_template);
|
19
|
-
exports.default = templates;
|
20
|
-
//# sourceMappingURL=templates.js.map
|
package/build/templates.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":";;;AAAA,IAAM,SAAS,GAA8B,EAAE,CAAC;AAEhD;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,OAAe;IACtD,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AAC9B,CAAC;AAFD,oCAEC;AAED,kCAAkC;AAClC,IAAM,qBAAqB,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC1E,IAAM,gBAAgB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAChE,YAAY,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC;AACpD,YAAY,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAE1C,kBAAe,SAAS,CAAC"}
|
package/doc/.mdmconfig.json
DELETED
package/doc/main.md
DELETED
package/doc/other.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
From the other siiiiiide!
|