trusty-cms 4.1.3 → 4.1.8
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +127 -120
- data/README.md +1 -1
- data/app/assets/javascripts/admin/assets.js +1 -1
- data/app/assets/javascripts/rad_social/rad_ajax_form.js +3 -0
- data/app/assets/javascripts/rad_social/rad_email.js +0 -1
- data/app/assets/javascripts/rad_social/rad_email_form.js +2 -7
- data/app/assets/stylesheets/rad_social/rad_screen.scss +0 -4
- data/app/controllers/social_mailer_controller.rb +0 -7
- data/app/views/admin/assets/edit.html.haml +3 -0
- data/app/views/rad_social_mailer/social_mail_form.html.haml +1 -3
- data/app/views/widget/_email_form.html.haml +0 -5
- data/config/locales/en.yml +1 -0
- data/lib/trusty_cms.rb +1 -1
- data/lib/trusty_cms/engine.rb +0 -1
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +126 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +4 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +56 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +43 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +28 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +36 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +76 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +23 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +87 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +157 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +142 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +81 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +17 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +37 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +34 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +40 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +62 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +60 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +35 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +131 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +105 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +80 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +91 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +93 -0
- data/trusty_cms.gemspec +4 -4
- data/yarn.lock +6 -6
- metadata +7574 -75
- data/app/assets/javascripts/rad_social/captcha.js +0 -42
@@ -16,6 +16,9 @@ function RadAjaxForm(form) {
|
|
16
16
|
type: "POST",
|
17
17
|
url: form.find('input[name=submit_url]').attr('value'),
|
18
18
|
data: form.serialize(),
|
19
|
+
beforeSend: function ( xhr ) {
|
20
|
+
xhr.setRequestHeader("X-CSRF-Token", $('meta[name=csrf-token]').attr('content'));
|
21
|
+
},
|
19
22
|
success: function(data, status, xhr) {
|
20
23
|
form.find(".loader").removeClass('ajax-loader');
|
21
24
|
form.find(".loader-small").removeClass('ajax-loader-small');
|
@@ -63,17 +63,12 @@ $(document).ready(function() {
|
|
63
63
|
$('#rs-from_name').val('');
|
64
64
|
$('#rs-to').val('');
|
65
65
|
$('#rs-message').val($('#rs-base-message').val());
|
66
|
-
var captcha = new Captcha("#recaptcha-container");
|
67
|
-
captcha.reload();
|
68
66
|
}
|
69
67
|
|
70
|
-
function processFailure(xhr)
|
71
|
-
{
|
72
|
-
var captcha = new Captcha("#recaptcha-container");
|
68
|
+
function processFailure(xhr) {
|
73
69
|
var error_msg = xhr.getResponseHeader("ErrorMsg");
|
74
70
|
displayErrorMessage(error_msg);
|
75
|
-
|
76
|
-
}
|
71
|
+
}
|
77
72
|
|
78
73
|
function displayErrorMessage(msg) {
|
79
74
|
var error_msg_div = $('.rad-email-error');
|
@@ -12,13 +12,6 @@ class SocialMailerController < ApplicationController
|
|
12
12
|
message: params[:message],
|
13
13
|
subject: params[:subject],
|
14
14
|
}
|
15
|
-
|
16
|
-
if verify_recaptcha(action: 'emailSeats')
|
17
|
-
RadSocialMailer.social_mail(mailer_options).deliver_now
|
18
|
-
head :ok
|
19
|
-
else
|
20
|
-
head :bad_request, ErrorMsg: 'We have detected suspicious activity and have disabled this feature for your user.'
|
21
|
-
end
|
22
15
|
end
|
23
16
|
|
24
17
|
def social_mail_form
|
@@ -14,6 +14,9 @@
|
|
14
14
|
%fieldset
|
15
15
|
%label.filename
|
16
16
|
= "#{t("clipped_extension.filename")}: #{@asset.asset_file_name unless @asset.new_record?}"
|
17
|
+
%br
|
18
|
+
%label.url
|
19
|
+
= "#{t("clipped_extension.asset_url")}: #{image_path @asset.thumbnail unless @asset.new_record?}"
|
17
20
|
%p.asset
|
18
21
|
- display_size = TrustyCms::config['assets.display_size'] || 'normal'
|
19
22
|
= image_tag @asset.thumbnail(display_size.to_sym), :class => 'preview'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
= stylesheet_link_tag('rad_social/rad_screen')
|
2
|
-
= javascript_include_tag('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js')
|
3
2
|
= javascript_include_tag('rad_social/rad_email')
|
3
|
+
= csrf_meta_tags
|
4
4
|
|
5
5
|
.rad-dialog-titlebar
|
6
6
|
%span.rad-dialog-title
|
@@ -31,8 +31,6 @@
|
|
31
31
|
= email_message
|
32
32
|
%input{:type=>'hidden', :name=>'subject', :value=> email_subject}
|
33
33
|
%input{:type=>'hidden', :id=>'rs-base-message', :value=> email_message}
|
34
|
-
#recaptcha-container.captcha-container
|
35
|
-
= recaptcha_v3 action: 'emailSeats'
|
36
34
|
%input{:type=>'hidden', :name=>'submit_url', :value=> email_action_url}
|
37
35
|
%input.button.primary-button{:id => 'rad_email_submit', :type=>:button ,:value=>'Submit'}
|
38
36
|
.loader
|
@@ -1,5 +1,3 @@
|
|
1
|
-
- javascript('rad_social/captcha')
|
2
|
-
|
3
1
|
= form_tag
|
4
2
|
%form{:id=>'rad_social_email_form', :class=>'rad-email-form'}
|
5
3
|
%label{:for => 'from'}
|
@@ -20,6 +18,3 @@
|
|
20
18
|
%input{:type=>'hidden', :name=>'submit_url', :value=>'contact/email'}
|
21
19
|
%input.button.primary-button{:id => 'email_submit', :type=>:button ,:value=>'Submit'}
|
22
20
|
.loader
|
23
|
-
|
24
|
-
#recaptcha-container.captcha-container
|
25
|
-
= recaptcha_v3 action: 'emailSeats'
|
data/config/locales/en.yml
CHANGED
@@ -65,6 +65,7 @@ en:
|
|
65
65
|
asset_errors: 'Sorry. {{errors}}'
|
66
66
|
asset_page_attachment_note: 'Attached assets. These can be inserted with drag and drop or shown with the <code><r:assets:each /></code> tag.'
|
67
67
|
asset_note: 'Attached assets. '
|
68
|
+
asset_url: 'Asset URL'
|
68
69
|
assets: 'Assets'
|
69
70
|
assets_explanation: 'Assets and images can be uploaded and then attached or inserted into pages, snippets and layouts. Click on an asset name above to edit it or click <code>Remove</code> to delete it.'
|
70
71
|
assets_title: 'Assets'
|
data/lib/trusty_cms.rb
CHANGED
data/lib/trusty_cms/engine.rb
CHANGED
@@ -0,0 +1,126 @@
|
|
1
|
+
import Scalar from '../schema/Scalar';
|
2
|
+
import { stringifyNumber } from '../stringify';
|
3
|
+
import failsafe from './failsafe';
|
4
|
+
import { boolOptions, nullOptions } from './options';
|
5
|
+
export var nullObj = {
|
6
|
+
identify: function identify(value) {
|
7
|
+
return value == null;
|
8
|
+
},
|
9
|
+
createNode: function createNode(schema, value, ctx) {
|
10
|
+
return ctx.wrapScalars ? new Scalar(null) : null;
|
11
|
+
},
|
12
|
+
default: true,
|
13
|
+
tag: 'tag:yaml.org,2002:null',
|
14
|
+
test: /^(?:~|[Nn]ull|NULL)?$/,
|
15
|
+
resolve: function resolve() {
|
16
|
+
return null;
|
17
|
+
},
|
18
|
+
options: nullOptions,
|
19
|
+
stringify: function stringify() {
|
20
|
+
return nullOptions.nullStr;
|
21
|
+
}
|
22
|
+
};
|
23
|
+
export var boolObj = {
|
24
|
+
identify: function identify(value) {
|
25
|
+
return typeof value === 'boolean';
|
26
|
+
},
|
27
|
+
default: true,
|
28
|
+
tag: 'tag:yaml.org,2002:bool',
|
29
|
+
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
30
|
+
resolve: function resolve(str) {
|
31
|
+
return str[0] === 't' || str[0] === 'T';
|
32
|
+
},
|
33
|
+
options: boolOptions,
|
34
|
+
stringify: function stringify(_ref) {
|
35
|
+
var value = _ref.value;
|
36
|
+
return value ? boolOptions.trueStr : boolOptions.falseStr;
|
37
|
+
}
|
38
|
+
};
|
39
|
+
export var octObj = {
|
40
|
+
identify: function identify(value) {
|
41
|
+
return typeof value === 'number';
|
42
|
+
},
|
43
|
+
default: true,
|
44
|
+
tag: 'tag:yaml.org,2002:int',
|
45
|
+
format: 'OCT',
|
46
|
+
test: /^0o([0-7]+)$/,
|
47
|
+
resolve: function resolve(str, oct) {
|
48
|
+
return parseInt(oct, 8);
|
49
|
+
},
|
50
|
+
stringify: function stringify(_ref2) {
|
51
|
+
var value = _ref2.value;
|
52
|
+
return '0o' + value.toString(8);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
export var intObj = {
|
56
|
+
identify: function identify(value) {
|
57
|
+
return typeof value === 'number';
|
58
|
+
},
|
59
|
+
default: true,
|
60
|
+
tag: 'tag:yaml.org,2002:int',
|
61
|
+
test: /^[-+]?[0-9]+$/,
|
62
|
+
resolve: function resolve(str) {
|
63
|
+
return parseInt(str, 10);
|
64
|
+
},
|
65
|
+
stringify: stringifyNumber
|
66
|
+
};
|
67
|
+
export var hexObj = {
|
68
|
+
identify: function identify(value) {
|
69
|
+
return typeof value === 'number';
|
70
|
+
},
|
71
|
+
default: true,
|
72
|
+
tag: 'tag:yaml.org,2002:int',
|
73
|
+
format: 'HEX',
|
74
|
+
test: /^0x([0-9a-fA-F]+)$/,
|
75
|
+
resolve: function resolve(str, hex) {
|
76
|
+
return parseInt(hex, 16);
|
77
|
+
},
|
78
|
+
stringify: function stringify(_ref3) {
|
79
|
+
var value = _ref3.value;
|
80
|
+
return '0x' + value.toString(16);
|
81
|
+
}
|
82
|
+
};
|
83
|
+
export var nanObj = {
|
84
|
+
identify: function identify(value) {
|
85
|
+
return typeof value === 'number';
|
86
|
+
},
|
87
|
+
default: true,
|
88
|
+
tag: 'tag:yaml.org,2002:float',
|
89
|
+
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
90
|
+
resolve: function resolve(str, nan) {
|
91
|
+
return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
|
92
|
+
},
|
93
|
+
stringify: stringifyNumber
|
94
|
+
};
|
95
|
+
export var expObj = {
|
96
|
+
identify: function identify(value) {
|
97
|
+
return typeof value === 'number';
|
98
|
+
},
|
99
|
+
default: true,
|
100
|
+
tag: 'tag:yaml.org,2002:float',
|
101
|
+
format: 'EXP',
|
102
|
+
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
103
|
+
resolve: function resolve(str) {
|
104
|
+
return parseFloat(str);
|
105
|
+
},
|
106
|
+
stringify: function stringify(_ref4) {
|
107
|
+
var value = _ref4.value;
|
108
|
+
return Number(value).toExponential();
|
109
|
+
}
|
110
|
+
};
|
111
|
+
export var floatObj = {
|
112
|
+
identify: function identify(value) {
|
113
|
+
return typeof value === 'number';
|
114
|
+
},
|
115
|
+
default: true,
|
116
|
+
tag: 'tag:yaml.org,2002:float',
|
117
|
+
test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
|
118
|
+
resolve: function resolve(str, frac1, frac2) {
|
119
|
+
var frac = frac1 || frac2;
|
120
|
+
var node = new Scalar(parseFloat(str));
|
121
|
+
if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
|
122
|
+
return node;
|
123
|
+
},
|
124
|
+
stringify: stringifyNumber
|
125
|
+
};
|
126
|
+
export default failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
import YAMLMap from '../../schema/Map';
|
4
|
+
import parseMap from '../../schema/parseMap';
|
5
|
+
|
6
|
+
function createMap(schema, obj, ctx) {
|
7
|
+
var map = new YAMLMap(schema);
|
8
|
+
|
9
|
+
if (obj instanceof Map) {
|
10
|
+
var _iteratorNormalCompletion = true;
|
11
|
+
var _didIteratorError = false;
|
12
|
+
var _iteratorError = undefined;
|
13
|
+
|
14
|
+
try {
|
15
|
+
for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
16
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
17
|
+
key = _step$value[0],
|
18
|
+
value = _step$value[1];
|
19
|
+
|
20
|
+
map.items.push(schema.createPair(key, value, ctx));
|
21
|
+
}
|
22
|
+
} catch (err) {
|
23
|
+
_didIteratorError = true;
|
24
|
+
_iteratorError = err;
|
25
|
+
} finally {
|
26
|
+
try {
|
27
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
28
|
+
_iterator.return();
|
29
|
+
}
|
30
|
+
} finally {
|
31
|
+
if (_didIteratorError) {
|
32
|
+
throw _iteratorError;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
} else if (obj && _typeof(obj) === 'object') {
|
37
|
+
for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
|
38
|
+
var _key = _Object$keys[_i];
|
39
|
+
map.items.push(schema.createPair(_key, obj[_key], ctx));
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
if (typeof schema.sortMapEntries === 'function') {
|
44
|
+
map.items.sort(schema.sortMapEntries);
|
45
|
+
}
|
46
|
+
|
47
|
+
return map;
|
48
|
+
}
|
49
|
+
|
50
|
+
export default {
|
51
|
+
createNode: createMap,
|
52
|
+
default: true,
|
53
|
+
nodeClass: YAMLMap,
|
54
|
+
tag: 'tag:yaml.org,2002:map',
|
55
|
+
resolve: parseMap
|
56
|
+
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import parseSeq from '../../schema/parseSeq';
|
2
|
+
import YAMLSeq from '../../schema/Seq';
|
3
|
+
|
4
|
+
function createSeq(schema, obj, ctx) {
|
5
|
+
var seq = new YAMLSeq(schema);
|
6
|
+
|
7
|
+
if (obj && obj[Symbol.iterator]) {
|
8
|
+
var _iteratorNormalCompletion = true;
|
9
|
+
var _didIteratorError = false;
|
10
|
+
var _iteratorError = undefined;
|
11
|
+
|
12
|
+
try {
|
13
|
+
for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
14
|
+
var it = _step.value;
|
15
|
+
var v = schema.createNode(it, ctx.wrapScalars, null, ctx);
|
16
|
+
seq.items.push(v);
|
17
|
+
}
|
18
|
+
} catch (err) {
|
19
|
+
_didIteratorError = true;
|
20
|
+
_iteratorError = err;
|
21
|
+
} finally {
|
22
|
+
try {
|
23
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
24
|
+
_iterator.return();
|
25
|
+
}
|
26
|
+
} finally {
|
27
|
+
if (_didIteratorError) {
|
28
|
+
throw _iteratorError;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
return seq;
|
35
|
+
}
|
36
|
+
|
37
|
+
export default {
|
38
|
+
createNode: createSeq,
|
39
|
+
default: true,
|
40
|
+
nodeClass: YAMLSeq,
|
41
|
+
tag: 'tag:yaml.org,2002:seq',
|
42
|
+
resolve: parseSeq
|
43
|
+
};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { stringifyString } from '../../stringify';
|
2
|
+
import { strOptions } from '../options';
|
3
|
+
export var resolveString = function resolveString(doc, node) {
|
4
|
+
// on error, will return { str: string, errors: Error[] }
|
5
|
+
var res = node.strValue;
|
6
|
+
if (!res) return '';
|
7
|
+
if (typeof res === 'string') return res;
|
8
|
+
res.errors.forEach(function (error) {
|
9
|
+
if (!error.source) error.source = node;
|
10
|
+
doc.errors.push(error);
|
11
|
+
});
|
12
|
+
return res.str;
|
13
|
+
};
|
14
|
+
export default {
|
15
|
+
identify: function identify(value) {
|
16
|
+
return typeof value === 'string';
|
17
|
+
},
|
18
|
+
default: true,
|
19
|
+
tag: 'tag:yaml.org,2002:str',
|
20
|
+
resolve: resolveString,
|
21
|
+
stringify: function stringify(item, ctx, onComment, onChompKeep) {
|
22
|
+
ctx = Object.assign({
|
23
|
+
actualString: true
|
24
|
+
}, ctx);
|
25
|
+
return stringifyString(item, ctx, onComment, onChompKeep);
|
26
|
+
},
|
27
|
+
options: strOptions
|
28
|
+
};
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import core, { nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj } from './core';
|
2
|
+
import failsafe from './failsafe';
|
3
|
+
import json from './json';
|
4
|
+
import yaml11 from './yaml-1.1';
|
5
|
+
import map from './failsafe/map';
|
6
|
+
import seq from './failsafe/seq';
|
7
|
+
import binary from './yaml-1.1/binary';
|
8
|
+
import omap from './yaml-1.1/omap';
|
9
|
+
import pairs from './yaml-1.1/pairs';
|
10
|
+
import set from './yaml-1.1/set';
|
11
|
+
import { floatTime, intTime, timestamp } from './yaml-1.1/timestamp';
|
12
|
+
export var schemas = {
|
13
|
+
core: core,
|
14
|
+
failsafe: failsafe,
|
15
|
+
json: json,
|
16
|
+
yaml11: yaml11
|
17
|
+
};
|
18
|
+
export var tags = {
|
19
|
+
binary: binary,
|
20
|
+
bool: boolObj,
|
21
|
+
float: floatObj,
|
22
|
+
floatExp: expObj,
|
23
|
+
floatNaN: nanObj,
|
24
|
+
floatTime: floatTime,
|
25
|
+
int: intObj,
|
26
|
+
intHex: hexObj,
|
27
|
+
intOct: octObj,
|
28
|
+
intTime: intTime,
|
29
|
+
map: map,
|
30
|
+
null: nullObj,
|
31
|
+
omap: omap,
|
32
|
+
pairs: pairs,
|
33
|
+
seq: seq,
|
34
|
+
set: set,
|
35
|
+
timestamp: timestamp
|
36
|
+
};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import map from './failsafe/map';
|
2
|
+
import seq from './failsafe/seq';
|
3
|
+
import Scalar from '../schema/Scalar';
|
4
|
+
import { resolveString } from './failsafe/string';
|
5
|
+
var schema = [map, seq, {
|
6
|
+
identify: function identify(value) {
|
7
|
+
return typeof value === 'string';
|
8
|
+
},
|
9
|
+
default: true,
|
10
|
+
tag: 'tag:yaml.org,2002:str',
|
11
|
+
resolve: resolveString,
|
12
|
+
stringify: function stringify(value) {
|
13
|
+
return JSON.stringify(value);
|
14
|
+
}
|
15
|
+
}, {
|
16
|
+
identify: function identify(value) {
|
17
|
+
return value == null;
|
18
|
+
},
|
19
|
+
createNode: function createNode(schema, value, ctx) {
|
20
|
+
return ctx.wrapScalars ? new Scalar(null) : null;
|
21
|
+
},
|
22
|
+
default: true,
|
23
|
+
tag: 'tag:yaml.org,2002:null',
|
24
|
+
test: /^null$/,
|
25
|
+
resolve: function resolve() {
|
26
|
+
return null;
|
27
|
+
},
|
28
|
+
stringify: function stringify(value) {
|
29
|
+
return JSON.stringify(value);
|
30
|
+
}
|
31
|
+
}, {
|
32
|
+
identify: function identify(value) {
|
33
|
+
return typeof value === 'boolean';
|
34
|
+
},
|
35
|
+
default: true,
|
36
|
+
tag: 'tag:yaml.org,2002:bool',
|
37
|
+
test: /^true|false$/,
|
38
|
+
resolve: function resolve(str) {
|
39
|
+
return str === 'true';
|
40
|
+
},
|
41
|
+
stringify: function stringify(value) {
|
42
|
+
return JSON.stringify(value);
|
43
|
+
}
|
44
|
+
}, {
|
45
|
+
identify: function identify(value) {
|
46
|
+
return typeof value === 'number';
|
47
|
+
},
|
48
|
+
default: true,
|
49
|
+
tag: 'tag:yaml.org,2002:int',
|
50
|
+
test: /^-?(?:0|[1-9][0-9]*)$/,
|
51
|
+
resolve: function resolve(str) {
|
52
|
+
return parseInt(str, 10);
|
53
|
+
},
|
54
|
+
stringify: function stringify(value) {
|
55
|
+
return JSON.stringify(value);
|
56
|
+
}
|
57
|
+
}, {
|
58
|
+
identify: function identify(value) {
|
59
|
+
return typeof value === 'number';
|
60
|
+
},
|
61
|
+
default: true,
|
62
|
+
tag: 'tag:yaml.org,2002:float',
|
63
|
+
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
64
|
+
resolve: function resolve(str) {
|
65
|
+
return parseFloat(str);
|
66
|
+
},
|
67
|
+
stringify: function stringify(value) {
|
68
|
+
return JSON.stringify(value);
|
69
|
+
}
|
70
|
+
}];
|
71
|
+
|
72
|
+
schema.scalarFallback = function (str) {
|
73
|
+
throw new SyntaxError("Unresolved plain scalar ".concat(JSON.stringify(str)));
|
74
|
+
};
|
75
|
+
|
76
|
+
export default schema;
|