/// <summary>
/// string GetString(this bool value, string trueText, string falseText = null)
/// string GetString(this int? value, string format = null)
/// string GetString(this long? value, string format = null)
/// string GetString(this double? value, string format = null)
/// string GetString(this float? value, string format = null)
/// string GetString(this decimal? value, string format = null)
/// string GetString(this DateTime? value, string format = null)
/// </summary>
public static partial class _e
String.prototype.escape = function () {
var tmls = {
'&': '&',
'<': '<',
'>': '>'
};
return this.replace(/[&<>]/g, function (tag) {
return tmls[tag] || tag;
});
};
(function ($) {
$('.add-html-code').each(function () {
var
_this = $(this),
s = _this.innerHTML.escape(),
r = '<pre class="language-html line-numbers">' + s + '</pre>';
alert(_this.innerHTML);
if (_this.data('target')) {
$('#' + _this.data('target')).html(r);
}
else {
_this.after('<br/><h5>Code:</h5><div>' + r + '</div><p> </p>');
}
});
})(jQuery);
Я пробовал это решение внедрить раньше (несколько лет назад), и уперся в эти ограничения.
Или сейчас уже все не так обстоит? Сейчас попробую, конечно, но что-то есть сомнения. Как такая задача решается, например, на стороне SharePoint Services?