From 4ad4d9287cdb3777ff2ada6cf46309f77917499f Mon Sep 17 00:00:00 2001 From: cescobedo Date: Wed, 1 Mar 2023 08:40:14 +0100 Subject: [PATCH] MDL-76921 atto_html: Upgrade JS Beautify to 1.14.7 --- lib/editor/atto/plugins/html/thirdpartylibs.xml | 2 +- .../moodle-atto_html-beautify-debug.js | 2 +- .../moodle-atto_html-beautify/moodle-atto_html-beautify-min.js | 2 +- .../moodle-atto_html-beautify/moodle-atto_html-beautify.js | 2 +- .../atto/plugins/html/yui/src/beautify/js/beautify-html.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/editor/atto/plugins/html/thirdpartylibs.xml b/lib/editor/atto/plugins/html/thirdpartylibs.xml index 7e661327d73..3bed82f3f40 100644 --- a/lib/editor/atto/plugins/html/thirdpartylibs.xml +++ b/lib/editor/atto/plugins/html/thirdpartylibs.xml @@ -12,7 +12,7 @@ yui/src/beautify jsbeautify Beautify HTML code in Atto. - 1.14.6 + 1.14.7 MIT https://github.com/beautify-web/js-beautify diff --git a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-debug.js b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-debug.js index 8c0e70977d2..6ebc08992d7 100644 --- a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-debug.js +++ b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-debug.js @@ -8119,7 +8119,7 @@ Beautifier.prototype._get_tag_open_token = function(raw_token) { //function to g parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted); parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted); - parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === '{'; + parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{'; return parser_token; }; diff --git a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-min.js b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-min.js index 6faa1105c3f..c16731212cc 100644 --- a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-min.js +++ b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify-min.js @@ -19,6 +19,6 @@ this._excluded.django||(e=(e=e||this.__patterns.django_comment.read())||this.__p e=t.split(/[^a-zA-Z0-9_\/\-]+/)),e},e.prototype._get_boolean=function(t,e){t=this.raw_options[t],e=t===undefined?!!e:!!t;return e},e.prototype._get_characters=function(t,e){t=this.raw_options[t],e=e||"";return e="string"==typeof t?t.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t"):e},e.prototype._get_number=function(t,e){var t=this.raw_options[t];return e=parseInt(e,10),isNaN(e)&&(e=0),t=parseInt(t,10),t=isNaN(t)?e:t},e.prototype._get_selection=function(t,e,n){n=this._get_selection_list(t,e,n);if(1!==n.length)throw new Error("Invalid Option Value: The option '"+t+"' can only be one of the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return n[0]},e.prototype._get_selection_list=function(t,e,n){if(!e||0===e.length)throw new Error("Selection list cannot be empty.");if(n=n||[e[0]],!this._is_valid_selection(n,e))throw new Error("Invalid Default Value!");n=this._get_array(t,n);if(!this._is_valid_selection(n,e))throw new Error("Invalid Option Value: The option '"+t+"' can contain only the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return n},e.prototype._is_valid_selection=function(t,e){return t.length&&e.length&&!t.some(function(t){return-1===e.indexOf(t)})},t.exports.Options=e,t.exports.normalizeOpts=_,t.exports.mergeOpts=n},,function(t){var i=RegExp.prototype.hasOwnProperty("sticky");function e(t){this.__input=t||"",this.__input_length=this.__input.length,this.__position=0}e.prototype.restart=function(){this.__position=0},e.prototype.back=function(){0=t.length&&this.__input.substring(e-t.length,e).toLowerCase()===t},t.exports.InputScanner=e},function(t,e,n){var i=n(8).InputScanner,s=n(3).Token,a=n(10).TokenStream,_=n(11).WhitespacePattern,u={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},n=function(t,e){this._input=new i(t),this._options=e||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new _(this._input)};n.prototype.tokenize=function(){var t,e,n,i,_;for(this._input.restart(),this.__tokens=new a,this._reset(),e=new s(u.START,""),n=null,i=[],_=new a;e.type!==u.EOF;){for(t=this._get_next_token(e,n);this._is_comment(t);)_.add(t),t=this._get_next_token(e,n);_.isEmpty()||(t.comments_before=_,_=new a),t.parent=n,this._is_opening(t)?(i.push(n),n=t):n&&this._is_closing(t,n)&&((t.opened=n).closed=t,n=i.pop(),t.parent=n),(t.previous=e).next=t,this.__tokens.add(t),e=t}return this.__tokens},n.prototype._is_first_token=function(){return this.__tokens.isEmpty()},n.prototype._reset=function(){},n.prototype._get_next_token=function(t,e){this._readWhitespace();var n=this._input.read(/.+/g);return n?this._create_token(u.RAW,n):this._create_token(u.EOF,"")},n.prototype._is_comment=function(t){return!1},n.prototype._is_opening=function(t){return!1},n.prototype._is_closing=function(t,e){return!1},n.prototype._create_token=function(t,e){return new s(t,e,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},n.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},t.exports.Tokenizer=n,t.exports.TOKEN=u},function(t){function e(t){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=t}e.prototype.restart=function(){this.__position=0},e.prototype.isEmpty=function(){return 0===this.__tokens_length},e.prototype.hasNext=function(){return this.__position/),erb:e.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:e.starting_with(/{%/).until_after(/%}/),django_value:e.starting_with(/{{/).until_after(/}}/),django_comment:e.starting_with(/{#/).until_after(/#}/),smarty:e.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:e.starting_with(/{\*/).until_after(/\*}/),smarty_literal:e.starting_with(/{literal}/).until_after(/{\/literal}/)}}(s.prototype=new i)._create=function(){return new s(this._input,this)},s.prototype._update=function(){this.__set_templated_pattern()},s.prototype.disable=function(t){var e=this._create();return e._disabled[t]=!0,e._update(),e},s.prototype.read_options=function(t){var e,n=this._create();for(e in _)n._disabled[e]=-1===t.templating.indexOf(e);return n._update(),n},s.prototype.exclude=function(t){var e=this._create();return e._excluded[t]=!0,e._update(),e},s.prototype.read=function(){for(var t="",t=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern),e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),t+=e,e=this._read_template();return this._until_after&&(t+=this._input.readUntilAfter(this._until_pattern)),t},s.prototype.__set_templated_pattern=function(){var t=[];this._disabled.php||t.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||t.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||t.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(t.push(this.__patterns.django._starting_pattern.source),t.push(this.__patterns.django_value._starting_pattern.source),t.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||t.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&t.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+t.join("|")+")")},s.prototype._read_template=function(){var t,e="",n=this._input.peek();return"<"===n?(t=this._input.peek(1),this._disabled.php||this._excluded.php||"?"!==t||(e=e||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==t||(e=e||this.__patterns.erb.read())):"{"===n&&(this._disabled.handlebars||this._excluded.handlebars||(e=(e=(e=e||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(e=e||this.__patterns.django_value.read()),this._excluded.django||(e=(e=e||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(e=(e=( e=e||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read())),e},t.exports.TemplatablePattern=s},,,,function(t,e,n){var _=n(19).Beautifier,i=n(20).Options;t.exports=function(t,e,n,i){return new _(t,e,n,i).beautify()},t.exports.defaultOptions=function(){return new i}},function(e,n,t){var _,s,o,i,u,r=t(20).Options,d=t(2).Output,f=t(21).Tokenizer,h=t(21).TOKEN,g=/\r\n|[\r\n]/,b=/\r\n|[\r\n]/g,p=function(t,e){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=t.max_preserve_newlines,this.preserve_newlines=t.preserve_newlines,this._output=new d(t,e)};function a(t,e){return-1!==e.indexOf(t)}function m(t,e,n){this.parent=t||null,this.tag=e?e.tag_name:"",this.indent_level=n||0,this.parser_token=e||null}function l(t){this._printer=t,this._current_frame=null}function c(t,e,n,i){this._source_text=t||"",e=e||{},this._js_beautify=n,this._css_beautify=i,this._tag_stack=null;t=new r(e,"html");this._options=t,this._is_wrap_attributes_force="force"===this._options.wrap_attributes.substr(0,"force".length),this._is_wrap_attributes_force_expand_multiline="force-expand-multiline"===this._options.wrap_attributes,this._is_wrap_attributes_force_aligned="force-aligned"===this._options.wrap_attributes,this._is_wrap_attributes_aligned_multiple="aligned-multiple"===this._options.wrap_attributes,this._is_wrap_attributes_preserve="preserve"===this._options.wrap_attributes.substr(0,"preserve".length),this._is_wrap_attributes_preserve_aligned="preserve-aligned"===this._options.wrap_attributes}p.prototype.current_line_has_match=function(t){return this._output.current_line.has_match(t)},p.prototype.set_space_before_token=function(t,e){this._output.space_before_token=t,this._output.non_breaking_space=e},p.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},p.prototype.add_raw_token=function(t){this._output.add_raw_token(t)},p.prototype.print_preserved_newlines=function(t){var e,n=0;for(t.type!==h.TEXT&&t.previous.type!==h.TEXT&&(n=t.newlines?1:0),this.preserve_newlines&&(n=t.newlines|]]>)$/.exec(i)))return void t.add_raw_token(e);s=u+n[1]+"\n",i=n[4],n[5]&&(a=u+n[5]),i=i.replace(/\n[ \t]*$/,""),(n[2]||-1!==n[3].indexOf("\n"))&&(n=n[3].match(/[ \t]+$/))&&(e.whitespace_before=n[0])}i=i&&(_?((n=function(){this.eol="\n"}).prototype=this._options.raw_options,_(u+i,new n)):u+(i=(n=e.whitespace_before)?i.replace(new RegExp("\n("+n+")?","g"),"\n"):i).replace(/\n/g,"\n"+u)),s&&(i=i?s+i+"\n"+a:s+a),t.print_newline(!1),i&&(e.text=i,e.whitespace_before="",e.newlines=0,t.add_raw_token(e),t.print_newline(!0))}},c.prototype._handle_tag_open=function(t,e,n,i){var _=this._get_tag_open_token(e);return!n.is_unformatted&&!n.is_content_unformatted||n.is_empty_element||e.type!==h.TAG_OPEN||0!==e.text.indexOf("]*)/),this.tag_check=n?n[1]:""):(n=e.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=n?n[1]:"",(e.text.startsWith("{{#>")||e.text.startsWith("{{~#>"))&&">"===this.tag_check[0]&&(">"===this.tag_check&&null!==e.next?this.tag_check=e.next.text.split(" ")[0]:this.tag_check=e.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),e.type===h.COMMENT&&(this.tag_complete=!0),this.is_start_tag="/"!==this.tag_check.charAt(0),this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||e.closed&&"/>"===e.closed.text,t=2,"{"===this.tag_start_char&&3<=this.text.length&&"~"===this.text.charAt(2)&&(t=3),this.is_end_tag=this.is_end_tag||"{"===this.tag_start_char&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(t)))):this.tag_complete=!0},c.prototype._get_tag_open_token=function(t){t=new o(this._tag_stack.get_parser_token(),t);return t.alignment_size=this._options.wrap_attributes_indent_size,t.is_end_tag=t.is_end_tag||a(t.tag_check,this._options.void_elements),t.is_empty_element=t.tag_complete||t.is_start_tag&&t.is_end_tag,t.is_unformatted=!t.tag_complete&&a(t.tag_check,this._options.unformatted),t.is_content_unformatted=!t.is_empty_element&&a(t.tag_check,this._options.content_unformatted),t.is_inline_element=a(t.tag_name,this._options.inline)||"{"===t.tag_start_char,t},c.prototype._set_tag_position=function(t,e,n,i,_){n.is_empty_element||(n.is_end_tag?n.start_tag_token=this._tag_stack.try_pop(n.tag_name):(this._do_optional_end_element(n)&&(n.is_inline_element||t.print_newline(!1)),this._tag_stack.record_tag(n),"script"!==n.tag_name&&"style"!==n.tag_name||n.is_unformatted||n.is_content_unformatted||(n.custom_beautifier_name=s(n.tag_check,e)))),a(n.tag_check,this._options.extra_liners)&&(t.print_newline(!1),t._output.just_added_blankline()||t.print_newline(!0)),n.is_empty_element?("{"===n.tag_start_char&&"else"===n.tag_check&&(this._tag_stack.indent_to_tag(["if","unless","each"]),n.indent_content=!0,t.current_line_has_match(/{{#if/)||t.print_newline(!1)),"!--"===n.tag_name&&_.type===h.TAG_CLOSE&&i.is_end_tag&&-1===n.text.indexOf("\n")||(n.is_inline_element||n.is_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,n))):n.is_end_tag?(e=!1,e=(e=n.start_tag_token&&n.start_tag_token.multiline_content)||!n.is_inline_element&&!(i.is_inline_element||i.is_unformatted)&&!(_.type===h.TAG_CLOSE&&n.start_tag_token===i)&&"TK_CONTENT"!==_.type,(e=n.is_content_unformatted||n.is_unformatted?!1:e)&&t.print_newline(!1)):(n.indent_content=!n.custom_beautifier_name,"<"===n.tag_start_char&&( +t.set_space_before_token(!0),n.attr_count+=1):(e.type===h.EQUALS||e.type===h.VALUE&&e.previous.type===h.EQUALS)&&t.set_space_before_token(!1),e.type===h.ATTRIBUTE&&"<"===n.tag_start_char&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(t.traverse_whitespace(e),r=r||0!==e.newlines),this._is_wrap_attributes_force)){if(_=1|]]>)$/.exec(i)))return void t.add_raw_token(e);s=u+n[1]+"\n",i=n[4],n[5]&&(a=u+n[5]),i=i.replace(/\n[ \t]*$/,""),(n[2]||-1!==n[3].indexOf("\n"))&&(n=n[3].match(/[ \t]+$/))&&(e.whitespace_before=n[0])}i=i&&(_?((n=function(){this.eol="\n"}).prototype=this._options.raw_options,_(u+i,new n)):u+(i=(n=e.whitespace_before)?i.replace(new RegExp("\n("+n+")?","g"),"\n"):i).replace(/\n/g,"\n"+u)),s&&(i=i?s+i+"\n"+a:s+a),t.print_newline(!1),i&&(e.text=i,e.whitespace_before="",e.newlines=0,t.add_raw_token(e),t.print_newline(!0))}},c.prototype._handle_tag_open=function(t,e,n,i){var _=this._get_tag_open_token(e);return!n.is_unformatted&&!n.is_content_unformatted||n.is_empty_element||e.type!==h.TAG_OPEN||0!==e.text.indexOf("]*)/),this.tag_check=n?n[1]:""):(n=e.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=n?n[1]:"",(e.text.startsWith("{{#>")||e.text.startsWith("{{~#>"))&&">"===this.tag_check[0]&&(">"===this.tag_check&&null!==e.next?this.tag_check=e.next.text.split(" ")[0]:this.tag_check=e.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),e.type===h.COMMENT&&(this.tag_complete=!0),this.is_start_tag="/"!==this.tag_check.charAt(0),this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||e.closed&&"/>"===e.closed.text,t=2,"{"===this.tag_start_char&&3<=this.text.length&&"~"===this.text.charAt(2)&&(t=3),this.is_end_tag=this.is_end_tag||"{"===this.tag_start_char&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(t)))):this.tag_complete=!0},c.prototype._get_tag_open_token=function(t){t=new o(this._tag_stack.get_parser_token(),t);return t.alignment_size=this._options.wrap_attributes_indent_size,t.is_end_tag=t.is_end_tag||a(t.tag_check,this._options.void_elements),t.is_empty_element=t.tag_complete||t.is_start_tag&&t.is_end_tag,t.is_unformatted=!t.tag_complete&&a(t.tag_check,this._options.unformatted),t.is_content_unformatted=!t.is_empty_element&&a(t.tag_check,this._options.content_unformatted),t.is_inline_element=a(t.tag_name,this._options.inline)||t.tag_name.includes("-")||"{"===t.tag_start_char,t},c.prototype._set_tag_position=function(t,e,n,i,_){n.is_empty_element||(n.is_end_tag?n.start_tag_token=this._tag_stack.try_pop(n.tag_name):(this._do_optional_end_element(n)&&(n.is_inline_element||t.print_newline(!1)),this._tag_stack.record_tag(n),"script"!==n.tag_name&&"style"!==n.tag_name||n.is_unformatted||n.is_content_unformatted||(n.custom_beautifier_name=s(n.tag_check,e)))),a(n.tag_check,this._options.extra_liners)&&(t.print_newline(!1),t._output.just_added_blankline()||t.print_newline(!0)),n.is_empty_element?("{"===n.tag_start_char&&"else"===n.tag_check&&(this._tag_stack.indent_to_tag(["if","unless","each"]),n.indent_content=!0,t.current_line_has_match(/{{#if/)||t.print_newline(!1)),"!--"===n.tag_name&&_.type===h.TAG_CLOSE&&i.is_end_tag&&-1===n.text.indexOf("\n")||(n.is_inline_element||n.is_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,n))):n.is_end_tag?(e=!1,e=(e=n.start_tag_token&&n.start_tag_token.multiline_content)||!n.is_inline_element&&!(i.is_inline_element||i.is_unformatted)&&!(_.type===h.TAG_CLOSE&&n.start_tag_token===i)&&"TK_CONTENT"!==_.type,(e=n.is_content_unformatted||n.is_unformatted?!1:e)&&t.print_newline(!1)):(n.indent_content=!n.custom_beautifier_name,"<"===n.tag_start_char&&( "html"===n.tag_name?n.indent_content=this._options.indent_inner_html:"head"===n.tag_name?n.indent_content=this._options.indent_head_inner_html:"body"===n.tag_name&&(n.indent_content=this._options.indent_body_inner_html)),n.is_inline_element||n.is_unformatted||"TK_CONTENT"===_.type&&!n.is_content_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,n))},c.prototype._calcluate_parent_multiline=function(t,e){!e.parent||!t._output.just_added_newline()||(e.is_inline_element||e.is_unformatted)&&e.parent.is_inline_element||(e.parent.multiline_content=!0)},i=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],u=["a","audio","del","ins","map","noscript","video"],c.prototype._do_optional_end_element=function(t){var e,n=null;if(!t.is_empty_element&&t.is_start_tag&&t.parent)return"body"===t.tag_name?n=n||this._tag_stack.try_pop("head"):"li"===t.tag_name?n=n||this._tag_stack.try_pop("li",["ol","ul"]):"dd"===t.tag_name||"dt"===t.tag_name?n=(n=n||this._tag_stack.try_pop("dt",["dl"]))||this._tag_stack.try_pop("dd",["dl"]):"p"===t.parent.tag_name&&-1!==i.indexOf(t.tag_name)?(e=t.parent.parent)&&-1!==u.indexOf(e.tag_name)||(n=n||this._tag_stack.try_pop("p")):"rp"===t.tag_name||"rt"===t.tag_name?n=(n=n||this._tag_stack.try_pop("rt",["ruby","rtc"]))||this._tag_stack.try_pop("rp",["ruby","rtc"]):"optgroup"===t.tag_name?n=n||this._tag_stack.try_pop("optgroup",["select"]):"option"===t.tag_name?n=n||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):"colgroup"===t.tag_name?n=n||this._tag_stack.try_pop("caption",["table"]):"thead"===t.tag_name?n=(n=n||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]):"tbody"===t.tag_name||"tfoot"===t.tag_name?n=(n=(n=(n=n||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("thead",["table"]))||this._tag_stack.try_pop("tbody",["table"]):"tr"===t.tag_name?n=(n=(n=n||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"]):"th"!==t.tag_name&&"td"!==t.tag_name||(n=(n=n||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]))||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"])),t.parent=this._tag_stack.get_parser_token(),n},e.exports.Beautifier=c},function(t,e,n){var i=n(6).Options;function _(t){i.call(this,t,"html"),1===this.templating.length&&"auto"===this.templating[0]&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}_.prototype=new i,t.exports.Options=_},function(t,o,e){var n=e(9).Tokenizer,i=e(9).TOKEN,_=e(13).Directives,s=e(14).TemplatablePattern,a=e(12).Pattern,u={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:i.START,RAW:i.RAW,EOF:i.EOF},r=new _(/<\!--/,/-->/),e=function(t,e){n.call(this,t,e),this._current_tag_name="",t=new s(this._input).read_options(this._options),e=new a(this._input),this.__patterns={word:t.until(/[\n\r\t <]/),single_quote:t.until_after(/'/),double_quote:t.until_after(/"/),attribute:t.until(/[\n\r\t =>]|\/>/),element_name:t.until(/[\n\r\t >\/]/),handlebars_comment:e.starting_with(/{{!--/).until_after(/--}}/),handlebars:e.starting_with(/{{/).until_after(/}}/),handlebars_open:e.until(/[\n\r\t }]/),handlebars_raw_close:e.until(/}}/),comment:e.starting_with(//),cdata:e.starting_with(//),conditional_comment:e.starting_with(//),processing:e.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter&&(t=this._input.get_literal_regexp(this._options.unformatted_content_delimiter),this.__patterns.unformatted_content_delimiter=e.matching(t).until_after(t))};(e.prototype=new n)._is_comment=function(t){return!1},e.prototype._is_opening=function(t){return t.type===u.TAG_OPEN},e.prototype._is_closing=function(t,e){return t.type===u.TAG_CLOSE&&e&&((">"===t.text||"/>"===t.text )&&"<"===e.text[0]||"}}"===t.text&&"{"===e.text[0]&&"{"===e.text[1])},e.prototype._reset=function(){this._current_tag_name=""},e.prototype._get_next_token=function(t,e){var n;return this._readWhitespace(),null===(n=this._input.peek())?this._create_token(u.EOF,""):this._read_open_handlebars(n,e)||this._read_attribute(n,t,e)||this._read_close(n,e)||this._read_raw_content(n,t,e)||this._read_content_word(n)||this._read_comment_or_cdata(n)||this._read_processing(n)||this._read_open(n,e)||this._create_token(u.UNKNOWN,this._input.next())},e.prototype._read_comment_or_cdata=function(t){var e=null,n=null,i=null;return"<"===t&&("!"===this._input.peek(1)&&((n=this.__patterns.comment.read())?(i=r.get_directives(n))&&"start"===i.ignore&&(n+=r.readIgnored(this._input)):n=this.__patterns.cdata.read()),n&&((e=this._create_token(u.COMMENT,n)).directives=i)),e},e.prototype._read_processing=function(t){var e=null,n=null;return"<"===t&&(n="!"!==(t=this._input.peek(1))&&"?"!==t?n:(n=this.__patterns.conditional_comment.read())||this.__patterns.processing.read())&&((e=this._create_token(u.COMMENT,n)).directives=null),e},e.prototype._read_open=function(t,e){var n=null,i=null;return e||"<"===t&&(n=this._input.next(),"/"===this._input.peek()&&(n+=this._input.next()),n+=this.__patterns.element_name.read(),i=this._create_token(u.TAG_OPEN,n)),i},e.prototype._read_open_handlebars=function(t,e){var n=null,i=null;return e||this._options.indent_handlebars&&"{"===t&&"{"===this._input.peek(1)&&(i="!"===this._input.peek(2)?(n=(n=this.__patterns.handlebars_comment.read())||this.__patterns.handlebars.read(),this._create_token(u.COMMENT,n)):(n=this.__patterns.handlebars_open.read(),this._create_token(u.TAG_OPEN,n))),i},e.prototype._read_close=function(t,e){var n=null,i=null;return e&&("<"===e.text[0]&&(">"===t||"/"===t&&">"===this._input.peek(1))?(n=this._input.next(),"/"===t&&(n+=this._input.next()),i=this._create_token(u.TAG_CLOSE,n)):"{"===e.text[0]&&"}"===t&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),i=this._create_token(u.TAG_CLOSE,"}}"))),i},e.prototype._read_attribute=function(t,e,n){var i=null;return n&&"<"===n.text[0]&&("="===t?i=this._create_token(u.EQUALS,this._input.next()):'"'===t||"'"===t?(n=this._input.next(),n+=('"'===t?this.__patterns.double_quote:this.__patterns.single_quote).read(),i=this._create_token(u.VALUE,n)):(t=this.__patterns.attribute.read())&&(i=e.type===u.EQUALS?this._create_token(u.VALUE,t):this._create_token(u.ATTRIBUTE,t))),i},e.prototype._is_content_unformatted=function(t){return-1===this._options.void_elements.indexOf(t)&&(-1!==this._options.content_unformatted.indexOf(t)||-1!==this._options.unformatted.indexOf(t))},e.prototype._read_raw_content=function(t,e,n){var i="";if(n&&"{"===n.text[0])i=this.__patterns.handlebars_raw_close.read();else if(e.type===u.TAG_CLOSE&&"<"===e.opened.text[0]&&"/"!==e.text[0])if("script"===(n=e.opened.text.substr(1).toLowerCase())||"style"===n){if(e=this._read_comment_or_cdata(t))return e.type=u.TEXT,e;i=this._input.readUntil(new RegExp("","ig"))}else this._is_content_unformatted(n)&&(i=this._input.readUntil(new RegExp("","ig")));return i?this._create_token(u.TEXT,i):null},e.prototype._read_content_word=function(t){var e="";if(e=(e=this._options.unformatted_content_delimiter&&t===this._options.unformatted_content_delimiter[0]?this.__patterns.unformatted_content_delimiter.read():e)||this.__patterns.word.read())return this._create_token(u.TEXT,e)},t.exports.Tokenizer=e,t.exports.TOKEN=u}],i={};t=function _(t){var e=i[t];return e!==undefined||(e=i[t]={exports:{}},n[t](e,e.exports,_)),e.exports}(18),u=t}(),n=u,void 0!==r?(_=i=r).html_beautify=function(t,e){return n(t,e,i.js_beautify,_.css_beautify)}:"undefined"!=typeof window?window.html_beautify=function(t,e){return n(t,e,window.js_beautify,window.css_beautify)}:"undefined"!=typeof global&&(global.html_beautify=function(t,e){return n(t,e,global.js_beautify,global.css_beautify)})},"@VERSION@"); \ No newline at end of file diff --git a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify.js b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify.js index 8c0e70977d2..6ebc08992d7 100644 --- a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify.js +++ b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-beautify/moodle-atto_html-beautify.js @@ -8119,7 +8119,7 @@ Beautifier.prototype._get_tag_open_token = function(raw_token) { //function to g parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted); parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted); - parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === '{'; + parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{'; return parser_token; }; diff --git a/lib/editor/atto/plugins/html/yui/src/beautify/js/beautify-html.js b/lib/editor/atto/plugins/html/yui/src/beautify/js/beautify-html.js index e5e029a4e7c..ff60dace527 100644 --- a/lib/editor/atto/plugins/html/yui/src/beautify/js/beautify-html.js +++ b/lib/editor/atto/plugins/html/yui/src/beautify/js/beautify-html.js @@ -2406,7 +2406,7 @@ Beautifier.prototype._get_tag_open_token = function(raw_token) { //function to g parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted); parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted); - parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === '{'; + parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{'; return parser_token; };