highmark-cli 0.0.75 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/constants.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const PERIOD = "."
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const PERIOD = ".",
|
|
4
|
+
DEFAULT = "default",
|
|
5
|
+
EMPTY_STRING = "",
|
|
6
|
+
DOUBLE_SPACE = " ",
|
|
7
|
+
HIGHMARK_CLI = "Highmark-CLI";
|
|
6
8
|
|
|
7
9
|
module.exports = {
|
|
8
10
|
PERIOD,
|
|
11
|
+
DEFAULT,
|
|
12
|
+
EMPTY_STRING,
|
|
9
13
|
DOUBLE_SPACE,
|
|
10
14
|
HIGHMARK_CLI
|
|
11
15
|
};
|
package/bin/importer.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { readFile } = require("./utilities/fileSystem")
|
|
4
|
-
|
|
3
|
+
const { readFile } = require("./utilities/fileSystem"),
|
|
4
|
+
{ divisionIdentifierFromFilePath } = require("./utilities/division"),
|
|
5
|
+
{ nodeFromTokens, tokensFromContent } = require("./utilities/markdown");
|
|
5
6
|
|
|
6
7
|
function importer(filePath, indent) {
|
|
7
8
|
let html = null;
|
|
@@ -9,13 +10,15 @@ function importer(filePath, indent) {
|
|
|
9
10
|
const content = readFile(filePath);
|
|
10
11
|
|
|
11
12
|
if (content !== null) {
|
|
12
|
-
const
|
|
13
|
+
const divisionIdentifier = divisionIdentifierFromFilePath(filePath),
|
|
14
|
+
tokens = tokensFromContent(content),
|
|
13
15
|
node = nodeFromTokens(tokens);
|
|
14
16
|
|
|
15
17
|
if (node !== null) {
|
|
16
18
|
html = node.asHTML(indent, { ///
|
|
17
19
|
tokens,
|
|
18
|
-
importer
|
|
20
|
+
importer,
|
|
21
|
+
divisionIdentifier
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -23,4 +26,4 @@ function importer(filePath, indent) {
|
|
|
23
26
|
return html;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
module.exports = importer;
|
|
29
|
+
module.exports = importer;
|
|
@@ -3,28 +3,54 @@
|
|
|
3
3
|
const { cssUtilities } = require("highmark-markdown-style"),
|
|
4
4
|
{ filePathUtilities } = require("occam-entities");
|
|
5
5
|
|
|
6
|
-
const { PERIOD } = require("../constants"),
|
|
7
|
-
{ readFile, readDirectory } = require("../utilities/fileSystem")
|
|
6
|
+
const { PERIOD, EMPTY_STRING } = require("../constants"),
|
|
7
|
+
{ readFile, readDirectory } = require("../utilities/fileSystem"),
|
|
8
|
+
{ divisionIdentifierFromFilePath } = require("../utilities/division");
|
|
8
9
|
|
|
9
10
|
const { isFilePathMarkdownStyleFilePath } = filePathUtilities,
|
|
10
|
-
{
|
|
11
|
+
{ divisionCSSFromMarkdownStyleAndSelectorString } = cssUtilities;
|
|
11
12
|
|
|
12
13
|
function markdownStylesToCSS(proceed, abort, context) {
|
|
14
|
+
let css = EMPTY_STRING;
|
|
15
|
+
|
|
13
16
|
const directoryPath = PERIOD; ///
|
|
14
17
|
|
|
15
18
|
readDirectory(directoryPath, (filePath) => {
|
|
16
19
|
const filePathMarkdownStyleFilePath = isFilePathMarkdownStyleFilePath(filePath);
|
|
17
20
|
|
|
18
21
|
if (filePathMarkdownStyleFilePath) {
|
|
19
|
-
const
|
|
20
|
-
markdownStyle =
|
|
21
|
-
|
|
22
|
+
const markdownStyleFilePath = filePath, ///
|
|
23
|
+
markdownStyle = markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath),
|
|
24
|
+
selectorString = selectorStringFromMarkdownStyleFilePath(markdownStyleFilePath),
|
|
25
|
+
divisionCSS = divisionCSSFromMarkdownStyleAndSelectorString(markdownStyle, selectorString, css); ///
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
css = `${css}${divisionCSS}`;
|
|
24
28
|
}
|
|
25
29
|
});
|
|
26
30
|
|
|
31
|
+
Object.assign(context, {
|
|
32
|
+
css
|
|
33
|
+
});
|
|
34
|
+
|
|
27
35
|
proceed();
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
module.exports = markdownStylesToCSS;
|
|
39
|
+
|
|
40
|
+
function markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath) {
|
|
41
|
+
const filePath = markdownStyleFilePath, ///
|
|
42
|
+
content = readFile(filePath),
|
|
43
|
+
markdownStyle = content; ///
|
|
44
|
+
|
|
45
|
+
return markdownStyle;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function selectorStringFromMarkdownStyleFilePath(markdownStyleFilePath) {
|
|
49
|
+
const filePath = markdownStyleFilePath, ///
|
|
50
|
+
divisionIdentifier = divisionIdentifierFromFilePath(filePath),
|
|
51
|
+
selectorString = (divisionIdentifier !== null) ?
|
|
52
|
+
`div#${divisionIdentifier}` :
|
|
53
|
+
`div`;
|
|
54
|
+
|
|
55
|
+
return selectorString;
|
|
56
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { pathUtilities, arrayUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const { DEFAULT } = require("../constants");
|
|
6
|
+
|
|
7
|
+
const { second } = arrayUtilities,
|
|
8
|
+
{ isPathName, bottommostNameFromPath } = pathUtilities;
|
|
9
|
+
|
|
10
|
+
function divisionIdentifierFromFilePath(filePath) {
|
|
11
|
+
let divisionIdentifier = null;
|
|
12
|
+
|
|
13
|
+
const path = filePath,
|
|
14
|
+
pathName = isPathName(path),
|
|
15
|
+
name = pathName ?
|
|
16
|
+
path :
|
|
17
|
+
bottommostNameFromPath(path),
|
|
18
|
+
matches = name.match(/^([^.]+)\..+$/),
|
|
19
|
+
secondMatch = second(matches);
|
|
20
|
+
|
|
21
|
+
if (secondMatch !== DEFAULT) {
|
|
22
|
+
divisionIdentifier = secondMatch; ///
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return divisionIdentifier;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
divisionIdentifierFromFilePath
|
|
30
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { fileSystemUtilities } = require("necessary");
|
|
3
|
+
const { pathUtilities, fileSystemUtilities } = require("necessary");
|
|
4
4
|
|
|
5
5
|
const { isEntryNameHiddenName } = require("../utilities/name"),
|
|
6
6
|
{ UNABLE_TO_READ_FILE_MESSAGE, UNABLE_TO_READ_DIRECTORY_MESSAGE } = require("../messages");
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { concatenatePaths } = pathUtilities,
|
|
9
|
+
{ isEntryFile, readFile: readFileAsync, readDirectory: readDirectoryAsync } = fileSystemUtilities;
|
|
9
10
|
|
|
10
11
|
function readFile(filePath) {
|
|
11
12
|
let content = null;
|
|
@@ -37,7 +38,7 @@ function readDirectory(directoryPath, callback) {
|
|
|
37
38
|
const entryNameHiddenName = isEntryNameHiddenName(entryName);
|
|
38
39
|
|
|
39
40
|
if (!entryNameHiddenName) {
|
|
40
|
-
const entryPath =
|
|
41
|
+
const entryPath = concatenatePaths(directoryPath, entryName), ///
|
|
41
42
|
entryFile = isEntryFile(entryPath);
|
|
42
43
|
|
|
43
44
|
if (entryFile) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "highmark-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.77",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/highmark-cli",
|
|
7
7
|
"description": "Extensible, styleable Markdown.",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.28",
|
|
14
14
|
"highmark-markdown": "^0.0.121",
|
|
15
|
-
"highmark-markdown-style": "^0.0.
|
|
15
|
+
"highmark-markdown-style": "^0.0.170",
|
|
16
16
|
"necessary": "^13.4.2",
|
|
17
17
|
"occam-entities": "^1.0.83"
|
|
18
18
|
},
|