@canopycanopycanopy/b-ber-grammar-pullquote 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.
- package/README.md +15 -4
- package/dist/index.js +6 -6
- package/package.json +8 -11
package/README.md
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# b-ber-grammar-pullquote
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Handles the `pullquote`, `blockquote`, and their shared `exit` directive. A `pullquote` opening marker emits a `<section>` element; a `blockquote` opening marker emits a `<blockquote>` element. Both support a `citation` attribute: if present, the citation text is appended as a `<footer><cite>` block when the matching `exit` directive is encountered. The package tracks open directives in a local `pullquoteIndices` stack so that the correct element name and citation are available at close time. Uses `b-ber-parser-section` as the MarkdownIt plugin and the block directive marker/min-length from `b-ber-shapes-directives`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
+
Registered as a MarkdownIt plugin by the rendering engine:
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import pullquote from '@canopycanopycanopy/b-ber-grammar-pullquote'
|
|
11
|
+
// { plugin, name: 'pullQuote', renderer }
|
|
7
12
|
```
|
|
8
|
-
|
|
13
|
+
|
|
14
|
+
## Dev
|
|
15
|
+
|
|
9
16
|
```
|
|
17
|
+
npm test
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Tests are in `__tests__/index.test.js`.
|
package/dist/index.js
CHANGED
|
@@ -11,8 +11,8 @@ var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stabl
|
|
|
11
11
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
12
12
|
var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
|
|
13
13
|
var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
|
|
14
|
-
var
|
|
15
|
-
var
|
|
14
|
+
var _has = _interopRequireDefault(require("lodash/has"));
|
|
15
|
+
var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
|
|
16
16
|
var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
|
|
17
17
|
var _bBerParserSection = _interopRequireDefault(require("@canopycanopycanopy/b-ber-parser-section"));
|
|
18
18
|
var _bBerGrammarAttributes = require("@canopycanopycanopy/b-ber-grammar-attributes");
|
|
@@ -47,7 +47,7 @@ function handleOpen(token, context, fileName, lineNumber) {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
// get citation which we'll use below
|
|
50
|
-
if ((0,
|
|
50
|
+
if ((0, _has.default)(attrsObject, 'citation')) {
|
|
51
51
|
;
|
|
52
52
|
({
|
|
53
53
|
citation
|
|
@@ -95,9 +95,9 @@ const validateOpen = ({
|
|
|
95
95
|
}) => (params, line) => {
|
|
96
96
|
const match = (0, _trim.default)(params).call(params).match(MARKER_OPEN_RE);
|
|
97
97
|
if (!match || match.length < 3) return false;
|
|
98
|
-
const [
|
|
99
|
-
if ((0,
|
|
100
|
-
_bBerLogger.default.error(`Missing [id] for [${
|
|
98
|
+
const [, type, id] = match;
|
|
99
|
+
if ((0, _isUndefined.default)(id)) {
|
|
100
|
+
_bBerLogger.default.error(`Missing [id] for [${type}:start] at ${context.fileName}.md:${line}`);
|
|
101
101
|
return false;
|
|
102
102
|
}
|
|
103
103
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-grammar-pullquote",
|
|
3
|
-
"version": "3.0.8-
|
|
3
|
+
"version": "3.0.8-next.61+2bbec564",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,15 +25,12 @@
|
|
|
25
25
|
"rimraf": "^2.7.1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@canopycanopycanopy/b-ber-grammar-attributes": "3.0.8-
|
|
29
|
-
"@canopycanopycanopy/b-ber-lib": "3.0.8-
|
|
30
|
-
"@canopycanopycanopy/b-ber-logger": "3.0.8-
|
|
31
|
-
"@canopycanopycanopy/b-ber-parser-section": "3.0.8-
|
|
32
|
-
"@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-
|
|
33
|
-
"lodash": "^4.17.21"
|
|
34
|
-
"lodash.has": "latest",
|
|
35
|
-
"lodash.isundefined": "^3.0.1",
|
|
36
|
-
"tar": "^6.1.11"
|
|
28
|
+
"@canopycanopycanopy/b-ber-grammar-attributes": "3.0.8-next.61+2bbec564",
|
|
29
|
+
"@canopycanopycanopy/b-ber-lib": "3.0.8-next.61+2bbec564",
|
|
30
|
+
"@canopycanopycanopy/b-ber-logger": "3.0.8-next.61+2bbec564",
|
|
31
|
+
"@canopycanopycanopy/b-ber-parser-section": "3.0.8-next.61+2bbec564",
|
|
32
|
+
"@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-next.61+2bbec564",
|
|
33
|
+
"lodash": "^4.17.21"
|
|
37
34
|
},
|
|
38
35
|
"files": [
|
|
39
36
|
"dist"
|
|
@@ -52,5 +49,5 @@
|
|
|
52
49
|
"url": "https://maxwellsimmer.com"
|
|
53
50
|
}
|
|
54
51
|
],
|
|
55
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
|
|
56
53
|
}
|