10000 Adding `textwrap.dedent` for allowing indented html blocks (#275) · fourmia/pyscript@ff3b994 · GitHub
[go: up one dir, main page]

Skip to content

Commit ff3b994

Browse files
Adding textwrap.dedent for allowing indented html blocks (pyscript#275)
* Adding textwrap.dedent for indented html blocks - write indented html string - but dedent it while generating html - textwrap.dedent is meant for this purpose * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed indentation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed indentation Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 92fce06 commit ff3b994

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pyscriptjs/src/pyscript.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io
44
import sys
55
import time
6+
from textwrap import dedent
67

78
import micropip # noqa: F401
89
from js import console, document
@@ -257,12 +258,14 @@ def create(self):
257258
console.log("creating values")
258259

259260
console.log("creating innerHtml")
260-
new_child._element.innerHTML = f"""
261-
<label for="flex items-center p-2 ">
262-
<input class="mr-2" type="checkbox" class="task-check">
263-
<p class="m-0 inline">{self.render_content()}</p>
264-
</label>
265-
"""
261+
new_child._element.innerHTML = dedent(
262+
f"""
263+
<label for="flex items-center p-2 ">
264+
<input class="mr-2" type="checkbox" class="task-check">
265+
<p class="m-0 inline">{self.render_content()}</p>
266+
</label>
267+
"""
268+
)
266269

267270
console.log("returning")
268271
return new_child

0 commit comments

Comments
 (0)
0