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