highmark-cli 0.0.74 → 0.0.76
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
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;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { cssUtilities } = require("highmark-markdown-style"),
|
|
4
|
+
{ filePathUtilities } = require("occam-entities");
|
|
4
5
|
|
|
5
6
|
const { PERIOD } = require("../constants"),
|
|
6
|
-
{ readFile, readDirectory } = require("../utilities/fileSystem")
|
|
7
|
+
{ readFile, readDirectory } = require("../utilities/fileSystem"),
|
|
8
|
+
{ divisionIdentifierFromFilePath } = require("../utilities/division");
|
|
7
9
|
|
|
8
|
-
const { isFilePathMarkdownStyleFilePath } = filePathUtilities
|
|
10
|
+
const { isFilePathMarkdownStyleFilePath } = filePathUtilities,
|
|
11
|
+
{ cssFromMarkdownStyleAndSelectorString } = cssUtilities;
|
|
9
12
|
|
|
10
13
|
function markdownStylesToCSS(proceed, abort, context) {
|
|
14
|
+
let css = null;
|
|
15
|
+
|
|
11
16
|
const directoryPath = PERIOD; ///
|
|
12
17
|
|
|
13
18
|
readDirectory(directoryPath, (filePath) => {
|
|
@@ -15,13 +20,36 @@ function markdownStylesToCSS(proceed, abort, context) {
|
|
|
15
20
|
|
|
16
21
|
if (filePathMarkdownStyleFilePath) {
|
|
17
22
|
const markdownStyleFilePath = filePath, ///
|
|
18
|
-
|
|
23
|
+
markdownStyle = markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath),
|
|
24
|
+
selectorString = selectorStringFromMarkdownStyleFilePath(markdownStyleFilePath);
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
css = cssFromMarkdownStyleAndSelectorString(markdownStyle, selectorString, css); ///
|
|
21
27
|
}
|
|
22
28
|
});
|
|
23
29
|
|
|
30
|
+
Object.assign(context, {
|
|
31
|
+
css
|
|
32
|
+
});
|
|
33
|
+
|
|
24
34
|
proceed();
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
module.exports = markdownStylesToCSS;
|
|
38
|
+
|
|
39
|
+
function markdownStyleFromMarkdownStyleFilePath(markdownStyleFilePath) {
|
|
40
|
+
const filePath = markdownStyleFilePath, ///
|
|
41
|
+
content = readFile(filePath),
|
|
42
|
+
markdownStyle = content; ///
|
|
43
|
+
|
|
44
|
+
return markdownStyle;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function selectorStringFromMarkdownStyleFilePath(markdownStyleFilePath) {
|
|
48
|
+
const filePath = markdownStyleFilePath, ///
|
|
49
|
+
divisionIdentifier = divisionIdentifierFromFilePath(filePath),
|
|
50
|
+
selectorString = (divisionIdentifier !== null) ?
|
|
51
|
+
`div#${divisionIdentifier}` :
|
|
52
|
+
`div`;
|
|
53
|
+
|
|
54
|
+
return selectorString;
|
|
55
|
+
}
|
|
@@ -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.76",
|
|
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.168",
|
|
16
16
|
"necessary": "^13.4.2",
|
|
17
17
|
"occam-entities": "^1.0.83"
|
|
18
18
|
},
|