-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
#82 and #258 demonstrate that users are having an issue with Python's requirement that line one of a Python code block must start in column 0 or an IndentationError
will be raised.
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<py-script>
print("Hello IndentationError?!?")
</py-script>
</body>
</html>
What would be the best (automatic) method to avoid forcing left-justification of all multiline Python code?
Could pyscript automagically left justify the Python code or would it be possible to monkey-patch IndentationError
to deal with code starting at the existing indentation of the first line of Python or at least a pre-commit job to left-justify blocks of Python code. Kinda like https://docs.python.org/3/library/textwrap.html
GitHub Actions does this in YAML files: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-running-a-python-script