Closed not-my-profile closed 1 year ago
Thanks so much for tackling these! Would you mind moving 713ef32642db1386dcd7cdce551020d3338653ae to a separate PR? I'd like to discuss those changes separately. And maybe also split out the moving of the CSS and JS code to separate files, so that this PR's global diff is more readable.
I can do both if you'd prefer.
Also, 5c1055b7b814215e3b2329152fdca8d0d593ddfe is already included in #1. Let me merge that one first since these changes are more substantial (though fortunately they don't overlap much).
I am not gonna open several PRs for this ... GitHub does let you view the diffs of the individual commits ...
And I think the changes in 713ef32642db1386dcd7cdce551020d3338653ae can also be discussed post merge ... but I don't mind it if you want to split up this PR ... I just don't see the point.
No worries, it's just my OCD :sweat_smile: Also, GitHub's per-commit view is a little cumbersome to use. I'll split the PR.
Update: I've split the other changes into #9 and #10, and rebased this PR (dropping 5c1055b7b in favor of the changes in #1). Sorry for the inconvenience :)
I still would like to split this further, but I'm out of time for the moment, and will pick this up later.
(Adding the expanded commit message with the explanation here, for convenience)
The previous approach of interpolating the contents of the textarea directly into the JavaScript template literal containing Python code didn't work because:
from docutils.core import publish_string
publish_string("""foo
bar""", writer_name='html5').decode("utf-8")
...so Python would complain about invalid syntax.
Passing the string via a variable (rather than injecting it directly into the Python code) avoids this issue because the Python code doesn't change shape depending on the input text.
In any case, it's unadvisable to directly interpolate user input into code, because it can lead to code injection, so the new approach is also safer.
WDYT of the PR as it stands, @not-my-profile?
Fixes #4,
fixes #7(moved to #12),fixes #8(moved to #10)and other stuff(moved to #9 and #13).