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">
<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">
<span class="icon-text">
<span class="icon">
@ -20,6 +22,7 @@ keywords: online template formatter, djLint, HTML, templates, formatter, linter,
</span>
</div>
<div class="columns is-hidden">
<div class="column is-narrow">
<form id="djlint-settings">

View file

@ -89,7 +89,11 @@ if (typeof Worker !== 'undefined') {
}
if ((type == 'error' || type == 'html') && id == session_id) {
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);
}
};

View file

@ -41,12 +41,13 @@ async function loadPyodideAndPackages() {
postMessage({ type: 'status', message: 'Installing tqdm..' });
postMessage({
type: 'status',
type: 'version',
message:
'Running Python ' +
pyodide.runPython(`
import sys
sys.version
import platform
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(`
import io
import os
import sys
sys.modules['_multiprocessing'] = object
from multiprocessing.pool import ThreadPool
sys.stdout = io.StringIO()