Exemplo n.º 1
0
        private void InterpretHelper(InterpretArgs args, Tree node)
        {
            string path = PathDescriptor.GetPath(node, args.Tree);

            JObject data = (JObject)_runtimeIntent.GetData(path);

            if (data != null)
            {
                foreach (var key in data.Properties())
                {
                    bool parsedbool = false;

                    if (bool.TryParse(data[key.Name].Value <string>(), out parsedbool))
                    {
                        args.Tag(node, key.Name, parsedbool);
                    }
                    else
                    {
                        args.Tag(node, key.Name, data[key.Name].Value <string>());
                    }
                }
            }

            foreach (Tree child in node.GetChildren())
            {
                InterpretHelper(args, child);
            }
        }
Exemplo n.º 2
0
        private void InterpretHelper(InterpretArgs args, Tree currNode)
        {
            if (currNode.Height > 3 && currNode["type"] != null && currNode["type"].Equals("content"))
            {
                args.Tag(currNode, "is_text", true);
            }

            foreach (Tree child in currNode.GetChildren())
            {
                InterpretHelper(args, child);
            }
        }
Exemplo n.º 3
0
        private void InterpretHelper(InterpretArgs args, Tree node)
        {
            if (node.ContainsTag("type") && node["type"].Equals("ptype"))
            {
                args.Tag(node, "is_target", "true");
            }
            else if (node.ContainsTag("type") && !node["type"].Equals("ptype"))
            {
                foreach (Tree child in node.GetChildren())
                {
                    if (child.ContainsTag("type") && !child["type"].Equals("feature") && child.GetChildren().Count() == 0)
                    {
                        args.Tag(child, "is_target", "true");
                    }
                }
            }

            foreach (Tree child in node.GetChildren())
            {
                InterpretHelper(args, child);
            }
        }
Exemplo n.º 4
0
        public void InterpretHelper(InterpretArgs args, Tree currNode)
        {
            IEnumerable <Tree> textChildren = currNode.GetChildren().Where(c => c.ContainsTag("is_text") && (bool)c["is_text"]);


            List <Tree> readingOrder = SortNodesInReadingOrder(textChildren);

            for (int i = 0; i < readingOrder.Count - 1; i++)
            {
                Tree curr = readingOrder[i];
                Tree next = readingOrder[i + 1];

                args.Tag(curr, "group_next", GroupNext(curr, next));
            }

            //recurse
            foreach (Tree child in currNode.GetChildren())
            {
                InterpretHelper(args, child);
            }
        }
Exemplo n.º 5
0
 public void enqueue_set_tag(Tree node, string key, object value)
 {
     args.Tag(node, key, value);
 }