Skip to content
Snippets Groups Projects
Commit 968832f4 authored by Jenny Zhang's avatar Jenny Zhang
Browse files

recover generateProofTreeHTML function in sequentAst.js for possible future functionality

parent e16bd46f
No related branches found
No related tags found
No related merge requests found
...@@ -173,7 +173,6 @@ export default { ...@@ -173,7 +173,6 @@ export default {
handleSubmitAnswer(input) { handleSubmitAnswer(input) {
const topsStrings = input.standardAnswer; const topsStrings = input.standardAnswer;
const rule = this.ruleToLatex(input.rule); const rule = this.ruleToLatex(input.rule);
......
...@@ -37,6 +37,34 @@ function generateNodeHTML(node) { ...@@ -37,6 +37,34 @@ function generateNodeHTML(node) {
} }
// top is empty list
function generateProofTreeHTML(node) {
if (!node) return '';
// Generate a unique id
const uniqueId = `tops-${nodeIdCounter++}`;
// Generate HTML for the current node
let html = `<div class="node" original-input-string="${node.bottomString}">`;
html += `<div class="topsLatex" id="${uniqueId}">`;
// If the node has a rule, display the rule, the bar and the children nodes
if (node.rule) {
// Recursively process prerequisite nodes
node.topsLatex.forEach(childNode => {
html += generateProofTreeHTML(childNode);
});
html += `<div class="bar"><div class="rule">\\(${node.rule}\\)</div></div>`;
}
html += '</div>';
html += `<div class="bottomLatex"><span class="math">\\(${node.bottomLatex}\\)</span></div>`;
}
...@@ -70,5 +98,6 @@ module.exports = { ...@@ -70,5 +98,6 @@ module.exports = {
isSequentNode, isSequentNode,
linkSequentNode, linkSequentNode,
generateNodeHTML, generateNodeHTML,
generateProofTreeHTML,
addRule, addRule,
}; };
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment