Show More
@@ -19,7 +19,7 b' from .utils import markdown2latex' | |||||
19 | from .utils import highlight2latex |
|
19 | from .utils import highlight2latex | |
20 | from .utils import get_lines |
|
20 | from .utils import get_lines | |
21 |
|
21 | |||
22 |
from |
|
22 | from .config import GlobalConfigurable | |
23 |
|
23 | |||
24 | from IPython.config.configurable import Configurable |
|
24 | from IPython.config.configurable import Configurable | |
25 | from IPython.utils.traitlets import List |
|
25 | from IPython.utils.traitlets import List |
@@ -2,12 +2,13 b'' | |||||
2 | Module that allows latex output notebooks to be conditioned before |
|
2 | Module that allows latex output notebooks to be conditioned before | |
3 | they are converted. |
|
3 | they are converted. | |
4 | """ |
|
4 | """ | |
|
5 | from __future__ import absolute_import | |||
5 |
|
6 | |||
6 | # Configurable traitlets |
|
7 | # Configurable traitlets | |
7 | from IPython.utils.traitlets import Unicode, Bool |
|
8 | from IPython.utils.traitlets import Unicode, Bool | |
8 |
|
9 | |||
9 | # Needed to override transformer |
|
10 | # Needed to override transformer | |
10 |
from |
|
11 | from .transformers import (ActivatableTransformer) | |
11 |
|
12 | |||
12 | class LatexTransformer(ActivatableTransformer): |
|
13 | class LatexTransformer(ActivatableTransformer): | |
13 | """ |
|
14 | """ |
@@ -2,6 +2,7 b'' | |||||
2 | Module that allows custom Sphinx parameters to be set on the notebook and |
|
2 | Module that allows custom Sphinx parameters to be set on the notebook and | |
3 | on the 'other' object passed into Jinja. |
|
3 | on the 'other' object passed into Jinja. | |
4 | """ |
|
4 | """ | |
|
5 | from __future__ import absolute_import | |||
5 |
|
6 | |||
6 | # Used to find Sphinx package location |
|
7 | # Used to find Sphinx package location | |
7 | import sphinx |
|
8 | import sphinx | |
@@ -20,7 +21,7 b' from IPython.utils.traitlets import Unicode, Bool' | |||||
20 | from pygments.formatters import LatexFormatter |
|
21 | from pygments.formatters import LatexFormatter | |
21 |
|
22 | |||
22 | # Needed to override transformer |
|
23 | # Needed to override transformer | |
23 |
from |
|
24 | from .transformers import (ActivatableTransformer) | |
24 |
|
25 | |||
25 | class SphinxTransformer(ActivatableTransformer): |
|
26 | class SphinxTransformer(ActivatableTransformer): | |
26 | """ |
|
27 | """ |
@@ -6,6 +6,9 b' that uses Jinja2 to convert notebook files into different format.' | |||||
6 | You can register both pre-transformers that will act on the notebook format |
|
6 | You can register both pre-transformers that will act on the notebook format | |
7 | befor conversion and jinja filter that would then be availlable in the templates |
|
7 | befor conversion and jinja filter that would then be availlable in the templates | |
8 | """ |
|
8 | """ | |
|
9 | ||||
|
10 | from __future__ import absolute_import | |||
|
11 | ||||
9 | #----------------------------------------------------------------------------- |
|
12 | #----------------------------------------------------------------------------- | |
10 | # Copyright (c) 2013, the IPython Development Team. |
|
13 | # Copyright (c) 2013, the IPython Development Team. | |
11 | # |
|
14 | # | |
@@ -18,10 +21,12 b' befor conversion and jinja filter that would then be availlable in the templates' | |||||
18 | # Imports |
|
21 | # Imports | |
19 | #----------------------------------------------------------------------------- |
|
22 | #----------------------------------------------------------------------------- | |
20 |
|
23 | |||
21 |
from __future__ import print_function |
|
24 | from __future__ import print_function | |
|
25 | from __future__ import absolute_import | |||
22 |
|
26 | |||
23 | # Stdlib imports |
|
27 | # Stdlib imports | |
24 | import io |
|
28 | import io | |
|
29 | import os | |||
25 |
|
30 | |||
26 | # IPython imports |
|
31 | # IPython imports | |
27 | from IPython.utils.traitlets import MetaHasTraits |
|
32 | from IPython.utils.traitlets import MetaHasTraits | |
@@ -35,16 +40,16 b' from jinja2 import Environment, FileSystemLoader' | |||||
35 |
|
40 | |||
36 |
|
41 | |||
37 | # local import (pre-transformers) |
|
42 | # local import (pre-transformers) | |
38 |
import |
|
43 | from . import transformers as trans | |
39 |
from |
|
44 | from .sphinx_transformer import (SphinxTransformer) | |
40 |
from |
|
45 | from .latex_transformer import (LatexTransformer) | |
41 |
|
46 | |||
42 | # some jinja filters |
|
47 | # some jinja filters | |
43 |
from |
|
48 | from .jinja_filters import (python_comment, indent, | |
44 | rm_fake, remove_ansi, markdown, highlight, highlight2latex, |
|
49 | rm_fake, remove_ansi, markdown, highlight, highlight2latex, | |
45 | ansi2html, markdown2latex, get_lines, escape_tex, FilterDataType) |
|
50 | ansi2html, markdown2latex, get_lines, escape_tex, FilterDataType) | |
46 |
|
51 | |||
47 |
from |
|
52 | from .utils import markdown2rst | |
48 |
|
53 | |||
49 | import textwrap |
|
54 | import textwrap | |
50 |
|
55 | |||
@@ -62,16 +67,19 b' def wrap(text, width=100):' | |||||
62 |
|
67 | |||
63 | env = Environment( |
|
68 | env = Environment( | |
64 | loader=FileSystemLoader([ |
|
69 | loader=FileSystemLoader([ | |
65 | './templates/', |
|
70 | os.path.dirname(os.path.realpath(__file__))+'/../templates/', | |
66 | './templates/skeleton/', |
|
71 | os.path.dirname(os.path.realpath(__file__))+'/../templates/skeleton/', | |
67 | ]), |
|
72 | ]), | |
68 | extensions=['jinja2.ext.loopcontrols'] |
|
73 | extensions=['jinja2.ext.loopcontrols'] | |
69 | ) |
|
74 | ) | |
70 |
|
75 | |||
|
76 | print(os.path.dirname(os.path.realpath(__file__))+'/../templates/') | |||
|
77 | ||||
|
78 | ||||
71 | texenv = Environment( |
|
79 | texenv = Environment( | |
72 | loader=FileSystemLoader([ |
|
80 | loader=FileSystemLoader([ | |
73 | './templates/tex/', |
|
81 | os.path.dirname(os.path.realpath(__file__))+'/../templates/tex/', | |
74 | './templates/skeleton/tex/', |
|
82 | os.path.dirname(os.path.realpath(__file__))+'/../templates/skeleton/tex/', | |
75 | ]), |
|
83 | ]), | |
76 | extensions=['jinja2.ext.loopcontrols'] |
|
84 | extensions=['jinja2.ext.loopcontrols'] | |
77 | ) |
|
85 | ) |
@@ -6,12 +6,12 b' It exposes convenient classes to inherit from to access configurability' | |||||
6 | as well as decorator to simplify tasks. |
|
6 | as well as decorator to simplify tasks. | |
7 | """ |
|
7 | """ | |
8 |
|
8 | |||
9 | from __future__ import print_function |
|
9 | from __future__ import print_function, absolute_import | |
10 |
|
10 | |||
11 | from IPython.config.configurable import Configurable |
|
11 | from IPython.config.configurable import Configurable | |
12 | from IPython.utils.traitlets import Unicode, Bool, Dict, List |
|
12 | from IPython.utils.traitlets import Unicode, Bool, Dict, List | |
13 |
|
13 | |||
14 |
from |
|
14 | from .config import GlobalConfigurable | |
15 |
|
15 | |||
16 | class ConfigurableTransformers(GlobalConfigurable): |
|
16 | class ConfigurableTransformers(GlobalConfigurable): | |
17 | """ A configurable transformer |
|
17 | """ A configurable transformer |
@@ -16,7 +16,7 b'' | |||||
16 | {% block output_group -%} |
|
16 | {% block output_group -%} | |
17 | <div class="vbox output_wrapper"> |
|
17 | <div class="vbox output_wrapper"> | |
18 | <div class="output vbox"> |
|
18 | <div class="output vbox"> | |
19 |
<div class=" |
|
19 | <div class="vbox output_area"> | |
20 | {{ super() }} |
|
20 | {{ super() }} | |
21 | </div> |
|
21 | </div> | |
22 | </div> |
|
22 | </div> | |
@@ -129,4 +129,4 b' unknown type {{cell.type}}' | |||||
129 | <div class="box-flex1 output_subarea output_display_data"> |
|
129 | <div class="box-flex1 output_subarea output_display_data"> | |
130 | {{super()}} |
|
130 | {{super()}} | |
131 | </div> |
|
131 | </div> | |
132 | {%- endblock display_data -%} No newline at end of file |
|
132 | {%- endblock display_data -%} |
General Comments 0
You need to be logged in to leave comments.
Login now