updated demo

This commit is contained in:
Christopher Pickering 2022-12-16 08:52:36 -06:00
parent 68c155a7cf
commit b34b07f098
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
3 changed files with 14 additions and 5 deletions

View file

@ -10,7 +10,9 @@ keywords: online template formatter, djLint, HTML, templates, formatter, linter,
<div class="container is-fluid pb-5"> <div class="container is-fluid pb-5">
<hr class="mt-0" /> <hr class="mt-0" />
<h1 class="title is-3">{{ "demo_description" | i18n | safe }}</h1> <h1 class="title is-3 mb-0">{{ "demo_description" | i18n | safe }}</h1>
<small class="mb-4 is-italic is-block" id="djlint-version"></small>
<div class="block" id="djlint-status"> <div class="block" id="djlint-status">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
@ -20,6 +22,7 @@ keywords: online template formatter, djLint, HTML, templates, formatter, linter,
</span> </span>
</div> </div>
<div class="columns is-hidden"> <div class="columns is-hidden">
<div class="column is-narrow"> <div class="column is-narrow">
<form id="djlint-settings"> <form id="djlint-settings">

View file

@ -89,7 +89,11 @@ if (typeof Worker !== 'undefined') {
} }
if ((type == 'error' || type == 'html') && id == session_id) { if ((type == 'error' || type == 'html') && id == session_id) {
setOutput(message); setOutput(message);
} else { } else if (type == "status") {
console.log(message)
} else if (type == "version") {
document.getElementById('djlint-version').textContent = message;
}else {
console.log(event.data); console.log(event.data);
} }
}; };

View file

@ -41,12 +41,13 @@ async function loadPyodideAndPackages() {
postMessage({ type: 'status', message: 'Installing tqdm..' }); postMessage({ type: 'status', message: 'Installing tqdm..' });
postMessage({ postMessage({
type: 'status', type: 'version',
message: message:
'Running Python ' + 'Running Python ' +
pyodide.runPython(` pyodide.runPython(`
import sys import platform
sys.version from importlib import metadata
f"running with Python {platform.python_version()}; djLint {metadata.version('djlint')}"
`), `),
}); });
@ -103,6 +104,7 @@ self.onmessage = async (event) => {
await self.pyodide.runPythonAsync(` await self.pyodide.runPythonAsync(`
import io import io
import os import os
import sys
sys.modules['_multiprocessing'] = object sys.modules['_multiprocessing'] = object
from multiprocessing.pool import ThreadPool from multiprocessing.pool import ThreadPool
sys.stdout = io.StringIO() sys.stdout = io.StringIO()