mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
refactor: rename _to_text to _escape_text
This commit is contained in:
parent
3de60b9c82
commit
66ccfd8e8f
5
.changeset/dirty-cloths-rest.md
Normal file
5
.changeset/dirty-cloths-rest.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@marko/runtime-tags": patch
|
||||
---
|
||||
|
||||
Rename \_to_text helper to \_escape_text on the server.
|
||||
@ -2,7 +2,7 @@ import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/template.marko", input => {
|
||||
const $scope0_id = _._scope_id();
|
||||
let count = 0;
|
||||
_._html(`<div><button>${_._escape(count)}${_._el_resume($scope0_id, "#text/1")}</button>${_._el_resume($scope0_id, "#button/0")}<!--${_._to_text(count)} + ${_._to_text(count)} = ${_._to_text(count + count)}-->${_._el_resume($scope0_id, "#comment/2")}</div>`);
|
||||
_._html(`<div><button>${_._escape(count)}${_._el_resume($scope0_id, "#text/1")}</button>${_._el_resume($scope0_id, "#button/0")}<!--${_._escape_text(count)} + ${_._escape_text(count)} = ${_._escape_text(count + count)}-->${_._el_resume($scope0_id, "#comment/2")}</div>`);
|
||||
_._script($scope0_id, "__tests__/template.marko_0_count");
|
||||
_._scope($scope0_id, {
|
||||
count
|
||||
|
||||
@ -2,7 +2,7 @@ import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/template.marko", input => {
|
||||
const $scope0_id = _._scope_id();
|
||||
let value = "before";
|
||||
_._html(`<textarea>${_._to_text(value)}</textarea>${_._el_resume($scope0_id, "#textarea/0")}<button>update</button>${_._el_resume($scope0_id, "#button/1")}`);
|
||||
_._html(`<textarea>${_._escape_text(value)}</textarea>${_._el_resume($scope0_id, "#textarea/0")}<button>update</button>${_._el_resume($scope0_id, "#button/1")}`);
|
||||
_._script($scope0_id, "__tests__/template.marko_0");
|
||||
_._scope($scope0_id, {}, "__tests__/template.marko", 0);
|
||||
_._resume_branch($scope0_id);
|
||||
|
||||
@ -2,7 +2,7 @@ import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/template.marko", input => {
|
||||
const $scope0_id = _._scope_id();
|
||||
let count = 0;
|
||||
_._html(`<title>Count is ${_._to_text(count)}</title>${_._el_resume($scope0_id, "#title/0")}<button>+</button>${_._el_resume($scope0_id, "#button/1")}<div></div>${_._el_resume($scope0_id, "#div/2")}`);
|
||||
_._html(`<title>Count is ${_._escape_text(count)}</title>${_._el_resume($scope0_id, "#title/0")}<button>+</button>${_._el_resume($scope0_id, "#button/1")}<div></div>${_._el_resume($scope0_id, "#div/2")}`);
|
||||
_._script($scope0_id, "__tests__/template.marko_0_count");
|
||||
_._scope($scope0_id, {
|
||||
count
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import * as _ from "@marko/runtime-tags/debug/html";
|
||||
export default _._template("__tests__/template.marko", input => {
|
||||
const $scope0_id = _._scope_id();
|
||||
_._html(`<textarea>${_._to_text("hello")}</textarea>`);
|
||||
_._html(`<textarea>${_._escape_text("hello")}</textarea>`);
|
||||
});
|
||||
@ -27,7 +27,7 @@ export {
|
||||
_escape,
|
||||
_escape_script,
|
||||
_escape_style,
|
||||
_to_text,
|
||||
_escape_text,
|
||||
_unescaped,
|
||||
} from "./html/content";
|
||||
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
styleValue,
|
||||
} from "../common/helpers";
|
||||
import { type Accessor, AccessorPrefix, ControlledType } from "../common/types";
|
||||
import { _to_text } from "./content";
|
||||
import { _escape_text } from "./content";
|
||||
import {
|
||||
_attr_content,
|
||||
_html,
|
||||
@ -78,7 +78,7 @@ export function _attr_textarea_value(
|
||||
);
|
||||
}
|
||||
|
||||
return _to_text(value);
|
||||
return _escape_text(value);
|
||||
}
|
||||
|
||||
export function _attr_input_value(
|
||||
|
||||
@ -10,7 +10,7 @@ export function _escape(val: unknown) {
|
||||
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
||||
}
|
||||
|
||||
export function _to_text(val: unknown) {
|
||||
export function _escape_text(val: unknown) {
|
||||
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ export default {
|
||||
if (t.isMarkoText(child)) {
|
||||
write`${child.value}`;
|
||||
} else if (t.isMarkoPlaceholder(child)) {
|
||||
write`${callRuntime("_to_text", child.value)}`;
|
||||
write`${callRuntime("_escape_text", child.value)}`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -314,7 +314,7 @@ export default {
|
||||
valueChange,
|
||||
);
|
||||
} else if (value) {
|
||||
writeAtStartOfBody = callRuntime("_to_text", value);
|
||||
writeAtStartOfBody = callRuntime("_escape_text", value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ export default {
|
||||
if (t.isMarkoText(child)) {
|
||||
write`${child.value}`;
|
||||
} else if (t.isMarkoPlaceholder(child)) {
|
||||
write`${callRuntime("_to_text", child.value)}`;
|
||||
write`${callRuntime("_escape_text", child.value)}`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user