##// END OF EJS Templates
start rst converter
Matthias BUSSONNIER -
Show More
@@ -0,0 +1,7 b''
1 c = get_config()
2
3 c.ConverterTemplate.extract_figures=False
4 c.ConverterTemplate.template_file='rst'
5 c.ConverterTemplate.tex_environement=False
6
7 c.NbconvertApp.fileext='rst'
@@ -0,0 +1,69 b''
1 {%- extends 'null.tpl' -%}
2
3 {% block in_prompt -%}
4 In[{{cell.prompt_number if cell.prompt_number else ' '}}]:
5
6 .. code:: python
7
8 {% endblock in_prompt %}
9
10 {% block output_prompt %}
11 Out[{{cell.prompt_number}}]:{% endblock output_prompt %}
12
13 {% block input %}{{ cell.input | indent}}
14 {% endblock input %}
15
16
17 {# Those Two are for error displaying
18 even if the first one seem to do nothing,
19 it introduces a new line
20
21 #}
22 {% block pyerr %}{{ super() }}
23 {% endblock pyerr %}
24
25 {% block traceback_line %}
26 {{ line |indent| rm_ansi }}{% endblock traceback_line %}
27 {# .... #}
28
29
30 {% block pyout %}
31 .. parsed-literal::
32
33 {{ output.text| indent }}
34 {% endblock pyout %}
35
36 {% block stream %}
37 .. parsed-literal::
38
39 {{ output.text| indent }}
40 {% endblock stream %}
41
42
43
44
45 {% block display_data scoped %}
46 # image file:
47 {% endblock display_data %}
48
49 {% block markdowncell scoped %}
50 {{ cell.source | markdown2rst }}
51 {% endblock markdowncell %}
52
53 {% block headingcell scoped %}
54 {%- set len = cell.source|length -%}
55 {{ cell.source}}
56 {% if cell.level == 1 %}
57 {{- '=' * len }}
58 {%- elif cell.level == 2 %}
59 {{- '-' * len }}
60 {% endif %}
61 {% endblock headingcell %}
62
63 {% block rawcell scoped %}
64 {{ cell.source }}
65 {% endblock rawcell %}
66
67 {% block unknowncell scoped %}
68 unknown type {{cell.type}}
69 {% endblock unknowncell %}
@@ -21,6 +21,8 b' from converters.jinja_filters import (python_comment, indent,'
21 rm_fake, remove_ansi, markdown, highlight,
21 rm_fake, remove_ansi, markdown, highlight,
22 ansi2html, markdown2latex, escape_tex)
22 ansi2html, markdown2latex, escape_tex)
23
23
24 from converters.utils import markdown2rst
25
24
26
25
27
26 # Stdlib imports
28 # Stdlib imports
@@ -199,6 +201,7 b' class ConverterTemplate(Configurable):'
199 self.env.filters['highlight'] = highlight
201 self.env.filters['highlight'] = highlight
200 self.env.filters['ansi2html'] = ansi2html
202 self.env.filters['ansi2html'] = ansi2html
201 self.env.filters['markdown2latex'] = markdown2latex
203 self.env.filters['markdown2latex'] = markdown2latex
204 self.env.filters['markdown2rst'] = markdown2rst
202 for k, v in jinja_filters.iteritems():
205 for k, v in jinja_filters.iteritems():
203 self.env.filters[k] = v
206 self.env.filters[k] = v
204
207
General Comments 0
You need to be logged in to leave comments. Login now