示例#1
0
文件: report.go 项目: zerobias/gosyn
func rebuildTree(node models.TreeLink, newTree models.PTreeNode) {
	switch node.Type {
	case models.TREE_NODE:
		treeRebuilding(node.AsNode(), newTree)
	case models.TREE_VALUE:
		(*newTree).AddChild(node)
	default:
		fmt.Println("[rebuildTree] UNEXCEPTION TreeElementType! ID ", node.ID)
	}
}
示例#2
0
文件: report.go 项目: zerobias/gosyn
func makeList(tree models.PTreeNode, isFirst bool) (result string) {
	var e *models.TreeLink
	for _, e = range tree.ChildList {
		var resLi string
		if e.Type == models.TREE_VALUE {
			resLi = EscapedLink((*(e.AsValue().Value.Value)).String())
		} else {
			node := e.AsNode()
			resLi = string(node.Type()) + " " + strings.TrimSpace(node.Value)
			if len(strings.TrimSpace(resLi)) == 0 {
				resLi = "EMPTY"
			}
			resLi = EscapedLink(resLi)
			resLi += makeList(node, false)
		}
		result += TAG_ELEM.Wrap(resLi)
	}
	if isFirst {
		result = TAG_LIST.AddAttr(ATTR_CLASS, "tree").Wrap(result)
	} else {
		result = TAG_LIST.Wrap(result)
	}
	return
}