@canopycanopycanopy/b-ber-grammar-epigraph 1.2.16 → 2.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/dist/index.js +1 -19
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = void 0;
|
|
12
|
-
|
|
13
9
|
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
14
|
-
|
|
15
10
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
16
|
-
|
|
17
11
|
var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
|
|
18
|
-
|
|
19
12
|
var _bBerParserFigure = _interopRequireDefault(require("@canopycanopycanopy/b-ber-parser-figure"));
|
|
20
|
-
|
|
21
13
|
/* eslint-disable max-len */
|
|
22
|
-
|
|
23
14
|
/*
|
|
24
15
|
|
|
25
16
|
@type: epigraph
|
|
@@ -31,6 +22,7 @@ var _bBerParserFigure = _interopRequireDefault(require("@canopycanopycanopy/b-be
|
|
|
31
22
|
@output: <section epub:type="epigraph" class="epigraph chapter"> ... </section>
|
|
32
23
|
|
|
33
24
|
*/
|
|
25
|
+
|
|
34
26
|
const markerRe = /^epigraph/;
|
|
35
27
|
const attrsRe = /(?:(image|caption|citation)\s["]([^"]+)["])/g;
|
|
36
28
|
var _default = {
|
|
@@ -44,11 +36,9 @@ var _default = {
|
|
|
44
36
|
}) => ({
|
|
45
37
|
marker: ':',
|
|
46
38
|
minMarkers: 3,
|
|
47
|
-
|
|
48
39
|
validate(params) {
|
|
49
40
|
return (0, _trim.default)(params).call(params).match(markerRe);
|
|
50
41
|
},
|
|
51
|
-
|
|
52
42
|
render(tokens, idx) {
|
|
53
43
|
const {
|
|
54
44
|
escapeHtml
|
|
@@ -59,25 +49,19 @@ var _default = {
|
|
|
59
49
|
citation: ''
|
|
60
50
|
};
|
|
61
51
|
let result = '';
|
|
62
|
-
|
|
63
52
|
if (tokens[idx].nesting === 1) {
|
|
64
53
|
// opening tag
|
|
65
54
|
let matches;
|
|
66
|
-
|
|
67
55
|
while ((matches = attrsRe.exec((0, _trim.default)(_context = tokens[idx].info).call(_context))) !== null) {
|
|
68
56
|
var _context;
|
|
69
|
-
|
|
70
57
|
// eslint-disable-next-line prefer-destructuring
|
|
71
58
|
attrs[matches[1]] = matches[2];
|
|
72
59
|
}
|
|
73
|
-
|
|
74
60
|
if (!attrs.image && !attrs.caption) {
|
|
75
61
|
_bBerLogger.default.error(`[${context.fileName}.md] <epigraph> Malformed directive.`);
|
|
76
|
-
|
|
77
62
|
result = '';
|
|
78
63
|
} else if (!attrs.image && attrs.caption) {
|
|
79
64
|
var _context2, _context3;
|
|
80
|
-
|
|
81
65
|
const captions = (0, _map.default)(_context2 = attrs.caption.split('|')).call(_context2, _ => (0, _trim.default)(_).call(_));
|
|
82
66
|
const citations = (0, _map.default)(_context3 = attrs.citation.split('|')).call(_context3, _ => (0, _trim.default)(_).call(_));
|
|
83
67
|
result = ['<section epub:type="epigraph" class="epigraph chapter">', '<section epub:type="chapter" class="subchapter">', (0, _map.default)(captions).call(captions, (caption, idx2) => `<div class="pullquote full-width">
|
|
@@ -88,10 +72,8 @@ var _default = {
|
|
|
88
72
|
result = ['<section epub:type="epigraph" class="epigraph chapter">', '<div class="figure-lg" style="height: auto;">', '<figure style="height: auto;">', '<div class="figure__items" style="width: 100%; margin: 0 auto;">', `<img class="landscape" alt="${attrs.image}" src="../images/${escapeHtml(attrs.image)}" style="width: 100%; max-width: 100%; height: auto;"/>`, attrs.caption ? `<div class="figcaption" style="width: 100%; max-width: 100%; height: auto;"><p class="small">${escapeHtml(attrs.caption)}</p></div>` : '', '</div>', '</figure>', '</div>', '</section>'].join('');
|
|
89
73
|
}
|
|
90
74
|
}
|
|
91
|
-
|
|
92
75
|
return result;
|
|
93
76
|
}
|
|
94
|
-
|
|
95
77
|
})
|
|
96
78
|
};
|
|
97
79
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-grammar-epigraph",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,12 +20,13 @@
|
|
|
20
20
|
"@babel/cli": "^7.10.5",
|
|
21
21
|
"@babel/core": "^7.10.5",
|
|
22
22
|
"@babel/preset-env": "^7.10.4",
|
|
23
|
+
"browserslist": "^4.17.4",
|
|
23
24
|
"jest": "^26.6.3",
|
|
24
|
-
"rimraf": "^2.
|
|
25
|
+
"rimraf": "^2.7.1"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@canopycanopycanopy/b-ber-logger": "
|
|
28
|
-
"@canopycanopycanopy/b-ber-parser-figure": "
|
|
28
|
+
"@canopycanopycanopy/b-ber-logger": "2.0.2",
|
|
29
|
+
"@canopycanopycanopy/b-ber-parser-figure": "2.0.2",
|
|
29
30
|
"lodash": "^4.17.21",
|
|
30
31
|
"tar": "^6.1.11"
|
|
31
32
|
},
|
|
@@ -46,5 +47,5 @@
|
|
|
46
47
|
"url": "https://maxwellsimmer.com"
|
|
47
48
|
}
|
|
48
49
|
],
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "9b13185f21f602f8a2bf3a4cf503b1fd644d6432"
|
|
50
51
|
}
|