def _process_code(self, div): """ Process a code div, returning a scene and the frames referenced. """ frames = [] scene = Scene() scene.set_type("code") coqdoc = [] for child in div: coqdoc.append(child) commands = self._find_commands(child) if commands and self.isCommand(commands[0]): command = self._replace_html(commands[0]) response = self._prover.send( command.encode(self._coqdoc_tree.originalEncoding)) frame = Coqdoc_Frame(command = command, command_cd = coqdoc, response = response) frames.append(frame) scene.add_scene(frame) coqdoc = [] trailing_frame = Coqdoc_Frame(command = ''.join([str(el) for el in coqdoc]), command_cd = coqdoc, response = None) frames.append(trailing_frame) scene.add_scene(trailing_frame) return frames, scene
def _process_code(self, div): """ Process a code div, returning a scene and the frames referenced. """ frames = [] scene = Scene() scene.set_type("code") coqdoc = [] for child in div: coqdoc.append(child) commands = self._find_commands(child) if commands and self.isCommand(commands[0]): command = self._replace_html(commands[0]) if (command.count("Notation") == 0): response = self._prover.send( command.encode(self._coqdoc_tree.originalEncoding)) frame = Coqdoc_Frame(command=command, command_cd=coqdoc, response=response) frames.append(frame) scene.add_scene(frame) coqdoc = [] trailing_frame = Coqdoc_Frame(command=''.join( [str(el) for el in coqdoc]), command_cd=coqdoc, response=None) frames.append(trailing_frame) scene.add_scene(trailing_frame) return frames, scene
def _process_doc(self, div): frames = [] scene = Scene() scene.set_type("doc") scene.set_attributes(div.attrs) for child in div: try: child_name = child.name except AttributeError: child_name = "text" child.text = str(child) if child_name == "div": if div.get("class") == "doc": child_frames, child_scene = self._process_doc(child) else: child_frames, child_scene = self._process_div(child) else: child_scene = Coqdoc_Frame(command = child.text, command_cd = [child], response = None) child_frames = [child_scene] frames += child_frames scene.add_scene(child_scene) return frames, scene
def _process_doc(self, div): frames = [] scene = Scene() scene.set_type("doc") scene.set_attributes(div.attrs) for child in div: try: child_name = child.name except AttributeError: child_name = "text" child.text = str(child) if child_name == "div": if div.get("class") == "doc": child_frames, child_scene = self._process_doc(child) else: child_frames, child_scene = self._process_div(child) else: child_scene = Coqdoc_Frame(command=child.text, command_cd=[child], response=None) child_frames = [child_scene] frames += child_frames scene.add_scene(child_scene) return frames, scene