##// END OF EJS Templates
read css from ipython dir
Matthias BUSSONNIER -
Show More
@@ -23,6 +23,7 b' import codecs'
23 import io
23 import io
24 import logging
24 import logging
25 import os
25 import os
26 from IPython.utils import path
26 import pprint
27 import pprint
27 import re
28 import re
28 from types import FunctionType
29 from types import FunctionType
@@ -54,6 +55,39 b' class ConversionException(Exception):'
54 def python_comment(string):
55 def python_comment(string):
55 return '# '+'\n# '.join(string.split('\n'))
56 return '# '+'\n# '.join(string.split('\n'))
56
57
58
59
60 def header_body():
61 """Return the body of the header as a list of strings."""
62
63 from pygments.formatters import HtmlFormatter
64
65 header = []
66 static = os.path.join(path.get_ipython_package_dir(),
67 'frontend', 'html', 'notebook', 'static',
68 )
69 here = os.path.split(os.path.realpath(__file__))[0]
70 css = os.path.join(static, 'css')
71 for sheet in [
72 # do we need jquery and prettify?
73 # os.path.join(static, 'jquery', 'css', 'themes', 'base',
74 # 'jquery-ui.min.css'),
75 # os.path.join(static, 'prettify', 'prettify.css'),
76 os.path.join(css, 'boilerplate.css'),
77 os.path.join(css, 'fbm.css'),
78 os.path.join(css, 'notebook.css'),
79 os.path.join(css, 'renderedhtml.css'),
80 # our overrides:
81 #os.path.join(here, '..', 'css', 'static_html.css'),
82 ]:
83
84 with io.open(sheet, encoding='utf-8') as f:
85 s = f.read()
86 header.extend(s.split('\n'))
87 return header
88
89 ecss = header_body()
90
57 env.filters['pycomment'] = python_comment
91 env.filters['pycomment'] = python_comment
58 env.filters['indent'] = indent
92 env.filters['indent'] = indent
59 env.filters['rm_fake'] = rm_fake
93 env.filters['rm_fake'] = rm_fake
@@ -98,7 +132,7 b' class ConverterTemplate(Configurable):'
98 return converted_cells
132 return converted_cells
99
133
100 def convert(self, cell_separator='\n'):
134 def convert(self, cell_separator='\n'):
101 return self.template.render(worksheets=self.process())
135 return self.template.render(worksheets=self.process(), ecss=ecss)
102
136
103
137
104 def read(self, filename):
138 def read(self, filename):
This diff has been collapsed as it changes many lines, (663 lines changed) Show them Hide them
@@ -4,667 +4,8 b''
4 <html>
4 <html>
5 <head>
5 <head>
6 <style type="text/css">
6 <style type="text/css">
7 /**
7 {% for css in ecss %}{{css}}
8 * HTML5 ✰ Boilerplate
8 {% endfor %}
9 *
10 * style.css contains a reset, font normalization and some base styles.
11 *
12 * Credit is left where credit is due.
13 * Much inspiration was taken from these projects:
14 * - yui.yahooapis.com/2.8.1/build/base/base.css
15 * - camendesign.com/design/
16 * - praegnanz.de/weblog/htmlcssjs-kickstart
17 */
18
19
20 /**
21 * html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
22 * v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
23 * html5doctor.com/html-5-reset-stylesheet/
24 */
25
26 html, body, div, span, object, iframe,
27 h1, h2, h3, h4, h5, h6, p, blockquote, pre,
28 abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
29 small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
30 fieldset, form, label, legend,
31 table, caption, tbody, tfoot, thead, tr, th, td,
32 article, aside, canvas, details, figcaption, figure,
33 footer, header, hgroup, menu, nav, section, summary,
34 time, mark, audio, video {
35 margin: 0;
36 padding: 0;
37 border: 0;
38 font-size: 100%;
39 font: inherit;
40 vertical-align: baseline;
41 }
42
43 sup { vertical-align: super; }
44 sub { vertical-align: sub; }
45
46 article, aside, details, figcaption, figure,
47 footer, header, hgroup, menu, nav, section {
48 display: block;
49 }
50
51 blockquote, q { quotes: none; }
52
53 blockquote:before, blockquote:after,
54 q:before, q:after { content: ""; content: none; }
55
56 ins { background-color: #ff9; color: #000; text-decoration: none; }
57
58 mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
59
60 del { text-decoration: line-through; }
61
62 abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
63
64 table { border-collapse: collapse; border-spacing: 0; }
65
66 hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
67
68 input, select { vertical-align: middle; }
69
70
71 /**
72 * Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/
73 */
74
75 body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */
76 select, input, textarea, button { font:99% sans-serif; }
77
78 /* Normalize monospace sizing:
79 en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */
80 pre, code, kbd, samp { font-family: monospace, sans-serif; }
81
82 em,i { font-style: italic; }
83 b,strong { font-weight: bold; }
84
85 </style>
86 <style type="text/css">
87
88 /* Flexible box model classes */
89 /* Taken from Alex Russell http://infrequently.org/2009/08/css-3-progress/ */
90
91 .hbox {
92 display: -webkit-box;
93 -webkit-box-orient: horizontal;
94 -webkit-box-align: stretch;
95
96 display: -moz-box;
97 -moz-box-orient: horizontal;
98 -moz-box-align: stretch;
99
100 display: box;
101 box-orient: horizontal;
102 box-align: stretch;
103 }
104
105 .hbox > * {
106 -webkit-box-flex: 0;
107 -moz-box-flex: 0;
108 box-flex: 0;
109 }
110
111 .vbox {
112 display: -webkit-box;
113 -webkit-box-orient: vertical;
114 -webkit-box-align: stretch;
115
116 display: -moz-box;
117 -moz-box-orient: vertical;
118 -moz-box-align: stretch;
119
120 display: box;
121 box-orient: vertical;
122 box-align: stretch;
123 }
124
125 .vbox > * {
126 -webkit-box-flex: 0;
127 -moz-box-flex: 0;
128 box-flex: 0;
129 }
130
131 .reverse {
132 -webkit-box-direction: reverse;
133 -moz-box-direction: reverse;
134 box-direction: reverse;
135 }
136
137 .box-flex0 {
138 -webkit-box-flex: 0;
139 -moz-box-flex: 0;
140 box-flex: 0;
141 }
142
143 .box-flex1, .box-flex {
144 -webkit-box-flex: 1;
145 -moz-box-flex: 1;
146 box-flex: 1;
147 }
148
149 .box-flex2 {
150 -webkit-box-flex: 2;
151 -moz-box-flex: 2;
152 box-flex: 2;
153 }
154
155 .box-group1 {
156 -webkit-box-flex-group: 1;
157 -moz-box-flex-group: 1;
158 box-flex-group: 1;
159 }
160
161 .box-group2 {
162 -webkit-box-flex-group: 2;
163 -moz-box-flex-group: 2;
164 box-flex-group: 2;
165 }
166
167 .start {
168 -webkit-box-pack: start;
169 -moz-box-pack: start;
170 box-pack: start;
171 }
172
173 .end {
174 -webkit-box-pack: end;
175 -moz-box-pack: end;
176 box-pack: end;
177 }
178
179 .center {
180 -webkit-box-pack: center;
181 -moz-box-pack: center;
182 box-pack: center;
183 }
184
185 </style>
186 <style type="text/css">
187 /**
188 * Primary styles
189 *
190 * Author: IPython Development Team
191 */
192
193
194 body {
195 overflow: hidden;
196 }
197
198 blockquote {
199 border-left: 4px solid #DDD;
200 padding: 0 15px;
201 color: #777;
202 }
203
204 span#save_widget {
205 padding: 5px;
206 margin: 0px 0px 0px 300px;
207 display:inline-block;
208 }
209
210 span#notebook_name {
211 height: 1em;
212 line-height: 1em;
213 padding: 3px;
214 border: none;
215 font-size: 146.5%;
216 }
217
218 .ui-menubar-item .ui-button .ui-button-text {
219 padding: 0.4em 1.0em;
220 font-size: 100%;
221 }
222
223 .ui-menu {
224 -moz-box-shadow: 0px 6px 10px -1px #adadad;
225 -webkit-box-shadow: 0px 6px 10px -1px #adadad;
226 box-shadow: 0px 6px 10px -1px #adadad;
227 }
228
229 .ui-menu .ui-menu-item a {
230 border: 1px solid transparent;
231 padding: 2px 1.6em;
232 }
233
234 .ui-menu .ui-menu-item a.ui-state-focus {
235 margin: 0;
236 }
237
238 .ui-menu hr {
239 margin: 0.3em 0;
240 }
241
242 #menubar_container {
243 position: relative;
244 }
245
246 #notification_area {
247 position: absolute;
248 right: 0px;
249 top: 0px;
250 height: 25px;
251 padding: 3px 0px;
252 padding-right: 3px;
253 z-index: 10;
254 }
255
256 .notification_widget{
257 float : right;
258 right: 0px;
259 top: 1px;
260 height: 25px;
261 padding: 3px 6px;
262 z-index: 10;
263 }
264
265 .toolbar {
266 padding: 3px 15px;
267 }
268
269 #cell_type {
270 font-size: 85%;
271 }
272
273
274 div#main_app {
275 width: 100%;
276 position: relative;
277 }
278
279 span#quick_help_area {
280 position: static;
281 padding: 5px 0px;
282 margin: 0px 0px 0px 0px;
283 }
284
285 .help_string {
286 float: right;
287 width: 170px;
288 padding: 0px 5px;
289 text-align: left;
290 font-size: 85%;
291 }
292
293 .help_string_label {
294 float: right;
295 font-size: 85%;
296 }
297
298 div#notebook_panel {
299 margin: 0px 0px 0px 0px;
300 padding: 0px;
301 }
302
303 div#notebook {
304 overflow-y: scroll;
305 overflow-x: auto;
306 width: 100%;
307 /* This spaces the cell away from the edge of the notebook area */
308 padding: 5px 5px 15px 5px;
309 margin: 0px;
310 background-color: white;
311 }
312
313 div#pager_splitter {
314 height: 8px;
315 }
316
317 #pager_container {
318 position : relative;
319 }
320
321 div#pager {
322 padding: 15px;
323 overflow: auto;
324 display: none;
325 }
326
327 div.ui-widget-content {
328 border: 1px solid #aaa;
329 outline: none;
330 }
331
332 .cell {
333 border: 1px solid transparent;
334 }
335
336 div.cell {
337 width: 100%;
338 padding: 5px 5px 5px 0px;
339 /* This acts as a spacer between cells, that is outside the border */
340 margin: 2px 0px 2px 0px;
341 }
342
343 div.code_cell {
344 background-color: white;
345 }
346
347 /* any special styling for code cells that are currently running goes here */
348 div.code_cell.running {
349 }
350
351 div.prompt {
352 /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
353 width: 11ex;
354 /* This 0.4em is tuned to match the padding on the CodeMirror editor. */
355 padding: 0.4em;
356 margin: 0px;
357 font-family: monospace;
358 text-align:right;
359 }
360
361 div.input {
362 page-break-inside: avoid;
363 }
364
365 /* input_area and input_prompt must match in top border and margin for alignment */
366 div.input_area {
367 color: black;
368 border: 1px solid #ddd;
369 border-radius: 3px;
370 background: #f7f7f7;
371 }
372
373 div.input_prompt {
374 color: navy;
375 border-top: 1px solid transparent;
376 }
377
378 div.output_wrapper {
379 /* This is a spacer between the input and output of each cell */
380 margin-top: 5px;
381 margin-left: 5px;
382 /* FF needs explicit width to stretch */
383 width: 100%;
384 /* this position must be relative to enable descendents to be absolute within it */
385 position: relative;
386 }
387
388 /* class for the output area when it should be height-limited */
389 div.output_scroll {
390 /* ideally, this would be max-height, but FF barfs all over that */
391 height: 24em;
392 /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */
393 width: 100%;
394
395 overflow: auto;
396 border-radius: 3px;
397 box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8);
398 }
399
400 /* output div while it is collapsed */
401 div.output_collapsed {
402 margin-right: 5px;
403 }
404
405 div.out_prompt_overlay {
406 height: 100%;
407 padding: 0px;
408 position: absolute;
409 border-radius: 3px;
410 }
411
412 div.out_prompt_overlay:hover {
413 /* use inner shadow to get border that is computed the same on WebKit/FF */
414 box-shadow: inset 0 0 1px #000;
415 background: rgba(240, 240, 240, 0.5);
416 }
417
418 div.output_prompt {
419 color: darkred;
420 /* 5px right shift to account for margin in parent container */
421 margin: 0 5px 0 -5px;
422 }
423
424 /* This class is the outer container of all output sections. */
425 div.output_area {
426 padding: 0px;
427 page-break-inside: avoid;
428 }
429
430 /* This class is for the output subarea inside the output_area and after
431 the prompt div. */
432 div.output_subarea {
433 padding: 0.44em 0.4em 0.4em 1px;
434 }
435
436 /* The rest of the output_* classes are for special styling of the different
437 output types */
438
439 /* all text output has this class: */
440 div.output_text {
441 text-align: left;
442 color: black;
443 font-family: monospace;
444 }
445
446 /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */
447 div.output_stream {
448 padding-top: 0.0em;
449 padding-bottom: 0.0em;
450 }
451 div.output_stdout {
452 }
453 div.output_stderr {
454 background: #fdd; /* very light red background for stderr */
455 }
456
457 div.output_latex {
458 text-align: left;
459 color: black;
460 }
461
462 div.output_html {
463 }
464
465 div.output_png {
466 }
467
468 div.output_jpeg {
469 }
470
471 div.text_cell {
472 background-color: white;
473 padding: 5px 5px 5px 5px;
474 }
475
476 div.text_cell_input {
477 color: black;
478 border: 1px solid #ddd;
479 border-radius: 3px;
480 background: #f7f7f7;
481 }
482
483 div.text_cell_render {
484 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
485 outline: none;
486 resize: none;
487 width: inherit;
488 border-style: none;
489 padding: 5px;
490 color: black;
491 }
492
493 /* The following gets added to the <head> if it is detected that the user has a
494 * monospace font with inconsistent normal/bold/italic height. See
495 * notebookmain.js. Such fonts will have keywords vertically offset with
496 * respect to the rest of the text. The user should select a better font.
497 * See: https://github.com/ipython/ipython/issues/1503
498 *
499 * .CodeMirror span {
500 * vertical-align: bottom;
501 * }
502 */
503
504 .CodeMirror {
505 line-height: 1.231; /* Changed from 1em to our global default */
506 }
507
508 .CodeMirror-scroll {
509 height: auto; /* Changed to auto to autogrow */
510 /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/
511 /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/
512 overflow-y: hidden;
513 overflow-x: auto; /* Changed from auto to remove scrollbar */
514 }
515
516 /* CSS font colors for translated ANSI colors. */
517
518
519 .ansiblack {color: black;}
520 .ansired {color: darkred;}
521 .ansigreen {color: darkgreen;}
522 .ansiyellow {color: brown;}
523 .ansiblue {color: darkblue;}
524 .ansipurple {color: darkviolet;}
525 .ansicyan {color: steelblue;}
526 .ansigrey {color: grey;}
527 .ansibold {font-weight: bold;}
528
529 .completions {
530 position: absolute;
531 z-index: 10;
532 overflow: hidden;
533 border: 1px solid grey;
534 }
535
536 .completions select {
537 background: white;
538 outline: none;
539 border: none;
540 padding: 0px;
541 margin: 0px;
542 overflow: auto;
543 font-family: monospace;
544 }
545
546 option.context {
547 background-color: #DEF7FF;
548 }
549 option.introspection {
550 background-color: #EBF4EB;
551 }
552
553 /*fixed part of the completion*/
554 .completions p b {
555 font-weight:bold;
556 }
557
558 .completions p {
559 background: #DDF;
560 /*outline: none;
561 padding: 0px;*/
562 border-bottom: black solid 1px;
563 padding: 1px;
564 font-family: monospace;
565 }
566
567 pre.dialog {
568 background-color: #f7f7f7;
569 border: 1px solid #ddd;
570 border-radius: 3px;
571 padding: 0.4em;
572 padding-left: 2em;
573 }
574
575 p.dialog {
576 padding : 0.2em;
577 }
578
579 .shortcut_key {
580 display: inline-block;
581 width: 15ex;
582 text-align: right;
583 font-family: monospace;
584 }
585
586 .shortcut_descr {
587 }
588
589 /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems
590 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
591 */
592 pre, code, kbd, samp { white-space: pre-wrap; }
593
594 #fonttest {
595 font-family: monospace;
596 }
597
598 .js-error {
599 color: darkred;
600 }
601
602 </style>
603 <style type="text/css">
604 .rendered_html {color: black;}
605 .rendered_html em {font-style: italic;}
606 .rendered_html strong {font-weight: bold;}
607 .rendered_html u {text-decoration: underline;}
608 .rendered_html :link { text-decoration: underline }
609 .rendered_html :visited { text-decoration: underline }
610 .rendered_html h1 {font-size: 197%; margin: .65em 0; font-weight: bold;}
611 .rendered_html h2 {font-size: 153.9%; margin: .75em 0; font-weight: bold;}
612 .rendered_html h3 {font-size: 123.1%; margin: .85em 0; font-weight: bold;}
613 .rendered_html h4 {font-size: 100% margin: 0.95em 0; font-weight: bold;}
614 .rendered_html h5 {font-size: 85%; margin: 1.5em 0; font-weight: bold;}
615 .rendered_html h6 {font-size: 77%; margin: 1.65em 0; font-weight: bold;}
616 .rendered_html ul {list-style:disc; margin: 1em 2em;}
617 .rendered_html ul ul {list-style:square; margin: 0em 2em;}
618 .rendered_html ul ul ul {list-style:circle; margin-left: 0em 2em;}
619 .rendered_html ol {list-style:upper-roman; margin: 1em 2em;}
620 .rendered_html ol ol {list-style:upper-alpha; margin: 0em 2em;}
621 .rendered_html ol ol ol {list-style:decimal; margin: 0em 2em;}
622 .rendered_html ol ol ol ol {list-style:lower-alpha; margin: 0em 2em;}
623 .rendered_html ol ol ol ol ol {list-style:lower-roman; margin: 0em 2em;}
624
625 .rendered_html hr {
626 color: black;
627 background-color: black;
628 }
629
630 .rendered_html pre {
631 margin: 1em 2em;
632 }
633
634 .rendered_html blockquote {
635 margin: 1em 2em;
636 }
637
638 .rendered_html table {
639 border: 1px solid black;
640 border-collapse: collapse;
641 margin: 1em 2em;
642 }
643
644 .rendered_html td {
645 border: 1px solid black;
646 text-align: left;
647 vertical-align: middle;
648 padding: 4px;
649 }
650
651 .rendered_html th {
652 border: 1px solid black;
653 text-align: left;
654 vertical-align: middle;
655 padding: 4px;
656 font-weight: bold;
657 }
658
659 .rendered_html tr {
660 border: 1px solid black;
661 }
662
663 .rendered_html p + p {
664 margin-top: 1em;
665 }
666
667
668 </style>
9 </style>
669 <style type="text/css">
10 <style type="text/css">
670 /* Overrides of notebook CSS for static HTML export
11 /* Overrides of notebook CSS for static HTML export
General Comments 0
You need to be logged in to leave comments. Login now