Compare commits
No commits in common. "0395c7c353480ea2c2626b99d4d7b4857414a986" and "1584174229f0cfa2796d2c95f7e2c3573d8ed5f2" have entirely different histories.
0395c7c353
...
1584174229
3 changed files with 10 additions and 24 deletions
4
html.ts
4
html.ts
|
@ -1,7 +1,5 @@
|
||||||
// Inspirado en https://gitea.nulo.in/Nulo/html.lua/src/commit/cb7e35dcca0e45b397baf628f5e1a162a2269638/html.lua
|
// Inspirado en https://gitea.nulo.in/Nulo/html.lua/src/commit/cb7e35dcca0e45b397baf628f5e1a162a2269638/html.lua
|
||||||
|
|
||||||
import { escape } from "html-escaper";
|
|
||||||
|
|
||||||
export interface VirtualElement {
|
export interface VirtualElement {
|
||||||
__element_type: string;
|
__element_type: string;
|
||||||
things: Thing[];
|
things: Thing[];
|
||||||
|
@ -53,7 +51,7 @@ export const section = basicElement("section");
|
||||||
export const time = basicElement("time");
|
export const time = basicElement("time");
|
||||||
|
|
||||||
// TODO: actually escape
|
// TODO: actually escape
|
||||||
const escapeHTML = (string: string) => escape(string);
|
const escapeHTML = (string: string) => string;
|
||||||
export const render = (...elements: Renderable[]): string => {
|
export const render = (...elements: Renderable[]): string => {
|
||||||
if (elements.length > 1) return elements.map((e) => render(e)).join("");
|
if (elements.length > 1) return elements.map((e) => render(e)).join("");
|
||||||
if (typeof elements[0] == "string") return escapeHTML(elements[0]);
|
if (typeof elements[0] == "string") return escapeHTML(elements[0]);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@nulo/html.js",
|
"name": "@nulo/html.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.9",
|
"version": "0.0.8",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/html.js",
|
"main": "dist/html.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -15,8 +15,5 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.11.17",
|
"@types/node": "^18.11.17",
|
||||||
"typescript": "^4.9.4"
|
"typescript": "^4.9.4"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"html-escaper": "^3.0.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,20 @@
|
||||||
lockfileVersion: '6.0'
|
lockfileVersion: 5.4
|
||||||
|
|
||||||
dependencies:
|
specifiers:
|
||||||
html-escaper:
|
'@types/node': ^18.11.17
|
||||||
specifier: ^3.0.3
|
typescript: ^4.9.4
|
||||||
version: 3.0.3
|
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/node':
|
'@types/node': 18.11.17
|
||||||
specifier: ^18.11.17
|
typescript: 4.9.4
|
||||||
version: 18.11.17
|
|
||||||
typescript:
|
|
||||||
specifier: ^4.9.4
|
|
||||||
version: 4.9.4
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
/@types/node@18.11.17:
|
/@types/node/18.11.17:
|
||||||
resolution: {integrity: sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==}
|
resolution: {integrity: sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/html-escaper@3.0.3:
|
/typescript/4.9.4:
|
||||||
resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/typescript@4.9.4:
|
|
||||||
resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==}
|
resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==}
|
||||||
engines: {node: '>=4.2.0'}
|
engines: {node: '>=4.2.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
Loading…
Reference in a new issue