highmark-occam 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -1,20 +1,21 @@
1
- # Highmark Yapp
1
+ # Highmark Occam
2
2
 
3
3
  Highmark support for Occam.
4
4
 
5
5
  This package augments the HTML created with Highmark with listings for the following languages:
6
6
 
7
7
  * BNF
8
- * Furtle
9
8
  * JSON
10
- * Markdown
11
- * Markdown Style
9
+ * Furtle
12
10
  * Nominal
13
11
  * Plain Text
12
+ * Markdown
13
+ * Markdown Style
14
14
 
15
15
  Additinoally, a pakbage name can be stipulated for Nominal listings and, provided the corresponding custom grammars have been registered, the Nominal listing will be parsed accordingly. For example:
16
16
 
17
- ```nominal:first-order-logic
17
+ ```
18
+ \`\`\`nominal:first-order-logic
18
19
  Lemma
19
20
  Suppose
20
21
  [F] |- R :: S
@@ -24,6 +25,7 @@ Lemma
24
25
  [G] is 𝘧𝘳𝘦𝘦 in [G] |- R :: S by FreeMetavariable
25
26
  Therefore
26
27
  ∃[G] [G] |- R :: S by MetaExistentialIntroduction
28
+ \`\`\`
27
29
  ```
28
30
 
29
31
  The results are listings that are effectively indistinguishable from the pretty printed source in Occam's IDE.
@@ -44,8 +46,8 @@ There are several packages in the distribution.
44
46
 
