##// END OF EJS Templates
Addressing review comments....
Brian E. Granger -
Show More
@@ -68,7 +68,7 b' default_filters = {'
68 68 'strip_math_space': filters.strip_math_space,
69 69 'wrap_text': filters.wrap_text,
70 70 'escape_latex': filters.escape_latex,
71 'parse_citation': filters.parse_citation
71 'citation2latex': filters.citation2latex
72 72 }
73 73
74 74 #-----------------------------------------------------------------------------
@@ -13,10 +13,10 b''
13 13 #-----------------------------------------------------------------------------
14 14
15 15
16 __all__ = ['parse_citation']
16 __all__ = ['citation2latex']
17 17
18 18
19 def parse_citation(s):
19 def citation2latex(s):
20 20 """Parse citations in Markdown cells.
21 21
22 22 This looks for HTML tags having a data attribute names `data-cite`
@@ -10,7 +10,7 b''
10 10 # Imports
11 11 #-----------------------------------------------------------------------------
12 12
13 from ..citation import parse_citation
13 from ..citation import citation2latex
14 14
15 15 #-----------------------------------------------------------------------------
16 16 # Tests
@@ -25,6 +25,8 b' velit, lobortis sed interdum at, vestibulum vitae libero <strong data-cite="fper'
25 25 Lorem ipsum dolor sit amet, consectetur adipiscing elit
26 26 <em data-cite="takluyver">Thomas</em>. Quisque iaculis ligula ut ipsum mattis viverra.
27 27
28 <p>Here is a plain paragraph that should be unaffected.</p>
29
28 30 * One <cite data-cite="jdfreder">Jonathan</cite>.
29 31 * Two <cite data-cite="carreau">Matthias</cite>.
30 32 * Three <cite data-cite="ivanov">Paul</cite>.
@@ -39,16 +41,18 b' velit, lobortis sed interdum at, vestibulum vitae libero \\cite{fperez}.'
39 41 Lorem ipsum dolor sit amet, consectetur adipiscing elit
40 42 \cite{takluyver}. Quisque iaculis ligula ut ipsum mattis viverra.
41 43
44 <p>Here is a plain paragraph that should be unaffected.</p>
45
42 46 * One \cite{jdfreder}.
43 47 * Two \cite{carreau}.
44 48 * Three \cite{ivanov}.
45 49 """
46 50
47 def test_parse_citation():
51 def test_citation2latex():
48 52 """Are citations parsed properly?"""
49 53 try:
50 54 import lxml
51 55 except ImportError:
52 assert test_md == parse_citation(test_md)
56 assert test_md == citation2latex(test_md)
53 57 else:
54 assert test_md_parsed == parse_citation(test_md)
58 assert test_md_parsed == citation2latex(test_md)
@@ -103,11 +103,11 b' it introduces a new line'
103 103 ((* endblock stream *))
104 104
105 105 ((* block markdowncell scoped *))
106 ((( cell.source | parse_citation | markdown2latex )))
106 ((( cell.source | citation2latex | markdown2latex )))
107 107 ((* endblock markdowncell *))
108 108
109 109 ((* block headingcell scoped -*))
110 ((( ('#' * cell.level + cell.source) | replace('\n', ' ') | parse_citation | markdown2latex )))
110 ((( ('#' * cell.level + cell.source) | replace('\n', ' ') | citation2latex | markdown2latex )))
111 111 ((* endblock headingcell *))
112 112
113 113 ((* block rawcell scoped *))
@@ -232,7 +232,7 b' Note: For best display, use latex syntax highlighting. =))'
232 232 in IPYNB file titles) do not make their way into latex. Sometimes this
233 233 causes latex to barf. =))
234 234 ((*- endif -*))
235 {((( cell.source | parse_citation | markdown2latex )))}
235 {((( cell.source | citation2latex | markdown2latex )))}
236 236 ((*- endblock headingcell *))
237 237
238 238 %==============================================================================
@@ -242,7 +242,7 b' Note: For best display, use latex syntax highlighting. =))'
242 242 % called since we know we want latex output.
243 243 %==============================================================================
244 244 ((*- block markdowncell scoped-*))
245 ((( cell.source | parse_citation | markdown2latex )))
245 ((( cell.source | citation2latex | markdown2latex )))
246 246 ((*- endblock markdowncell -*))
247 247
248 248 %==============================================================================
General Comments 0
You need to be logged in to leave comments. Login now