From 0b7a1346383abc8daffd8a39f14ec0dca21d9c16 2013-09-25 20:12:23 From: Brian E. Granger Date: 2013-09-25 20:12:23 Subject: [PATCH] Refactoring the center/left justify. --- diff --git a/IPython/html/static/notebook/js/mathjaxutils.js b/IPython/html/static/notebook/js/mathjaxutils.js index 016f76e..03ba1d4 100644 --- a/IPython/html/static/notebook/js/mathjaxutils.js +++ b/IPython/html/static/notebook/js/mathjaxutils.js @@ -25,7 +25,7 @@ IPython.mathjaxutils = (function (IPython) { processEscapes: true, processEnvironments: true }, - displayAlign: 'left', // Change this to 'center' to center equations. + displayAlign: 'center', // Change this to 'center' to center equations. "HTML-CSS": { styles: {'.MathJax_Display': {"margin": 0}} } diff --git a/IPython/html/static/notebook/less/outputarea.less b/IPython/html/static/notebook/less/outputarea.less index 225d3d7..378f311 100644 --- a/IPython/html/static/notebook/less/outputarea.less +++ b/IPython/html/static/notebook/less/outputarea.less @@ -3,6 +3,25 @@ div.output_area { padding: 0px; page-break-inside: avoid; .hbox(); + + .MathJax_Display { + // Inside a CodeCell, elements are left justified + text-align: left !important; + } + + .rendered_html { + // Inside a CodeCell, elements are left justified + table { + // Center tables horizontally + margin-left: 0; + margin-right: 0; + } + + img { + margin-left: 0; + margin-right: 0; + } + } } diff --git a/IPython/html/static/notebook/less/renderedhtml.less b/IPython/html/static/notebook/less/renderedhtml.less index ada2a8f..f78a653 100644 --- a/IPython/html/static/notebook/less/renderedhtml.less +++ b/IPython/html/static/notebook/less/renderedhtml.less @@ -1,4 +1,4 @@ -.rendered_html{ +.rendered_html { color: black; em {font-style: italic;} @@ -71,26 +71,22 @@ text-align: justify; } - p + p { - margin-top: 1em; + img { + display: block; + margin-left: auto; + margin-right: auto; } - p + table { + * + p { margin-top: 1em; } - table + p { + * + table { margin-top: 1em; } - - img { - display: block; - margin-left: auto; - margin-right: auto; - } - - .MathJax_Display { - text-align: center !important; + + * + img { + margin-top: 1em; } } diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css index ebf73d6..d324f8d 100644 --- a/IPython/html/static/style/ipython.min.css +++ b/IPython/html/static/style/ipython.min.css @@ -129,7 +129,9 @@ p{margin-bottom:0;} .end_space{height:200px;} #notification_area{z-index:10;} .notification_widget{color:#777777;padding:1px 12px;margin:2px 4px;z-index:10;border:1px solid #ccc;border-radius:4px;background:rgba(240, 240, 240, 0.5);} -div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;} +div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;}div.output_area .MathJax_Display{text-align:left !important;} +div.output_area .rendered_html table{margin-left:0;margin-right:0;} +div.output_area .rendered_html img{margin-left:0;margin-right:0;} div.output_area pre{font-family:monospace;margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline;color:black;background-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;line-height:inherit;} div.output_subarea{padding:0.44em 0.4em 0.4em 1px;margin-left:6px;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;} div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;} @@ -175,11 +177,10 @@ div.quickhelp{float:left;width:50%;} .rendered_html td,.rendered_html th{text-align:left;vertical-align:middle;padding:4px;} .rendered_html th{font-weight:bold;} .rendered_html p{text-align:justify;} -.rendered_html p+p{margin-top:1em;} -.rendered_html p+table{margin-top:1em;} -.rendered_html table+p{margin-top:1em;} .rendered_html img{display:block;margin-left:auto;margin-right:auto;} -.rendered_html .MathJax_Display{text-align:center !important;} +.rendered_html *+p{margin-top:1em;} +.rendered_html *+table{margin-top:1em;} +.rendered_html *+img{margin-top:1em;} span#save_widget{padding:0px 5px;margin-top:12px;} span#checkpoint_status,span#autosave_status{font-size:small;} @media (max-width:767px){span#save_widget{font-size:small;} span#checkpoint_status,span#autosave_status{font-size:x-small;}}@media (max-width:767px){span#checkpoint_status,span#autosave_status{display:none;}}@media (min-width:768px) and (max-width:979px){span#checkpoint_status{display:none;} span#autosave_status{font-size:x-small;}}div.text_cell{padding:5px 5px 5px 5px;} diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css index cd497a6..dbb8203 100644 --- a/IPython/html/static/style/style.min.css +++ b/IPython/html/static/style/style.min.css @@ -1510,7 +1510,9 @@ p{margin-bottom:0;} .end_space{height:200px;} #notification_area{z-index:10;} .notification_widget{color:#777777;padding:1px 12px;margin:2px 4px;z-index:10;border:1px solid #ccc;border-radius:4px;background:rgba(240, 240, 240, 0.5);} -div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;} +div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;}div.output_area .MathJax_Display{text-align:left !important;} +div.output_area .rendered_html table{margin-left:0;margin-right:0;} +div.output_area .rendered_html img{margin-left:0;margin-right:0;} div.output_area pre{font-family:monospace;margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline;color:black;background-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;line-height:inherit;} div.output_subarea{padding:0.44em 0.4em 0.4em 1px;margin-left:6px;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;} div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;} @@ -1556,11 +1558,10 @@ div.quickhelp{float:left;width:50%;} .rendered_html td,.rendered_html th{text-align:left;vertical-align:middle;padding:4px;} .rendered_html th{font-weight:bold;} .rendered_html p{text-align:justify;} -.rendered_html p+p{margin-top:1em;} -.rendered_html p+table{margin-top:1em;} -.rendered_html table+p{margin-top:1em;} .rendered_html img{display:block;margin-left:auto;margin-right:auto;} -.rendered_html .MathJax_Display{text-align:center !important;} +.rendered_html *+p{margin-top:1em;} +.rendered_html *+table{margin-top:1em;} +.rendered_html *+img{margin-top:1em;} span#save_widget{padding:0px 5px;margin-top:12px;} span#checkpoint_status,span#autosave_status{font-size:small;} @media (max-width:767px){span#save_widget{font-size:small;} span#checkpoint_status,span#autosave_status{font-size:x-small;}}@media (max-width:767px){span#checkpoint_status,span#autosave_status{display:none;}}@media (min-width:768px) and (max-width:979px){span#checkpoint_status{display:none;} span#autosave_status{font-size:x-small;}}div.text_cell{padding:5px 5px 5px 5px;}