latex stuff on maths

This commit is contained in:
DeaDvey 2024-11-19 17:37:26 +00:00
parent 837387433a
commit a7a8dc6aa6

View File

@ -77,15 +77,24 @@ app.post("/maths/submit-topics", (req,res) => {
console.log("Problem: ", problem) console.log("Problem: ", problem)
console.log("Solution: ", solution) console.log("Solution: ", solution)
res.send(`${topic_str}<br/> res.send(`<!DOCTYPE html>
${subtopic_str}<br/> <h1>${topic_str}</h1><br/>
<h3>${subtopic_str}</h3><br/>
${problem} ${problem}
<form action="/maths/answer" method="post"> <form action="/maths/answer" method="post">
<input type="hidden" name="solution" value="${solution}"> <input type="hidden" name="solution" value="${solution}">
<input type="hidden" name="topic" value="${topic}"> <input type="hidden" name="topic" value="${topic}">
<input type="hidden" name="subtopic" value="${subtopic}"> <input type="hidden" name="subtopic" value="${subtopic}">
<button type="submit">Answer</button> <button type="submit">Answer</button>
</form>`) </form>
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>`)
}); });
app.post("/maths/answer", (req,res) => { app.post("/maths/answer", (req,res) => {
@ -94,13 +103,23 @@ app.post("/maths/answer", (req,res) => {
console.log(req.body.subtopic) console.log(req.body.subtopic)
let topic = Number(req.body.topic) let topic = Number(req.body.topic)
let subtopic = validator.escape(req.body.subtopic) let subtopic = validator.escape(req.body.subtopic)
res.send(`${req.body.solution} res.send(`<!DOCTYPE html>
<h1>Answer:</h1>
${req.body.solution}
<form action="/maths/submit-topics" method="post"> <form action="/maths/submit-topics" method="post">
<input type="hidden" name="topic" value="${topic}"> <input type="hidden" name="topic" value="${topic}">
<input type="hidden" name="subtopic" value="${subtopic}"> <input type="hidden" name="subtopic" value="${subtopic}">
<button type="submit">Next</button> <button type="submit">Next</button>
</form> </form>
<button onclick="window.location.href='https://deadvey.com/maths'">Back</button>`) <button onclick="window.location.href='https://deadvey.com/maths'">Back</button>
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>`)
}); });
app.post("/board/submit-comment", (req,res) => { app.post("/board/submit-comment", (req,res) => {