45
47
  - [Highmark-CLI](https://github.com/djalbat/highmark-cli) Highmark's CLI tool.
46
48
  - [Highmark Yapp](https://github.com/djalbat/highmark-yapp) Highmark with Yapp listings.
47
- - [Highmark Occam](https://github.com/djalbat/highmark-yapp) Highmark support for Occam.
48
49
  - [Highmark Client](https://github.com/djalbat/highmark-client) Highmark's bundled client for viewing HTML.
50
+ - [Highmark Occam](https://github.com/djalbat/highmark-occam) Highmark support for Occam.
49
51
  - [Highmark Markdown](https://github.com/djalbat/highmark-markdown) Highmark's Markdown and Markdown Style languages.
50
52
 
51
53
  Only the CLI tool is needed by end users.
@@ -55,7 +57,7 @@ All of the other packages are likely only of interest to prospective developers.
55
57
 
56
58
  If you would like to contribute or would simply like to have a look at the code, you can clone the repository with [Git](https://git-scm.com/)...
57
59
 
58
- git clone https://github.com/djalbat/highmark-yapp.git
60
+ git clone https://github.com/djalbat/highmark-occam.git
59
61
 
60
62
  ...and then install the dependencies with [npm](https://www.npmjs.com/) from within the project's root directory:
61
63
 
@@ -81,12 +83,12 @@ One last thing to bear in mind is that this package is included by way of a rela
81
83
 
82
84
  ## Usage
83
85
 
84
- To begin with, in order to make use of Yapp you must render the requisite styles:
86
+ To begin with you must render the requisite styles:
85
87
 
86
88
  ```
87
- import { renderYappStyles } from "highmark-yapp";
89
+ import { renderOccamStyles } from "highmark-occam";
88
90
 
89
- renderYappStyles();
91
+ renderOccamStyles();
90
92
 
91
93
  ...
92
94
  ```
@@ -94,9 +96,9 @@ renderYappStyles();
94
96
  Next, to create a node from some Markdown content, use the `tokensFromMarkdown()`, `markdownNodeFromTokens()` and `topmostHTMLNodeFromMarkdownNode()` utility functions:
95
97
 
96
98
  ```
97
- import { markdownUtilities } from "highmark-yapp";
99
+ import { grammarUtilities } from "highmark-occam";
98
100
 
99
- const { tokensFromMarkdown, markdownNodeFromTokens } = markdownUtilities;
101
+ const { tokensFromMarkdown, markdownNodeFromTokens } = grammarUtilities;
100
102
 
101
103
  const markdown = `
102
104
 
@@ -127,6 +129,38 @@ Note the use of the tokens in a `context` plain old JavaScript object that must
127
129
  This is why there are two utility functions to create the node in two stages.
128
130
  By the way, the sibling DOM element, if not null, must be a child of the parent DOM element, in which case the node will be mounted immediately after it.
129
131
 
132
+ Lastly, if you plan to use Nominal lisintgs then register the custom grammars beforehand:
133
+
134
+ ```
135
+ "use strict";
136
+
137
+ import { customGrammarsUtilities } from "../index"; ///
138
+
139
+ import firstOrderLogicCustomGrammarsJSON from "./customGrammarsJSON/firstOrderLogic";
140
+
141
+ const { registerCustomGrammarsMap } = customGrammarsUtilities;
142
+
143
+ const customGrammarsJSONMap = {
144
+ "first-order-logic": firstOrderLogicCustomGrammarsJSON
145
+ }
146
+
147
+ registerCustomGrammarsMap(customGrammarsJSONMap);
148
+ ```
149
+
150
+ You can export the custom grammars directly from Occam's IDE and then paste them into the requisite file:
151
+
152
+ ```
153
+ "use strict";
154
+
155
+ export default [
156
+ { ... },
157
+ { ... }
158
+ ];
159
+ ```
160
+
161
+ Registering the custom grammars in this way must be done before any listings are rendered.
162
+ It is best to Follow the example application and place this code in a preamble.
163
+
130
164
  ## Building
131
165
 
132
166
  Automation is done with [npm scripts](https://docs.npmjs.com/misc/scripts), have a look at the `package.json` file. The pertinent commands are:
package/lib/example.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  require("juxtapose");
6
6
  const _easywithstyle = /*#__PURE__*/ _interop_require_default(require("easy-with-style"));
7
7
  const _easy = require("easy");
8
- const _occamstyles = require("occam-styles");
8
+ const _index = require("./index");
9
9
  require("./example/preamble");
10
10
  const _view = /*#__PURE__*/ _interop_require_default(require("./example/view"));
11
11
  function _interop_require_default(obj) {
@@ -13,11 +13,10 @@ function _interop_require_default(obj) {
13
13
  default: obj
14
14
  };
15
15
  }
16
- const { renderStyle, renderStyles } = _easywithstyle.default;
16
+ const { renderStyles } = _easywithstyle.default;
17
17
  const body = new _easy.Body();
18
+ (0, _index.renderOccamStyles)();
18
19
  renderStyles();
19
- renderStyle(_occamstyles.prettyPrinterStyle);
20
- renderStyle(_occamstyles.juliaMonoStyle);
21
20
  body.mount(/*#__PURE__*/ React.createElement(_view.default, null));
22
21
 
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9leGFtcGxlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgXCJqdXh0YXBvc2VcIjtcblxuaW1wb3J0IHdpdGhTdHlsZSBmcm9tIFwiZWFzeS13aXRoLXN0eWxlXCI7ICAvLy9cblxuaW1wb3J0IHsgQm9keSB9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0cmljdFwiO1xuXG5pbXBvcnQgXCJqdXh0YXBvc2VcIjtcblxuaW1wb3J0IHdpdGhTdHlsZSBmcm9tIFwiZWFzeS13aXRoLXN0eWxlXCI7ICAvLy9cblxuaW1wb3J0IHsgQm9keSB9IGZyb20gXCJlYXN5XCI7XG5pbXBvcnQgeyByZW5kZXJPY2NhbVN0eWxlcyB9IGZyb20gXCIuL2luZGV4XCI7IC8vL1xuXG5pbXBvcnQgXCIuL2V4YW1wbGUvcHJlYW1ibGVcIjtcblxuaW1wb3J0IFZpZXcgZnJvbSBcIi4vZXhhbXBsZS92aWV3XCI7XG5cbmNvbnN0IHsgcmVuZGVyU3R5bGVzIH0gPSB3aXRoU3R5bGU7XG5cbmNvbnN0IGJvZHkgPSBuZXcgQm9keSgpO1xuXG5yZW5kZXJPY2NhbVN0eWxlcygpO1xuXG5yZW5kZXJTdHlsZXMoKTtcblxuYm9keS5tb3VudChcblxuICA8Vmlldy8+XG5cbik7XG4iXSwibmFtZXMiOlsicmVuZGVyU3R5bGVzIiwid2l0aFN0eWxlIiwiYm9keSIsIkJvZHkiLCJyZW5kZXJPY2NhbVN0eWxlcyIsIm1vdW50IiwiVmlldyJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7UUFFTztzRUFFZTtzQkFFRDt1QkFDYTtRQUUzQjs2REFFVTs7Ozs7O0FBRWpCLE1BQU0sRUFBRUEsWUFBWSxFQUFFLEdBQUdDLHNCQUFTO0FBRWxDLE1BQU1DLE9BQU8sSUFBSUMsVUFBSTtBQUVyQkMsSUFBQUEsd0JBQWlCO0FBRWpCSjtBQUVBRSxLQUFLRyxLQUFLLGVBRVIsb0JBQUNDLGFBQUkifQ==
package/lib/index.js CHANGED
@@ -17,10 +17,21 @@ _export(exports, {
17
17
  },
18
18
  get grammarUtilities () {
19
19
  return _grammar.default;
20
+ },
21
+ get juliaMonoStyle () {
22
+ return _occamstyles.juliaMonoStyle;
23
+ },
24
+ get prettyPrinterStyle () {
25
+ return _occamstyles.prettyPrinterStyle;
26
+ },
27
+ get renderOccamStyles () {
28
+ return _renderOccamStyles.default;
20
29
  }
21
30
  });
31
+ const _occamstyles = require("occam-styles");
22
32
  const _blockListing = /*#__PURE__*/ _interop_require_default(require("./blockListing"));
23
33
  const _grammar = /*#__PURE__*/ _interop_require_default(require("./utilities/grammar"));
34
+ const _renderOccamStyles = /*#__PURE__*/ _interop_require_default(require("./renderOccamStyles"));
24
35
  const _customGrammars = /*#__PURE__*/ _interop_require_default(require("./utilities/customGrammars"));
25
36
  function _interop_require_default(obj) {
26
37
  return obj && obj.__esModule ? obj : {
@@ -28,4 +39,4 @@ function _interop_require_default(obj) {
28
39
  };
29
40
  }
30
41
 
31
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IHsgZGVmYXVsdCBhcyBCbG9ja0xpc3RpbmcgfSBmcm9tIFwiLi9ibG9ja0xpc3RpbmdcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgZ3JhbW1hclV0aWxpdGllcyB9IGZyb20gXCIuL3V0aWxpdGllcy9ncmFtbWFyXCI7XG5leHBvcnQgeyBkZWZhdWx0IGFzIGN1c3RvbUdyYW1tYXJzVXRpbGl0aWVzIH0gZnJvbSBcIi4vdXRpbGl0aWVzL2N1c3RvbUdyYW1tYXJzXCI7XG4iXSwibmFtZXMiOlsiQmxvY2tMaXN0aW5nIiwiY3VzdG9tR3JhbW1hcnNVdGlsaXRpZXMiLCJncmFtbWFyVXRpbGl0aWVzIl0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7UUFFb0JBO2VBQUFBLHFCQUFZOztRQUVaQztlQUFBQSx1QkFBdUI7O1FBRHZCQztlQUFBQSxnQkFBZ0I7OztxRUFESTtnRUFDSTt1RUFDTyJ9
42
+ //# sourceMappingURL=data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defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return renderOccamStyles;
9
+ }
10
+ });
11
+ const _easywithstyle = /*#__PURE__*/ _interop_require_default(require("easy-with-style"));
12
+ const _index = require("./index");
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ const { renderStyle } = _easywithstyle.default;
19
+ function renderOccamStyles() {
20
+ renderStyle(_index.prettyPrinterStyle);
21
+ renderStyle(_index.juliaMonoStyle);
22
+ }
23
+
24
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9yZW5kZXJPY2NhbVN0eWxlcy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHdpdGhTdHlsZSBmcm9tIFwiZWFzeS13aXRoLXN0eWxlXCI7ICAvLy9cblxuaW1wb3J0IHsganVsaWFNb25vU3R5bGUsIHByZXR0eVByaW50ZXJTdHlsZSB9IGZyb20gXCIuL2luZGV4XCI7IC8vL1xuXG5jb25zdCB7IHJlbmRlclN0eWxlIH0gPSB3aXRoU3R5bGU7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHJlbmRlck9jY2FtU3R5bGVzKCkge1xuICByZW5kZXJTdHlsZShwcmV0dHlQcmludGVyU3R5bGUpO1xuXG4gIHJlbmRlclN0eWxlKGp1bGlhTW9ub1N0eWxlKTtcbn1cbiJdLCJuYW1lcyI6WyJyZW5kZXJPY2NhbVN0eWxlcyIsInJlbmRlclN0eWxlIiwid2l0aFN0eWxlIiwicHJldHR5UHJpbnRlclN0eWxlIiwianVsaWFNb25vU3R5bGUiXSwibWFwcGluZ3MiOiJBQUFBOzs7OytCQVFBOzs7ZUFBd0JBOzs7c0VBTkY7dUJBRTZCOzs7Ozs7QUFFbkQsTUFBTSxFQUFFQyxXQUFXLEVBQUUsR0FBR0Msc0JBQVM7QUFFbEIsU0FBU0Y7SUFDdEJDLFlBQVlFLHlCQUFrQjtJQUU5QkYsWUFBWUcscUJBQWM7QUFDNUIifQ==
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "highmark-occam",
3
3
  "author": "James Smith",
4
- "version": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/highmark-occam",
7
7
  "description": "Highmark support for Occam.",
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "easy": "^24.1.8",
14
- "highmark-markdown": "^1.2.93",
14
+ "easy-with-style": "^3.0.549",
15
+ "highmark-markdown": "^1.2.94",
15
16
  "occam-custom-grammars": "^6.0.36",
16
17
  "occam-grammars": "^1.3.529",
17
18
  "occam-lexers": "^23.1.48",
@@ -24,7 +25,6 @@
24
25
  "devDependencies": {
25
26
  "@swc/core": "1.13.20",
26
27
  "easy-layout": "^6.0.301",
27
- "easy-with-style": "^3.0.549",
28
28
  "esbuild": "0.11.14",
29
29
  "express": "^4.17.1",
30
30
  "juxtapose": "^4.0.136",
package/src/example.js CHANGED
@@ -5,21 +5,19 @@ import "juxtapose";
5
5
  import withStyle from "easy-with-style"; ///
6
6
 
7
7
  import { Body } from "easy";
8
- import { juliaMonoStyle, prettyPrinterStyle } from "occam-styles";
8
+ import { renderOccamStyles } from "./index"; ///
9
9
 
10
10
  import "./example/preamble";
11
11
 
12
12
  import View from "./example/view";
13
13
 
14
- const { renderStyle, renderStyles } = withStyle;
14
+ const { renderStyles } = withStyle;
15
15
 
16
16
  const body = new Body();
17
17
 
18
- renderStyles();
19
-
20
- renderStyle(prettyPrinterStyle);
18
+ renderOccamStyles();
21
19
 
22
- renderStyle(juliaMonoStyle);
20
+ renderStyles();
23
21
 
24
22
  body.mount(
25
23
 
package/src/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ export { juliaMonoStyle, prettyPrinterStyle } from "occam-styles";
4
+
3
5
  export { default as BlockListing } from "./blockListing";
4
6
  export { default as grammarUtilities } from "./utilities/grammar";
7
+ export { default as renderOccamStyles } from "./renderOccamStyles";
5
8
  export { default as customGrammarsUtilities } from "./utilities/customGrammars";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import { juliaMonoStyle, prettyPrinterStyle } from "./index"; ///
6
+
7
+ const { renderStyle } = withStyle;
8
+
9
+ export default function renderOccamStyles() {
10
+ renderStyle(prettyPrinterStyle);
11
+
12
+ renderStyle(juliaMonoStyle);
13
+ }