highmark-cli 0.0.79 → 0.0.81

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/actions.js CHANGED
@@ -4,7 +4,7 @@ const helpAction = require("./action/help"),
4
4
  versionAction = require("./action/version"),
5
5
  publishAction = require("./action/publish");
6
6
 
7
- const { DEFAULT_INPUT_FILE_PATH } = require("./defaults"),
7
+ const { DEFAULT_INPUT_FILE_PATH, DEFAULT_OUTPUT_FILE_PATH } = require("./defaults"),
8
8
  { HELP_OPTION, VERSION_OPTION } = require("./options"),
9
9
  { HELP_COMMAND, VERSION_COMMAND, PUBLISH_COMMAND } = require("./commands");
10
10
 
@@ -13,7 +13,7 @@ function actions(command, argument, options) {
13
13
  helpOptionPresent = options.hasOwnProperty(HELP_OPTION),
14
14
  versionOptionPresent = options.hasOwnProperty(VERSION_OPTION),
15
15
  { inputFilePath = DEFAULT_INPUT_FILE_PATH,
16
- outputFilePath = null } = options;
16
+ outputFilePath = DEFAULT_OUTPUT_FILE_PATH } = options;
17
17
 
18
18
  if (false) {
19
19
  ///
package/bin/constants.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const PERIOD = ".",
4
+ EMPTY_STRING = "",
4
5
  DOUBLE_SPACE = " ",
5
6
  HIGHMARK_CLI = "Highmark-CLI",
6
7
  DEFAULT_SELECTOR_STRING = "div",
@@ -8,6 +9,7 @@ const PERIOD = ".",
8
9
 
9
10
  module.exports = {
10
11
  PERIOD,
12
+ EMPTY_STRING,
11
13
  DOUBLE_SPACE,
12
14
  HIGHMARK_CLI,
13
15
  DEFAULT_SELECTOR_STRING,
package/bin/defaults.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
- const DEFAULT_INPUT_FILE_PATH = "default.md";
3
+ const DEFAULT_INPUT_FILE_PATH = "default.md",
4
+ DEFAULT_OUTPUT_FILE_PATH = "index.html";
4
5
 
5
6
  module.exports = {
6
- DEFAULT_INPUT_FILE_PATH
7
+ DEFAULT_INPUT_FILE_PATH,
8
+ DEFAULT_OUTPUT_FILE_PATH
7
9
  };
package/bin/importer.js CHANGED
@@ -4,7 +4,7 @@ const { readFile } = require("./utilities/fileSystem"),
4
4
  { divisionIdentifierFromFilePath } = require("./utilities/division"),
5
5
  { nodeFromTokens, tokensFromContent } = require("./utilities/markdown");
6
6
 
7
- function importer(filePath, indent) {
7
+ function importer(filePath, indent, context) {
8
8
  let html = null;
9
9
 
10
10
  const content = readFile(filePath);
@@ -15,11 +15,12 @@ function importer(filePath, indent) {
15
15
  node = nodeFromTokens(tokens);
16
16
 
17
17
  if (node !== null) {
18
- html = node.asHTML(indent, { ///
18
+ Object.assign(context, {
19
19
  tokens,
20
- importer,
21
20
  divisionIdentifier
22
21
  });
22
+
23
+ html = node.asHTML(indent, context);
23
24
  }
24
25
  }
25
26
 
package/bin/messages.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  const FAILED_PUBLISH_MESSAGE = "Failed to publish.",
4
4
  SUCCESSFUL_PUBLISH_MESSAGE = "Published successfully.",
5
- NO_OUTPUT_FILE_PATH_MESSAGE = "No output file path has been specified.",
6
5
  UNABLE_TO_READ_FILE_MESSAGE = "Unable to read the file.",
7
6
  UNABLE_TO_WRITE_FILE_MESSAGE = "Unable to write the file.",
8
7
  UNABLE_TO_READ_DIRECTORY_MESSAGE = "Unable to read the directory.",
@@ -13,7 +12,6 @@ const FAILED_PUBLISH_MESSAGE = "Failed to publish.",
13
12
  module.exports = {
14
13
  FAILED_PUBLISH_MESSAGE,
15
14
  SUCCESSFUL_PUBLISH_MESSAGE,
16
- NO_OUTPUT_FILE_PATH_MESSAGE,
17
15
  UNABLE_TO_READ_FILE_MESSAGE,
18
16
  UNABLE_TO_WRITE_FILE_MESSAGE,
19
17
  UNABLE_TO_READ_DIRECTORY_MESSAGE,
@@ -1,27 +1,33 @@
1
1
  "use strict";
2
2
 
3
- const { writeFile } = require("../utilities/fileSystem"),
4
- { NO_OUTPUT_FILE_PATH_MESSAGE } = require("../messages");
3
+ const { writeFile } = require("../utilities/fileSystem");
5
4
 
6
- function htmlOperation(proceed, abort, context) {
7
- const { outputFilePath } = context;
8
-
9
- if (outputFilePath === null) {
10
- const message = NO_OUTPUT_FILE_PATH_MESSAGE;
11
-
12
- console.log(message);
13
-
14
- abort();
5
+ const { EMPTY_STRING } = require("../constants");
15
6
 
16
- return;
17
- }
18
-
19
- const { markdownHTML, markdownStylesCSS } = context,
7
+ function htmlOperation(proceed, abort, context) {
8
+ const { title, markdownHTML, outputFilePath, markdownStylesCSS } = context,
9
+ titleHTML = titleHTMLFromTitle(title),
20
10
  filePath = outputFilePath, ///
21
11
  content = `<!DOCTYPE html>
22
12
  <html>
23
13
  <head>
24
- <title>The Foundations of Symbolic Reasoning</title>
14
+
15
+ ${titleHTML}
16
+
17
+ <meta charset="utf-8" />
18
+
19
+ <style>
20
+
21
+ *,
22
+ *::after,
23
+ *::before {
24
+ border: 0;
25
+ margin: 0;
26
+ padding: 0;
27
+ box-sizing: border-box;
28
+ }
29
+
30
+ </style>
25
31
  <style>
26
32
 
27
33
  ${markdownStylesCSS}
@@ -42,3 +48,11 @@ ${markdownHTML}
42
48
  }
43
49
 
44
50
  module.exports = htmlOperation;
51
+
52
+ function titleHTMLFromTitle(title) {
53
+ const titleHTML = (title === null) ?
54
+ EMPTY_STRING :
55
+ `<title>${title}</title>`;
56
+
57
+ return titleHTML;
58
+ }
@@ -9,7 +9,14 @@ function markdownHTMLOperation(proceed, abort, context) {
9
9
  const { inputFilePath } = context,
10
10
  filePath = inputFilePath, ///
11
11
  indent = DOUBLE_SPACE,
12
- html = importer(filePath, indent);
12
+ title = null;
13
+
14
+ Object.assign(context, {
15
+ title,
16
+ importer
17
+ });
18
+
19
+ const html = importer(filePath, indent, context);
13
20
 
14
21
  if (html === null) {
15
22
  const message = UNABLE_TO_CONVERT_MARKDOWN_TO_HTML_MESSAGE;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "highmark-cli",
3
3
  "author": "James Smith",
4
- "version": "0.0.79",
4
+ "version": "0.0.81",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/highmark-cli",
7
7
  "description": "Extensible, styleable Markdown.",
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "argumentative": "^2.0.28",
14
- "highmark-markdown": "^0.0.122",
15
- "highmark-markdown-style": "^0.0.173",
14
+ "highmark-markdown": "^0.0.126",
15
+ "highmark-markdown-style": "^0.0.175",
16
16
  "necessary": "^13.4.2",
17
17
  "occam-entities": "^1.0.83"
18
18
  },