UNPKG

@awesome-fe/translate

Version:
51 lines 2.08 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ListRenderer = void 0; var block_node_renderer_1 = require("./block-node-renderer"); var adoc_1 = require("../../utils/adoc"); function getLevelOf(node) { if (adoc_1.adoc.isList(node)) { return getLevelOf(node.getParent()) + 1; } else if (adoc_1.adoc.isDocument(node)) { return -1; } else { return getLevelOf(node.getParent()); } } var defaultStyles = ['arabic', 'loweralpha', 'lowerroman', 'upperalpha', 'upperroman']; var ListRenderer = /** @class */ (function (_super) { __extends(ListRenderer, _super); function ListRenderer() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ignoredAttributeNames = ['checklist-option']; return _this; } ListRenderer.prototype.getDefaultAttributes = function (node) { var _a; var level = getLevelOf(node); return { style: (_a = defaultStyles[level]) !== null && _a !== void 0 ? _a : 'arabic' }; }; ListRenderer.prototype.getBlockTitle = function (node) { return node.getTitle(); }; return ListRenderer; }(block_node_renderer_1.BlockNodeRenderer)); exports.ListRenderer = ListRenderer; //# sourceMappingURL=list-renderer.js.map