@canopycanopycanopy/b-ber-grammar-logo 2.0.0 → 3.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.
Files changed (2) hide show
  1. package/dist/index.js +0 -19
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -1,31 +1,19 @@
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 _fsExtra = _interopRequireDefault(require("fs-extra"));
18
-
19
12
  var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
20
-
21
13
  var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
22
-
23
14
  var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
24
-
25
15
  var _bBerParserFigure = _interopRequireDefault(require("@canopycanopycanopy/b-ber-parser-figure"));
26
-
27
16
  var _bBerGrammarAttributes = require("@canopycanopycanopy/b-ber-grammar-attributes");
28
-
29
17
  const MARKER_RE = /^logo/;
30
18
  const DIRECTIVE_RE = /(logo)(?::([^\s]+)(\s?.*)?)?$/;
31
19
  var _default = {
@@ -36,14 +24,11 @@ var _default = {
36
24
  }) => ({
37
25
  marker: _bBerShapesDirectives.INLINE_DIRECTIVE_MARKER,
38
26
  minMarkers: _bBerShapesDirectives.INLINE_DIRECTIVE_MARKER_MIN_LENGTH,
39
-
40
27
  validate(params) {
41
28
  return (0, _trim.default)(params).call(params).match(MARKER_RE);
42
29
  },
43
-
44
30
  render(tokens, index) {
45
31
  var _context;
46
-
47
32
  const match = (0, _trim.default)(_context = tokens[index].info).call(_context).match(DIRECTIVE_RE);
48
33
  if (!match) return '';
49
34
  const fileName = `_markdown/${context.fileName}.md`;
@@ -54,19 +39,15 @@ var _default = {
54
39
  lineNumber
55
40
  });
56
41
  if (!attrsObj.source) _bBerLogger.default.error('[source] attribute is required by [logo] directive, aborting');
57
-
58
42
  const inputImagePath = _State.default.src.images(attrsObj.source);
59
-
60
43
  const outputImagePath = `../images/${attrsObj.source}`;
61
44
  if (!_fsExtra.default.existsSync(inputImagePath)) _bBerLogger.default.warn(`Image [${attrsObj.source}] does not exist`);
62
45
  delete attrsObj.source; // since we need the path relative to `images`
63
-
64
46
  const attrString = (0, _bBerGrammarAttributes.attributesString)(attrsObj, type);
65
47
  return `<figure id="${(0, _bBerGrammarAttributes.htmlId)(id)}" class="logo">
66
48
  <img style="width:120px;" src="${outputImagePath}" ${attrString}/>
67
49
  </figure>`;
68
50
  }
69
-
70
51
  })
71
52
  };
72
53
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-grammar-logo",
3
- "version": "2.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,11 +25,11 @@
25
25
  "rimraf": "^2.7.1"
26
26
  },
27
27
  "dependencies": {
28
- "@canopycanopycanopy/b-ber-grammar-attributes": "2.0.0",
29
- "@canopycanopycanopy/b-ber-lib": "2.0.0",
30
- "@canopycanopycanopy/b-ber-logger": "2.0.0",
31
- "@canopycanopycanopy/b-ber-parser-figure": "2.0.0",
32
- "@canopycanopycanopy/b-ber-shapes-directives": "2.0.0",
28
+ "@canopycanopycanopy/b-ber-grammar-attributes": "3.0.2",
29
+ "@canopycanopycanopy/b-ber-lib": "3.0.2",
30
+ "@canopycanopycanopy/b-ber-logger": "3.0.2",
31
+ "@canopycanopycanopy/b-ber-parser-figure": "3.0.2",
32
+ "@canopycanopycanopy/b-ber-shapes-directives": "3.0.2",
33
33
  "fs-extra": "^8.1.0",
34
34
  "lodash": "^4.17.21",
35
35
  "tar": "^6.1.11"
@@ -51,5 +51,5 @@
51
51
  "url": "https://maxwellsimmer.com"
52
52
  }
53
53
  ],
54
- "gitHead": "dbeae192709705f5bc211195ff343cbd999f9caf"
54
+ "gitHead": "1ec8ab9a4030fb59839d347beb04ab7605e3d5dd"
55
55
  }