highmark-yapp 2.0.175 → 2.0.177

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.
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- import { nodeMap as nodeMapBase, ruleNames, MarkdownParser as MarkdownParserBase } from "highmark-markdown";
4
-
5
- import BlockListingMarkdownNode from "../node/markdown/blockListing";
6
-
7
- const { BLOCK_LISTING_RULE_NAME } = ruleNames;
8
-
9
- const nodeMap = Object.assign({}, nodeMapBase, {
10
- [BLOCK_LISTING_RULE_NAME]: BlockListingMarkdownNode
11
- });
12
-
13
- export default class MarkdownParser extends MarkdownParserBase {
14
- static nodeMap = nodeMap;
15
-
16
- static fromNothing() { return MarkdownParserBase.fromNothing(MarkdownParser); }
17
-
18
- static fromBNF(bnf) { return MarkdownParserBase.fromBNF(MarkdownParser, bnf); }
19
-
20
- static fromEntries(entries) { return MarkdownParserBase.fromEntries(MarkdownParser, entries); }
21
- }
@@ -1,102 +0,0 @@
1
- "use strict";
2
-
3
- import { MarkdownNode } from "highmark-markdown";
4
- import { arrayUtilities } from "necessary";
5
-
6
- import BlockListing from "../../blockListing";
7
-
8
- import { EMPTY_STRING } from "../../constants";
9
-
10
- const { first } = arrayUtilities;
11
-
12
- export default class BlockListingMarkdownNode extends MarkdownNode {
13
- getBlockListing() {
14
- const domElement = this.getDOMElement(),
15
- { __element__ } = domElement, ///
16
- blockListing = __element__; ///
17
-
18
- return blockListing;
19
- }
20
-
21
- content(context) {
22
- let content = EMPTY_STRING;
23
-
24
- const multiplicity = this.getMultiplicity(),
25
- firstIndex = 0,
26
- lastIndex = multiplicity - 1;
27
-
28
- this.forEachChildNode((childNode, index) => {
29
- if ((index !== firstIndex) && (index !== lastIndex)) {
30
- const childNodeContent = childNode.content(context);
31
-
32
- content = `${content}${childNodeContent}`;
33
- }
34
- });
35
-
36
- content = content.replace(/\n$/, EMPTY_STRING);
37
-
38
- return content;
39
- }
40
-
41
- className(context) {
42
- let className;
43
-
44
- this.someChildNode((childNode, index) => {
45
- if (index === 0) {
46
- const firstChildNode = childNode, ///
47
- blockListingStartMarkdownNode = firstChildNode;
48
-
49
- className = blockListingStartMarkdownNode.className(context);
50
-
51
- return true;
52
- }
53
- });
54
-
55
- return className;
56
- }
57
-
58
- mount(parentDOMElement, siblingDOMElement, context) {
59
- let domElement;
60
-
61
- domElement = this.createDOMElement(context);
62
-
63
- this.setDOMElement(domElement);
64
-
65
- parentDOMElement.insertBefore(domElement, siblingDOMElement)
66
-
67
- const blockListing = this.getBlockListing();
68
-
69
- blockListing.didMount();
70
- }
71
-
72
- unmount(parentDOMElement, context) {
73
- let domElement;
74
-
75
- const blockListing = this.getBlockListing();
76
-
77
- blockListing.willUnmount();
78
-
79
- domElement = this.getDOMElement();
80
-
81
- parentDOMElement.removeChild(domElement);
82
-
83
- domElement = null;
84
-
85
- this.setDOMElement(domElement);
86
- }
87
-
88
- createDOMElement(context) {
89
- const content = this.content(context),
90
- className = this.className(context),
91
- language = className, ///
92
- configuration ={
93
- language
94
- },
95
- blockListing = BlockListing.fromContentAndConfiguration(content, configuration),
96
- domElement = blockListing.getDOMElement();
97
-
98
- return domElement;
99
- }
100
-
101
- static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(BlockListingMarkdownNode, ruleName, childNodes, opacity); }
102
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- import MarkdownLexer from "../markdown/lexer";
4
- import MarkdownParser from "../markdown/parser";
5
-
6
- const markdownLexer = MarkdownLexer.fromNothing(),
7
- markdownParser = MarkdownParser.fromNothing();
8
-
9
- export function tokensFromContent(content) {
10
- const lexer = markdownLexer, ///
11
- tokens = lexer.tokenise(content);
12
-
13
- return tokens;
14
- }
15
-
16
- export function nodeFromTokens(tokens) {
17
- const parser = markdownParser, ///
18
- startRule = parser.getStartRule(),
19
- startOfContent = true,
20
- node = parser.parse(tokens, startRule, startOfContent);
21
-
22
- return node;
23
- }
24
-
25
- export default {
26
- tokensFromContent,
27
- nodeFromTokens
28
- };