@canopycanopycanopy/b-ber-grammar-section 3.0.8-nav-memo.4 → 3.0.8-next.61

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.
Files changed (3) hide show
  1. package/README.md +15 -4
  2. package/dist/index.js +2 -2
  3. package/package.json +9 -11
package/README.md CHANGED
@@ -1,9 +1,20 @@
1
- # `@canopycanopycanopy/b-ber-grammar-section`
1
+ # b-ber-grammar-section
2
2
 
3
- The `b-ber-grammar-section` package is used internally by b-ber to render custom Markdown extensions (directives) which contain content. More information about b-ber directives can be found in the [All directives](https://github.com/triplecanopy/b-ber/wiki/all-directives) page in the b-ber [Wiki](https://github.com/triplecanopy/b-ber/wiki).
3
+ The universal block-container directive handler. Matches all container-type directives defined in `BLOCK_DIRECTIVES` (chapter, part, appendix, preface, and many others from the EPUB 3 Structural Semantic Vocabulary), as well as `exit`. Opening tokens emit a `<section id="..." class="..." epub:type="...">` with HTML comments marking the start; exit tokens close the element and remove the id from state. For `gallery` and `spread` directives in `reader`/`web` builds, the exit handler emits the additional closing tags required by those directives' multi-element scaffolds. Uses `b-ber-parser-section` as the MarkdownIt plugin and delegates open/close validation to `b-ber-grammar-renderer`.
4
4
 
5
- ## Install
5
+ ## Usage
6
6
 
7
+ Registered as a MarkdownIt plugin by the rendering engine:
8
+
9
+ ```js
10
+ import section from '@canopycanopycanopy/b-ber-grammar-section'
11
+ // { plugin, name: 'section', renderer }
7
12
  ```
8
- $ npm i -g @canopycanopycanopy/b-ber-grammar-section
13
+
14
+ ## Dev
15
+
9
16
  ```
17
+ npm test
18
+ ```
19
+
20
+ Tests are in `__tests__/index.test.js`.
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
17
17
  var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
18
18
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
19
19
  var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
20
- var _lodash = _interopRequireDefault(require("lodash.find"));
20
+ var _find = _interopRequireDefault(require("lodash/find"));
21
21
  var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
22
22
  var _bBerLib = require("@canopycanopycanopy/b-ber-lib");
23
23
  var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
@@ -49,7 +49,7 @@ function handleExitDirective(token) {
49
49
  const [, type, id] = token;
50
50
  _bBerLogger.default.debug(`exit directive [${id}]`);
51
51
  const comment = _bBerLib.Html.comment(`END: section:${type}#${(0, _bBerGrammarAttributes.htmlId)(id)}`);
52
- const directive = (0, _lodash.default)(_State.default.cursor, {
52
+ const directive = (0, _find.default)(_State.default.cursor, {
53
53
  id
54
54
  });
55
55
  _State.default.remove('cursor', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-grammar-section",
3
- "version": "3.0.8-nav-memo.4+d47a9aae",
3
+ "version": "3.0.8-next.61+2bbec564",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,15 +25,13 @@
25
25
  "rimraf": "^2.7.1"
26
26
  },
27
27
  "dependencies": {
28
- "@canopycanopycanopy/b-ber-grammar-attributes": "3.0.8-nav-memo.4+d47a9aae",
29
- "@canopycanopycanopy/b-ber-grammar-renderer": "3.0.8-nav-memo.4+d47a9aae",
30
- "@canopycanopycanopy/b-ber-lib": "3.0.8-nav-memo.4+d47a9aae",
31
- "@canopycanopycanopy/b-ber-logger": "3.0.8-nav-memo.4+d47a9aae",
32
- "@canopycanopycanopy/b-ber-parser-section": "3.0.8-nav-memo.4+d47a9aae",
33
- "@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-nav-memo.4+d47a9aae",
34
- "lodash": "^4.17.21",
35
- "lodash.find": "latest",
36
- "tar": "^6.1.11"
28
+ "@canopycanopycanopy/b-ber-grammar-attributes": "3.0.8-next.61+2bbec564",
29
+ "@canopycanopycanopy/b-ber-grammar-renderer": "3.0.8-next.61+2bbec564",
30
+ "@canopycanopycanopy/b-ber-lib": "3.0.8-next.61+2bbec564",
31
+ "@canopycanopycanopy/b-ber-logger": "3.0.8-next.61+2bbec564",
32
+ "@canopycanopycanopy/b-ber-parser-section": "3.0.8-next.61+2bbec564",
33
+ "@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-next.61+2bbec564",
34
+ "lodash": "^4.17.21"
37
35
  },
38
36
  "files": [
39
37
  "dist"
@@ -52,5 +50,5 @@
52
50
  "url": "https://maxwellsimmer.com"
53
51
  }
54
52
  ],
55
- "gitHead": "d47a9aae74dec3e3225e363b2434c7abe0fcf21b"
53
+ "gitHead": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
56
54
  }