back to table · edit · history · where entries came from · files · download
1447 bytes, as of the version from 2026-11-18 20:44 (current). Recorded here, not run.
"""Assemble server-returned sections within the complete live preview shell."""
import os,copy
from pathlib import Path
from bs4 import BeautifulSoup
w=Path(os.environ['TMPDIR']);r=w/'render'
template=BeautifulSoup((r/'Tags.html').read_bytes(),'html.parser')
for h in list(template.select('.table-section-title')):
container=h.find_next_sibling()
if container and 'table-section-container' in container.get('class',[]):container.decompose()
h.decompose()
for n in list(template.select('.table-number-section-outer-container')):n.decompose()
fragments=[]
for offset in range(0,84,12):
soup=BeautifulSoup((r/('Numbers-'+str(offset)+'.html')).read_bytes(),'html.parser')
c=soup.select_one('.table-number-section-outer-container')
if offset:c.select_one('.table-section-title').decompose()
fragments.append(str(c))
for field in ['Definition','Parameters','Comments','Formulas','Programs','References','Links','Similar tables','Data properties']:
soup=BeautifulSoup((r/(field.replace(' ','-')+'.html')).read_bytes(),'html.parser')
h=next(x for x in soup.select('.table-section-title') if x.get_text(' ',strip=True)==field)
fragments.append(str(h)+str(h.find_next_sibling()))
anchor=template.select_one('#table-title')
for f in reversed(fragments):anchor.insert_after(BeautifulSoup(f,'html.parser'))
base=template.new_tag('base',href='https://numberdb.org/');template.head.insert(0,base)
(w/'rendered-complete.html').write_text(str(template))