Update app.py
Browse files
app.py
CHANGED
@@ -13,10 +13,12 @@ templates = Jinja2Templates(directory="templates")
|
|
13 |
@app.get("/",response_class=HTMLResponse)
|
14 |
def test(request: Request,q:str="ls",body:bool=True):
|
15 |
with open("./v.tex","w") as k:
|
16 |
-
k.write(format(q))
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
{
|
20 |
"request":request,
|
21 |
-
"result":
|
22 |
-
})
|
|
|
13 |
@app.get("/",response_class=HTMLResponse)
|
14 |
def test(request: Request,q:str="ls",body:bool=True):
|
15 |
with open("./v.tex","w") as k:
|
16 |
+
k.write(format(q) if body else q)
|
17 |
+
r=run("pdflatex v.tex".split(" "),capture_output=True).stderr
|
18 |
+
if r.stderr:
|
19 |
+
return r.stderr
|
20 |
+
else:
|
21 |
+
return templates.TemplateResponse("latex.html",
|
22 |
{
|
23 |
"request":request,
|
24 |
+
"result":r.stdout})
|
|