highmark-occam 1.0.1 → 1.0.2
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 +39 -7
- package/lib/example.js +4 -5
- package/lib/index.js +12 -1
- package/lib/renderOccamStyles.js +24 -0
- package/package.json +2 -2
- package/src/example.js +4 -6
- package/src/index.js +3 -0
- package/src/renderOccamStyles.js +13 -0
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ There are several packages in the distribution.
|
|
|
44
44
|
|
|
45
45
|
- [Highmark-CLI](https://github.com/djalbat/highmark-cli) Highmark's CLI tool.
|
|
46
46
|
- [Highmark Yapp](https://github.com/djalbat/highmark-yapp) Highmark with Yapp listings.
|
|
47
|
-
- [Highmark Occam](https://github.com/djalbat/highmark-
|
|
47
|
+
- [Highmark Occam](https://github.com/djalbat/highmark-occam) Highmark support for Occam.
|
|
48
48
|
- [Highmark Client](https://github.com/djalbat/highmark-client) Highmark's bundled client for viewing HTML.
|
|
49
49
|
- [Highmark Markdown](https://github.com/djalbat/highmark-markdown) Highmark's Markdown and Markdown Style languages.
|
|
50
50
|
|
|
@@ -55,7 +55,7 @@ All of the other packages are likely only of interest to prospective developers.
|
|
|
55
55
|
|
|
56
56
|
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
57
|
|
|
58
|
-
git clone https://github.com/djalbat/highmark-
|
|
58
|
+
git clone https://github.com/djalbat/highmark-occam.git
|
|
59
59
|
|
|
60
60
|
...and then install the dependencies with [npm](https://www.npmjs.com/) from within the project's root directory:
|
|
61
61
|
|
|
@@ -81,12 +81,12 @@ One last thing to bear in mind is that this package is included by way of a rela
|
|
|
81
81
|
|
|
82
82
|
## Usage
|
|
83
83
|
|
|
84
|
-
To begin with
|
|
84
|
+
To begin with you must render the requisite styles:
|
|
85
85
|
|
|
86
86
|
```
|
|
87
|
-
import {
|
|
87
|
+
import { renderOccamStyles } from "highmark-occam";
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
renderOccamStyles();
|
|
90
90
|
|
|
91
91
|
...
|
|
92
92
|
```
|
|
@@ -94,9 +94,9 @@ renderYappStyles();
|
|
|
94
94
|
Next, to create a node from some Markdown content, use the `tokensFromMarkdown()`, `markdownNodeFromTokens()` and `topmostHTMLNodeFromMarkdownNode()` utility functions:
|
|
95
95
|
|
|
96
96
|
```
|
|
97
|
-
import {
|
|
97
|
+
import { grammarUtilities } from "highmark-occam";
|
|
98
98
|
|
|
99
|
-
const { tokensFromMarkdown, markdownNodeFromTokens } =
|
|
99
|
+
const { tokensFromMarkdown, markdownNodeFromTokens } = grammarUtilities;
|
|
100
100
|
|
|
101
101
|
const markdown = `
|
|
102
102
|
|
|
@@ -127,6 +127,38 @@ Note the use of the tokens in a `context` plain old JavaScript object that must
|
|
|
127
127
|
This is why there are two utility functions to create the node in two stages.
|
|
128
128
|
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
129
|
|
|
130
|
+
Lastly, if you plan to use Nominal lisintgs then register the custom grammars beforehand:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
"use strict";
|
|
134
|
+
|
|
135
|
+
import { customGrammarsUtilities } from "../index"; ///
|
|
136
|
+
|
|
137
|
+
import firstOrderLogicCustomGrammarsJSON from "./customGrammarsJSON/firstOrderLogic";
|
|
138
|
+
|
|
139
|
+
const { registerCustomGrammarsMap } = customGrammarsUtilities;
|
|
140
|
+
|
|
141
|
+
const customGrammarsJSONMap = {
|
|
142
|
+
"first-order-logic": firstOrderLogicCustomGrammarsJSON
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
registerCustomGrammarsMap(customGrammarsJSONMap);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
You can export the custom grammars directly from Occam's IDE and then paste them into the requisite file:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
"use strict";
|
|
152
|
+
|
|
153
|
+
export default [
|
|
154
|
+
{ ... },
|
|
155
|
+
{ ... }
|
|
156
|
+
];
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Registering the custom grammars in this way must be done before any listings are rendered.
|
|
160
|
+
It is best to Follow the example application and place this code in a preamble.
|
|
161
|
+
|
|
130
162
|
## Building
|
|
131
163
|
|
|
132
164
|
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
|
|
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 {
|
|
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,
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9leGFtcGxlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgXCJqdXh0YXBvc2VcIjtcblxuaW1wb3J0IHdpdGhTdHlsZSBmcm9tIFwiZWFzeS13aXRoLXN0eWxlXCI7ICAvLy9cblxuaW1wb3J0IHsgQm9keSB9IGZyb20gXCJlYXN5XCI7XG5pbXBvcnQgeyByZW5kZXJPY2NhbVN0eWxlcyB9IGZyb20gXCIuL2luZGV4XCI7IC8vL1xuXG5pbXBvcnQgXCIuL2V4YW1wbGUvcHJlYW1ibGVcIjtcblxuaW1wb3J0IFZpZXcgZnJvbSBcIi4vZXhhbXBsZS92aWV3XCI7XG5cbmNvbnN0IHsgcmVuZGVyU3R5bGVzIH0gPSB3aXRoU3R5bGU7XG5cbmNvbnN0IGJvZHkgPSBuZXcgQm9keSgpO1xuXG5yZW5kZXJPY2NhbVN0eWxlcygpO1xuXG5yZW5kZXJTdHlsZXMoKTtcblxuYm9keS5tb3VudChcblxuICA8Vmlldy8+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,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IHsganVsaWFNb25vU3R5bGUsIHByZXR0eVByaW50ZXJTdHlsZSB9IGZyb20gXCJvY2NhbS1zdHlsZXNcIjtcblxuZXhwb3J0IHsgZGVmYXVsdCBhcyBCbG9ja0xpc3RpbmcgfSBmcm9tIFwiLi9ibG9ja0xpc3RpbmdcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgZ3JhbW1hclV0aWxpdGllcyB9IGZyb20gXCIuL3V0aWxpdGllcy9ncmFtbWFyXCI7XG5leHBvcnQgeyBkZWZhdWx0IGFzIHJlbmRlck9jY2FtU3R5bGVzIH0gZnJvbSBcIi4vcmVuZGVyT2NjYW1TdHlsZXNcIjtcbmV4cG9ydCB7IGRlZmF1bHQgYXMgY3VzdG9tR3JhbW1hcnNVdGlsaXRpZXMgfSBmcm9tIFwiLi91dGlsaXRpZXMvY3VzdG9tR3JhbW1hcnNcIjtcbiJdLCJuYW1lcyI6WyJCbG9ja0xpc3RpbmciLCJjdXN0b21HcmFtbWFyc1V0aWxpdGllcyIsImdyYW1tYXJVdGlsaXRpZXMiLCJqdWxpYU1vbm9TdHlsZSIsInByZXR0eVByaW50ZXJTdHlsZSIsInJlbmRlck9jY2FtU3R5bGVzIl0sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7UUFJb0JBO2VBQUFBLHFCQUFZOztRQUdaQztlQUFBQSx1QkFBdUI7O1FBRnZCQztlQUFBQSxnQkFBZ0I7O1FBSDNCQztlQUFBQSwyQkFBYzs7UUFBRUM7ZUFBQUEsK0JBQWtCOztRQUl2QkM7ZUFBQUEsMEJBQWlCOzs7NkJBSmM7cUVBRVg7Z0VBQ0k7MEVBQ0M7dUVBQ00ifQ==
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.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.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/highmark-occam",
|
|
7
7
|
"description": "Highmark support for Occam.",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"easy": "^24.1.8",
|
|
14
|
+
"easy-with-style": "^3.0.549",
|
|
14
15
|
"highmark-markdown": "^1.2.93",
|
|
15
16
|
"occam-custom-grammars": "^6.0.36",
|
|
16
17
|
"occam-grammars": "^1.3.529",
|
|
@@ -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 {
|
|
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 {
|
|
14
|
+
const { renderStyles } = withStyle;
|
|
15
15
|
|
|
16
16
|
const body = new Body();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
renderStyle(prettyPrinterStyle);
|
|
18
|
+
renderOccamStyles();
|
|
21
19
|
|
|
22
|
-
|
|
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
|
+
}
|