NoUndefinedConfiguration.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. var __values = (this && this.__values) || function(o) {
  3. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  4. if (m) return m.call(o);
  5. if (o && typeof o.length === "number") return {
  6. next: function () {
  7. if (o && i >= o.length) o = void 0;
  8. return { value: o && o[i++], done: !o };
  9. }
  10. };
  11. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  12. };
  13. Object.defineProperty(exports, "__esModule", { value: true });
  14. exports.NoUndefinedConfiguration = void 0;
  15. var Configuration_js_1 = require("../Configuration.js");
  16. function noUndefined(parser, name) {
  17. var e_1, _a;
  18. var textNode = parser.create('text', '\\' + name);
  19. var options = parser.options.noundefined || {};
  20. var def = {};
  21. try {
  22. for (var _b = __values(['color', 'background', 'size']), _c = _b.next(); !_c.done; _c = _b.next()) {
  23. var id = _c.value;
  24. if (options[id]) {
  25. def['math' + id] = options[id];
  26. }
  27. }
  28. }
  29. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  30. finally {
  31. try {
  32. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  33. }
  34. finally { if (e_1) throw e_1.error; }
  35. }
  36. parser.Push(parser.create('node', 'mtext', [], def, textNode));
  37. }
  38. exports.NoUndefinedConfiguration = Configuration_js_1.Configuration.create('noundefined', {
  39. fallback: { macro: noUndefined },
  40. options: {
  41. noundefined: {
  42. color: 'red',
  43. background: '',
  44. size: ''
  45. }
  46. },
  47. priority: 3
  48. });
  49. //# sourceMappingURL=NoUndefinedConfiguration.js.map