1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/compiler/src/i18n/serializers/xml_helper", ["require", "exports", "tslib"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.escapeXml = exports.CR = exports.Text = exports.Tag = exports.Doctype = exports.Declaration = exports.serialize = void 0;
|
---|
20 | var tslib_1 = require("tslib");
|
---|
21 | var _Visitor = /** @class */ (function () {
|
---|
22 | function _Visitor() {
|
---|
23 | }
|
---|
24 | _Visitor.prototype.visitTag = function (tag) {
|
---|
25 | var _this = this;
|
---|
26 | var strAttrs = this._serializeAttributes(tag.attrs);
|
---|
27 | if (tag.children.length == 0) {
|
---|
28 | return "<" + tag.name + strAttrs + "/>";
|
---|
29 | }
|
---|
30 | var strChildren = tag.children.map(function (node) { return node.visit(_this); });
|
---|
31 | return "<" + tag.name + strAttrs + ">" + strChildren.join('') + "</" + tag.name + ">";
|
---|
32 | };
|
---|
33 | _Visitor.prototype.visitText = function (text) {
|
---|
34 | return text.value;
|
---|
35 | };
|
---|
36 | _Visitor.prototype.visitDeclaration = function (decl) {
|
---|
37 | return "<?xml" + this._serializeAttributes(decl.attrs) + " ?>";
|
---|
38 | };
|
---|
39 | _Visitor.prototype._serializeAttributes = function (attrs) {
|
---|
40 | var strAttrs = Object.keys(attrs).map(function (name) { return name + "=\"" + attrs[name] + "\""; }).join(' ');
|
---|
41 | return strAttrs.length > 0 ? ' ' + strAttrs : '';
|
---|
42 | };
|
---|
43 | _Visitor.prototype.visitDoctype = function (doctype) {
|
---|
44 | return "<!DOCTYPE " + doctype.rootTag + " [\n" + doctype.dtd + "\n]>";
|
---|
45 | };
|
---|
46 | return _Visitor;
|
---|
47 | }());
|
---|
48 | var _visitor = new _Visitor();
|
---|
49 | function serialize(nodes) {
|
---|
50 | return nodes.map(function (node) { return node.visit(_visitor); }).join('');
|
---|
51 | }
|
---|
52 | exports.serialize = serialize;
|
---|
53 | var Declaration = /** @class */ (function () {
|
---|
54 | function Declaration(unescapedAttrs) {
|
---|
55 | var _this = this;
|
---|
56 | this.attrs = {};
|
---|
57 | Object.keys(unescapedAttrs).forEach(function (k) {
|
---|
58 | _this.attrs[k] = escapeXml(unescapedAttrs[k]);
|
---|
59 | });
|
---|
60 | }
|
---|
61 | Declaration.prototype.visit = function (visitor) {
|
---|
62 | return visitor.visitDeclaration(this);
|
---|
63 | };
|
---|
64 | return Declaration;
|
---|
65 | }());
|
---|
66 | exports.Declaration = Declaration;
|
---|
67 | var Doctype = /** @class */ (function () {
|
---|
68 | function Doctype(rootTag, dtd) {
|
---|
69 | this.rootTag = rootTag;
|
---|
70 | this.dtd = dtd;
|
---|
71 | }
|
---|
72 | Doctype.prototype.visit = function (visitor) {
|
---|
73 | return visitor.visitDoctype(this);
|
---|
74 | };
|
---|
75 | return Doctype;
|
---|
76 | }());
|
---|
77 | exports.Doctype = Doctype;
|
---|
78 | var Tag = /** @class */ (function () {
|
---|
79 | function Tag(name, unescapedAttrs, children) {
|
---|
80 | var _this = this;
|
---|
81 | if (unescapedAttrs === void 0) { unescapedAttrs = {}; }
|
---|
82 | if (children === void 0) { children = []; }
|
---|
83 | this.name = name;
|
---|
84 | this.children = children;
|
---|
85 | this.attrs = {};
|
---|
86 | Object.keys(unescapedAttrs).forEach(function (k) {
|
---|
87 | _this.attrs[k] = escapeXml(unescapedAttrs[k]);
|
---|
88 | });
|
---|
89 | }
|
---|
90 | Tag.prototype.visit = function (visitor) {
|
---|
91 | return visitor.visitTag(this);
|
---|
92 | };
|
---|
93 | return Tag;
|
---|
94 | }());
|
---|
95 | exports.Tag = Tag;
|
---|
96 | var Text = /** @class */ (function () {
|
---|
97 | function Text(unescapedValue) {
|
---|
98 | this.value = escapeXml(unescapedValue);
|
---|
99 | }
|
---|
100 | Text.prototype.visit = function (visitor) {
|
---|
101 | return visitor.visitText(this);
|
---|
102 | };
|
---|
103 | return Text;
|
---|
104 | }());
|
---|
105 | exports.Text = Text;
|
---|
106 | var CR = /** @class */ (function (_super) {
|
---|
107 | tslib_1.__extends(CR, _super);
|
---|
108 | function CR(ws) {
|
---|
109 | if (ws === void 0) { ws = 0; }
|
---|
110 | return _super.call(this, "\n" + new Array(ws + 1).join(' ')) || this;
|
---|
111 | }
|
---|
112 | return CR;
|
---|
113 | }(Text));
|
---|
114 | exports.CR = CR;
|
---|
115 | var _ESCAPED_CHARS = [
|
---|
116 | [/&/g, '&'],
|
---|
117 | [/"/g, '"'],
|
---|
118 | [/'/g, '''],
|
---|
119 | [/</g, '<'],
|
---|
120 | [/>/g, '>'],
|
---|
121 | ];
|
---|
122 | // Escape `_ESCAPED_CHARS` characters in the given text with encoded entities
|
---|
123 | function escapeXml(text) {
|
---|
124 | return _ESCAPED_CHARS.reduce(function (text, entry) { return text.replace(entry[0], entry[1]); }, text);
|
---|
125 | }
|
---|
126 | exports.escapeXml = escapeXml;
|
---|
127 | });
|
---|
128 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieG1sX2hlbHBlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9pMThuL3NlcmlhbGl6ZXJzL3htbF9oZWxwZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQVNIO1FBQUE7UU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