class_docstr: A class that can represent a notebook cell as a Spyder/VScode script (#59)
class_docstr_tok: ["A","class","that","can","represent","a","notebook","cell","as","a","Spyder\/VScode","script","(","#","59",")"]
docstr: Return the text representation for the cell
code: def cell_to_text(self):
      """Return the text representation for the cell"""
      active = is_active(
          self.ext,
          self.metadata,
          same_language(self.language, self.default_language),
      )
      if (
          self.cell_type == "raw"
          and "active" in self.metadata
          and self.metadata["active"] == ""
      ):
          del self.metadata["active"]
  
      if not self.is_code():
          self.metadata["cell_type"] = self.cell_type
  
      options = metadata_to_double_percent_options(
          self.metadata, self.cell_metadata_json
      )
      indent = ""
      if self.is_code() and active and self.source:
          first_line = self.source[0]
          if first_line.strip():
              left_space = re.compile(r"^(\s*)").match(first_line)
              if left_space:
                  indent = left_space.groups()[0]
  
      if options.startswith("%") or not options:
          lines = comment_lines(
              ["%%" + options],
              indent + self.comment,
              self.comment_suffix,
          )
      else:
          lines = comment_lines(
              ["%% " + options],
              indent + self.comment,
              self.comment_suffix,
          )
  
      if self.is_code() and active:
          source = copy(self.source)
          comment_magic(source, self.language, self.comment_magics)
          if source == [""]:
              return lines
          return lines + source
  
      return lines + self.markdown_to_text(self.source)
  
imports: import re
  import warnings
  from copy import copy
  from .cell_metadata import _IGNORE_CELL_METADATA, is_active, metadata_to_double_percent_options, metadata_to_rmd_options, metadata_to_text
  from .cell_reader import LightScriptCellReader, MarkdownCellReader, RMarkdownCellReader
  from .doxygen import markdown_to_doxygen
  from .languages import _SCRIPT_EXTENSIONS, cell_language, comment_lines, same_language
  from .magics import comment_magic, escape_code_start, need_explicit_marker
  from .metadata_filter import filter_metadata
  from .pep8 import pep8_lines_between_cells
label_desc: Use image node_id 2 for calling the DoublePercentCellExporter obj's underlying member method code with example usage: obj.cell_to_text() and returns: unknown, unknown, lines