code-yeongyu/oh-my-openagent / packages/shared-skills/skills/ulw-research
ulw-research
UnverifiedRuns maximum-saturation research with a cooperating team, claim-graph gating, and a cited, QA'd deliverable. Use when the user explicitly asks for research or a deep investigation, including any 'ulw' research wording.
scripts/entities.mjs
View on GitHub// entities.mjs - HTML character reference decoding for html-lite.mjs.
//
// Supports a fixed set of named entities (NAMED_ENTITIES) plus decimal and hex numeric references.
// Unknown or malformed references stay verbatim. Single indexOf scan; plain Node ESM, no dependencies.
// Beyond the common set, every named reference whose character a number reader treats specially is
// listed (signs, dashes, the space separators that group digits, and Markdown punctuation), so the
// conversion probe reads `−5` and `1 234` as a converter does.
const NAMED_ENTITIES = {
amp: "&",
lt: "<",
gt: ">",
quot: '"',
apos: "'",
nbsp: "\u00a0",
mdash: "\u2014",
ndash: "\u2013",
hellip: "\u2026",
copy: "\u00a9",
reg: "\u00ae",
times: "\u00d7",
middot: "\u00b7",
minus: "\u2212",
hyphen: "\u2010",
dash: "\u2010",
NonBreakingSpace: "\u00a0",
thinsp: "\u2009",
ThinSpace: "\u2009",
numsp: "\u2007",
puncsp: "\u2008",
hairsp: "\u200a",
VeryThinSpace: "\u200a",
ensp: "\u2002",
emsp: "\u2003",
emsp13: "\u2004",
emsp14: "\u2005",
MediumSpace: "\u205f",
comma: ",",
period: ".",
plus: "+",
lowbar: "_",
UnderBar: "_",
ast: "*",
midast: "*",
grave: "`",
DiacriticalGrave: "`",
lpar: "(",
rpar: ")",
lsqb: "[",
lbrack: "[",
rsqb: "]",
rbrack: "]",
}
/** One reference body (between `&` and `;`), or null when unsupported. */
export function decodeOne(body) {
if (Object.hasOwn(NAMED_ENTITIES, body)) return NAMED_ENTITIES[body]
if (body[0] !== "#") return null
const hex = body[1] === "x" || body[1] === "X"
const digits = body.slice(hex ? 2 : 1)
if (!(hex ? /^[0-9a-fA-F]{1,6}$/ : /^[0-9]{1,7}$/).test(digits)) return null
const cp = Number.parseInt(digits, hex ? 16 : 10)
return cp > 0 && cp <= 0x10ffff && (cp < 0xd800 || cp > 0xdfff) ? String.fromCodePoint(cp) : "\ufffd"
}
/** Decode the supported named entities plus decimal/hex numeric references; unknown ones stay verbatim. */
export function decodeEntities(text) {
const source = String(text)
let out = ""
let last = 0
let at = source.indexOf("&")
while (at !== -1) {
const semi = source.indexOf(";", at + 1)
const decoded = semi !== -1 && semi - at <= 32 ? decodeOne(source.slice(at + 1, semi)) : null
if (decoded !== null) {
out += source.slice(last, at) + decoded
last = semi + 1
at = source.indexOf("&", last)
} else {
at = source.indexOf("&", at + 1)
}
}
return out + source.slice(last)
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |