Exemple #1
0
    def render_pyout(self, output):
        lines = ['Out[%s]:' % self._get_prompt_number(output), '']

        # output is a dictionary like object with type as a key
        if 'latex' in output:
            lines.extend(rst_directive('.. math::', output.latex))

        if 'text' in output:
            lines.extend(rst_directive('.. parsed-literal::', output.text))

        return lines
Exemple #2
0
    def render_pyout(self, output):
        lines = ["Out[%s]:" % self._get_prompt_number(output), ""]

        # output is a dictionary like object with type as a key
        if "latex" in output:
            lines.extend(rst_directive(".. math::", output.latex))

        if "text" in output:
            lines.extend(rst_directive(".. parsed-literal::", output.text))

        return lines
Exemple #3
0
    def render_pyout(self, output):
        lines = ['Out[%s]:' % output.prompt_number, '']

        # output is a dictionary like object with type as a key
        if 'latex' in output:
            lines.extend(rst_directive('.. math::', output.latex))

        if 'text' in output:
            lines.extend(rst_directive('.. parsed-literal::', output.text))

        return lines
Exemple #4
0
    def render_code(self, cell):
        if not cell.input:
            return []

        lines = ['In[%s]:' % cell.prompt_number, '']
        lines.extend(rst_directive('.. code:: python', cell.input))

        for output in cell.outputs:
            conv_fn = self.dispatch(output.output_type)
            lines.extend(conv_fn(output))

        return lines
Exemple #5
0
    def render_code(self, cell):
        # Note: cell has type 'IPython.nbformat.v3.nbbase.NotebookNode'
        if not cell.input:
            return []

        lines = ['In[%s]:' % self._get_prompt_number(cell), '']
        lines.extend(rst_directive('.. code:: python', cell.input))

        for output in cell.outputs:
            conv_fn = self.dispatch(output.output_type)
            lines.extend(conv_fn(output))

        return lines
Exemple #6
0
    def render_code(self, cell):
        # Note: cell has type 'IPython.nbformat.v3.nbbase.NotebookNode'
        if not cell.input:
            return []

        lines = ["In[%s]:" % self._get_prompt_number(cell), ""]
        lines.extend(rst_directive(".. code:: python", cell.input))

        for output in cell.outputs:
            conv_fn = self.dispatch(output.output_type)
            lines.extend(conv_fn(output))

        return lines
Exemple #7
0
 def render_display_format_javascript(self, output):
     return rst_directive(".. raw:: javascript", output.javascript)
Exemple #8
0
 def render_display_format_json(self, output):
     return rst_directive(".. raw:: json", output.json)
Exemple #9
0
 def render_display_format_latex(self, output):
     return rst_directive(".. math::", output.latex)
Exemple #10
0
 def render_display_format_html(self, output):
     return rst_directive(".. raw:: html", output.html)
Exemple #11
0
 def _unknown_lines(self, data):
     return rst_directive(".. warning:: Unknown cell") + [data]
Exemple #12
0
 def render_display_format_text(self, output):
     return rst_directive(".. parsed-literal::", output.text)
Exemple #13
0
 def render_display_format_text(self, output):
     return rst_directive('.. parsed-literal::', output.text)
Exemple #14
0
 def _unknown_lines(self, data):
     return rst_directive('.. warning:: Unknown cell') + [data]
Exemple #15
0
 def render_display_format_html(self, output):
     return rst_directive('.. raw:: html', output.html)
Exemple #16
0
 def render_display_format_javascript(self, output):
     return rst_directive('.. raw:: javascript', output.javascript)
Exemple #17
0
 def render_display_format_json(self, output):
     return rst_directive('.. raw:: json', output.json)
Exemple #18
0
 def render_display_format_latex(self, output):
     return rst_directive('.. math::', output.latex)