python: render <svg> via _repr_html_

Work around a recent decision in Jupyter Lab and Notebook to render
<svg> is inline <img>, breaking tooltips or text selection.

(Rerendering all notebooks was painful.)

* NEWS: Mention the change.
* python/spot/__init__.py: Add a _repr_html_ method to all
classes that had a _repr_svg_.  It seems Jupyter will use
_repr_html_ by default.
* python/spot/jupyter.py: SVG replace the _repr_svg_ method
by a _repr_html.
* tests/python/_altscc.ipynb, tests/python/_autparserr.ipynb,
tests/python/_aux.ipynb, tests/python/_mealy.ipynb,
tests/python/_partitioned_relabel.ipynb,
tests/python/_product_susp.ipynb, tests/python/_product_weak.ipynb,
tests/python/_synthesis.ipynb, tests/python/aliases.ipynb,
tests/python/alternation.ipynb, tests/python/atva16-fig2a.ipynb,
tests/python/atva16-fig2b.ipynb, tests/python/automata-io.ipynb,
tests/python/automata.ipynb, tests/python/cav22-figs.ipynb,
tests/python/contains.ipynb, tests/python/decompose.ipynb,
tests/python/formulas.ipynb, tests/python/games.ipynb,
tests/python/gen.ipynb, tests/python/highlighting.ipynb,
tests/python/ltsmin-dve.ipynb, tests/python/ltsmin-pml.ipynb,
tests/python/parity.ipynb, tests/python/product.ipynb,
tests/python/randaut.ipynb, tests/python/satmin.ipynb,
tests/python/stutter-inv.ipynb, tests/python/synthesis.ipynb,
tests/python/testingaut.ipynb, tests/python/twagraph-internals.ipynb,
tests/python/word.ipynb, tests/python/zlktree.ipynb: Update all
notebooks.
This commit is contained in:
Alexandre Duret-Lutz 2024-02-09 15:06:07 +01:00
parent 4cf7503fff
commit 3034e8fcc3
36 changed files with 43249 additions and 8585 deletions

View file

@ -524,18 +524,18 @@
"outputs": [
{
"data": {
"image/svg+xml": [
"text/html": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"734pt\" height=\"313pt\"\n",
" viewBox=\"0.00 0.00 734.00 313.34\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(0.9174311926605504 0.9174311926605504) rotate(0) translate(4 338.8)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-338.8 799,-338.8 799,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"366\" y=\"-304.6\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<svg width=\"729pt\" height=\"296pt\"\n",
" viewBox=\"0.00 0.00 729.00 295.96\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(0.9090909090909091 0.9090909090909091) rotate(0) translate(4 322)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-322 799,-322 799,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"366\" y=\"-302.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
@ -738,16 +738,16 @@
},
{
"data": {
"image/svg+xml": [
"text/html": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"734pt\" height=\"288pt\"\n",
" viewBox=\"0.00 0.00 734.00 288.36\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(0.9345794392523364 0.9345794392523364) rotate(0) translate(4 304)\">\n",
"<svg width=\"729pt\" height=\"286pt\"\n",
" viewBox=\"0.00 0.00 729.00 286.39\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(0.9259259259259258 0.9259259259259258) rotate(0) translate(4 304)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-304 780,-304 780,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"216.5\" y=\"-285.8\" font-family=\"Lato\" font-size=\"14.00\">(Fin(</text>\n",
"<text text-anchor=\"start\" x=\"243.5\" y=\"-285.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
@ -762,7 +762,7 @@
"<text text-anchor=\"start\" x=\"499.5\" y=\"-285.8\" font-family=\"Lato\" font-size=\"14.00\">) | Inf(</text>\n",
"<text text-anchor=\"start\" x=\"535.5\" y=\"-285.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#e31a1c\">❺</text>\n",
"<text text-anchor=\"start\" x=\"551.5\" y=\"-285.8\" font-family=\"Lato\" font-size=\"14.00\">))</text>\n",
"<text text-anchor=\"start\" x=\"356.5\" y=\"-271.8\" font-family=\"Lato\" font-size=\"14.00\">[Streett 3]</text>\n",
"<text text-anchor=\"start\" x=\"356\" y=\"-271.8\" font-family=\"Lato\" font-size=\"14.00\">[Streett 3]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
@ -986,18 +986,18 @@
},
{
"data": {
"image/svg+xml": [
"text/html": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"734pt\" height=\"174pt\"\n",
" viewBox=\"0.00 0.00 734.00 173.73\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(0.7692307692307692 0.7692307692307692) rotate(0) translate(4 221.8)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-221.8 950,-221.8 950,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"451.5\" y=\"-187.6\" font-family=\"Lato\" font-size=\"14.00\">[Büchi]</text>\n",
"<svg width=\"729pt\" height=\"160pt\"\n",
" viewBox=\"0.00 0.00 729.00 159.71\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(0.7633587786259541 0.7633587786259541) rotate(0) translate(4 205)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-205 950,-205 950,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"451.5\" y=\"-185.8\" font-family=\"Lato\" font-size=\"14.00\">[Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 1 -->\n",
"<g id=\"node2\" class=\"node\">\n",
@ -1239,7 +1239,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@ -1253,7 +1253,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.11.7"
}
},
"nbformat": 4,