Пример #1
0
 def build_node(self):
     lnode = UnOrderedListNode()
     for anyone in self.get_collection():
         inode = ListItemNode()
         inode.add_node(node(anyone))
         lnode.add_node(inode)
     return lnode
Пример #2
0
 def parse(self, stream):
     cstream = CacheStream(stream)
     root = RootBuilder()
     builder = None
     while not cstream.is_eof():
         bu = self.parse_line(cstream)
         if bu:
             if builder:
                 if builder.is_mergeable(bu):
                     builder = builder.merge(bu)
                 elif bu.is_mergeable(builder):
                     builder = bu.merge(builder)
                 else:
                     root.add(builder)
                     builder = bu
             else:
                 builder = bu
         else:
             if builder:
                 root.add(builder)
                 builder = bu
             else:
                 pass
     if builder:
         root.add(builder)
     return node(root)
Пример #3
0
 def build_node(self):
     rnode = RootNode()
     for anyone in self.get_collection():
         rnode.add_node(node(anyone))
     return rnode
Пример #4
0
 def build_node(self):
     cnode = CollectionNode()
     for anyone in self.get_collection():
         cnode.add_node(node(anyone))
     return cnode
Пример #5
0
 def build_node(self):
     pnode = QuotationNode(cite=self.cite)
     for anyone in self.get_collection():
         pnode.add_node(node(anyone))
     return pnode
Пример #6
0
 def build_node(self):
     pnode = ParagraphNode()
     for anyone in self.get_collection():
         pnode.add_node(node(anyone))
     return pnode.trim()
Пример #7
0
 def build_node(self):
     hnode = HeadingNode(self.hnum)
     for anyone in self.get_collection():
         hnode.add_node(node(anyone))
     return hnode