From dd991a3d9d13bb11e07ebc9f175bd1786a16e375 Mon Sep 17 00:00:00 2001 From: Mau Magnaguagno Date: Fri, 3 Nov 2023 20:22:37 -0300 Subject: [PATCH] Improve __top __method as root replacement --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index e30ae7d..9b46100 100644 --- a/index.html +++ b/index.html @@ -36,8 +36,8 @@

HTN Plan Viewer

if(!(l = lines[i].trim())) continue; if(m = l.match(/^(\d+)\s+([\w\s()-]+)$/)) // Action data[m[1]] = ["\n " + m[1] + ' [label="' + m[2] + '" shape=box3d]', []]; - else if(m = l.match(/^(\d+)\s+([\w\s()-]+?)\s+->\s+([\w()-]+)\s*([\d\s]*)$/)) // Method - if(m[2] === "__top" && m[3] === "__top_method") order = m[4]; + else if(m = l.match(/^(\d+)\s+([\w\s()-]+?)\s+->\s+([\w-]+)\s*([\d\s]*)$/)) // Method + if(m[1] == order && m[2] === "__top" && m[3] === "__top_method") order = m[4]; else data[m[1]] = ["\n " + m[1] + ' [label="' + m[2] + '" shape=rectangle]; m' + m[1] + ' [label="' + m[3] + '"]; ' + m[1] + " -> m" + m[1] + " -> {" + m[4] + "}", m[4] ? m[4].split(/\s+/) : []]; else if(m = l.match(/^root\s+([\d\s]*)$/)) // Root order = m[1]; @@ -51,7 +51,7 @@

HTN Plan Viewer

dot += data[m][0]; order.unshift(...data[m][1]); } else warnings += "Missing id " + m + "\n"; - } else warnings += "Expected root or __top"; + } else warnings += "Expected root"; graphviz.renderDot(dot += "\n}"); if(warnings) alert(warnings); }