oh wait if cohost allows arbitrary html does that mean i can actually use my terminal emulator's "Copy as HTML" feature?
1196 │ fn build_closure(&mut self, code: &CodeObject) -> bool {
1197 │ if code.freevars.is_empty() {
1198 │ return false;
1199 │ }
1200 │ for var in &*code.freevars {
1201 │ let table = self.symbol_table_stack.last().unwrap();
1202 │ let symbol = table.lookup(var).unwrap_or_else(|| {
1203 │ panic!(
1204 │ "couldn't look up var {} in {} in {}",
1205 │ var, code.obj_name, self.source_path
1206 │ )
1207 │ });
1208 │ let parent_code = self.code_stack.last().unwrap();
1209 │ let vars = match symbol.scope {
1210 │ SymbolScope::Free => &parent_code.freevar_cache,
1211 │ SymbolScope::Cell => &parent_code.cellvar_cache,
1212 │ _ if symbol.is_free_class => &parent_code.freevar_cache,
1213 │ x => unreachable!(
1214 │ "var {} in a {:?} should be free or cell but it's {:?}",
1215 │ var, table.typ, x
1216 │ ),
1217 │ };
1218 │ let mut idx = vars.get_index_of(var).unwrap();
1219 │ if let SymbolScope::Free = symbol.scope {
1220 │ idx += parent_code.cellvar_cache.len();
1221 │ }
1222 │ self.emit(Instruction::LoadClosure(idx as u32))
1223 │ }
1224 │ self.emit(Instruction::BuildTuple {
1225 │ size: code.freevars.len() as u32,
1226 │ unpack: false,
1227 │ });
1228 │ true
1229 │ }
awww.
For reference, that was a bunch of <font color="#abcdef"> tags inside a <pre> tag, but cohost stripped them just leaving the text. that should be allowed I feel.... but I can do some processing to it to turn them into <span style=""> probably
yes.... YES...
rustpython on main [$] is 📦 v0.1.2 via 🐍 v3.10.8 via 🦀 v1.65.0 ❯ clippaste | sd '<font color="' '<span style="color:' | sd '</font' '</span' | clipcopy rustpython on main [$] is 📦 v0.1.2 via 🐍 v3.10.8 via 🦀 v1.65.0 ❯
was gonna do something with actual html dom manipulation but that's too haurd... and this should work on well-formed html anyway so