Skip to content

semantically meaningful display outputs for notebooks¤

html is a data structure for visual information

import jinja2, datetime; from IPython.display import HTML
env = jinja2.Environment(loader=jinja2.DictLoader(templates := {}), extensions=["jinja2.ext.loopcontrols"]);
env.globals.update(dispatch=(dispatch := {}))
env.filters.update(dumps=__import__("json").dumps,**vars(__import__("builtins")))

template type dispatcher¤

for need to generate appropriate semantics for different data structures. we'll use a dispatching dictionary to handle that work. when int or float types are found then the numeric templates is used, str types use the string, list and dict handle sequences and containers.

function class module

a
'thanks for the fish'

vocab typeof property resource prefix

itemid itemprop itemref itemscope itemtype

[int,
 float,
 str,
 tuple,
 list,
 dict,
 set,
 frozenset,
 super,
 re.Pattern,
 type,
 function,
 builtin_function_or_method,
 method,
 types.SimpleNamespace,
 datetime.datetime,
 datetime.timedelta,
 BaseException,
 os._Environ,
 mappingproxy,
 slice,
 range,
 bytes]
<IPython.core.formatters.JavascriptFormatter at 0x7fdec0e53cd0>