From 2fd8ab24013bca83719588976eaaa60c4e740d42 2014-04-05 20:27:29 From: MinRK Date: 2014-04-05 20:27:29 Subject: [PATCH] cleanup some `pre` css inheritance We had various overrides of the bootstrap defaults for font-size and line-height every time we made a pre tag, and then some overrides of our overrides when we wanted something slightly different. This moves the most basic overrides to apply to all pre tags, reducing the number of downstream changes we need. --- diff --git a/IPython/html/static/base/less/variables.less b/IPython/html/static/base/less/variables.less index ac93c19..08449c4 100644 --- a/IPython/html/static/base/less/variables.less +++ b/IPython/html/static/base/less/variables.less @@ -9,5 +9,12 @@ code { color: @black; // default code color in bootstrap is #d14 (crimson / amaranth) } +pre { + // bootstrap has pre defaults that we don't want to inherit. + // start pre tag defaults based on the surrounding context instead. + font-size: inherit; + line-height: inherit; +} + // Our own global variables for all pages go here diff --git a/IPython/html/static/notebook/less/cell.less b/IPython/html/static/notebook/less/cell.less index 3cecbdf..b3ba7e0 100644 --- a/IPython/html/static/notebook/less/cell.less +++ b/IPython/html/static/notebook/less/cell.less @@ -51,6 +51,7 @@ div.input_area { border: 1px solid @light_border_color; .corner-all; background: @cell_background; + line-height: @code_line_height; } /* This is needed so that empty prompt areas can collapse to zero height when there diff --git a/IPython/html/static/notebook/less/codecell.less b/IPython/html/static/notebook/less/codecell.less index 8fc60b5..67c8c21 100644 --- a/IPython/html/static/notebook/less/codecell.less +++ b/IPython/html/static/notebook/less/codecell.less @@ -37,10 +37,8 @@ div.input_area > div.highlight { div.input_area > div.highlight > pre { margin: 0px; - border: 0px; + border: none; padding: 0px; background-color: transparent; - font-size: @notebook_font_size; - line-height: @code_line_height; } diff --git a/IPython/html/static/notebook/less/outputarea.less b/IPython/html/static/notebook/less/outputarea.less index 5dd1614..8bb5852 100644 --- a/IPython/html/static/notebook/less/outputarea.less +++ b/IPython/html/static/notebook/less/outputarea.less @@ -83,12 +83,10 @@ div.output_area pre { margin: 0; padding: 0; border: 0; - font-size: 100%; vertical-align: baseline; color: black; background-color: transparent; .border-radius(0); - line-height: inherit; } /* This class is for the output subarea inside the output_area and after diff --git a/IPython/html/static/notebook/less/pager.less b/IPython/html/static/notebook/less/pager.less index 961550a..8bd3930 100644 --- a/IPython/html/static/notebook/less/pager.less +++ b/IPython/html/static/notebook/less/pager.less @@ -14,7 +14,6 @@ div#pager { display: none; pre { - font-size: @baseFontSize; line-height: @code_line_height; color: @textColor; background-color: @cell_background; diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css index 4623293..9760981 100644 --- a/IPython/html/static/style/ipython.min.css +++ b/IPython/html/static/style/ipython.min.css @@ -3,6 +3,7 @@ .hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0} .input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box} code{color:#000} +pre{font-size:inherit;line-height:inherit} .border-box-sizing{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box} .corner-all{border-radius:4px} .hbox{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;display:flex;flex-direction:row;align-items:stretch} @@ -74,12 +75,12 @@ div.cell.edit_mode{border-radius:4px;border:thin #008000 solid} div.cell{width:100%;padding:5px 5px 5px 0;margin:0;outline:none} div.prompt{min-width:11ex;padding:.4em;margin:0;font-family:monospace;text-align:right;line-height:1.21429em} @media (max-width:480px){div.prompt{text-align:left}}div.inner_cell{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1} -div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7} +div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7;line-height:1.21429em} div.prompt:empty{padding-top:0;padding-bottom:0} div.input{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;display:flex;flex-direction:row;align-items:stretch} @media (max-width:480px){div.input{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.input_prompt{color:#000080;border-top:1px solid transparent} div.input_area>div.highlight{margin:.4em;border:none;padding:0;background-color:transparent} -div.input_area>div.highlight>pre{margin:0;border:0;padding:0;background-color:transparent;font-size:14px;line-height:1.21429em} +div.input_area>div.highlight>pre{margin:0;border:none;padding:0;background-color:transparent} .CodeMirror{line-height:1.21429em;height:auto;background:none;} .CodeMirror-scroll{overflow-y:hidden;overflow-x:auto} @-moz-document url-prefix(){.CodeMirror-scroll{overflow-x:hidden}}.CodeMirror-lines{padding:.4em} @@ -117,7 +118,7 @@ div.output_area{padding:0;page-break-inside:avoid;display:-webkit-box;-webkit-bo div.output_area .rendered_html table{margin-left:0;margin-right:0} div.output_area .rendered_html img{margin-left:0;margin-right:0} .output{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch} -@media (max-width:480px){div.output_area{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.output_area pre{margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline;color:#000;background-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;line-height:inherit} +@media (max-width:480px){div.output_area{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.output_area pre{margin:0;padding:0;border:0;vertical-align:baseline;color:#000;background-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0} div.output_subarea{padding:.4em .4em 0 .4em;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1} div.output_text{text-align:left;color:#000;line-height:1.21429em} div.output_stderr{background:#fdd;} diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css index 749fb5f..dcc054d 100644 --- a/IPython/html/static/style/style.min.css +++ b/IPython/html/static/style/style.min.css @@ -1266,6 +1266,7 @@ a .icon-rotate-90:before,a .icon-rotate-180:before,a .icon-rotate-270:before,a . .icon-weibo:before{content:"\f18a"} .icon-renren:before{content:"\f18b"} code{color:#000} +pre{font-size:inherit;line-height:inherit} .border-box-sizing{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box} .corner-all{border-radius:4px} .hbox{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;display:flex;flex-direction:row;align-items:stretch} @@ -1351,12 +1352,12 @@ div.cell.edit_mode{border-radius:4px;border:thin #008000 solid} div.cell{width:100%;padding:5px 5px 5px 0;margin:0;outline:none} div.prompt{min-width:11ex;padding:.4em;margin:0;font-family:monospace;text-align:right;line-height:1.21429em} @media (max-width:480px){div.prompt{text-align:left}}div.inner_cell{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1} -div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7} +div.input_area{border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7;line-height:1.21429em} div.prompt:empty{padding-top:0;padding-bottom:0} div.input{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;display:flex;flex-direction:row;align-items:stretch} @media (max-width:480px){div.input{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.input_prompt{color:#000080;border-top:1px solid transparent} div.input_area>div.highlight{margin:.4em;border:none;padding:0;background-color:transparent} -div.input_area>div.highlight>pre{margin:0;border:0;padding:0;background-color:transparent;font-size:14px;line-height:1.21429em} +div.input_area>div.highlight>pre{margin:0;border:none;padding:0;background-color:transparent} .CodeMirror{line-height:1.21429em;height:auto;background:none;} .CodeMirror-scroll{overflow-y:hidden;overflow-x:auto} @-moz-document url-prefix(){.CodeMirror-scroll{overflow-x:hidden}}.CodeMirror-lines{padding:.4em} @@ -1394,7 +1395,7 @@ div.output_area{padding:0;page-break-inside:avoid;display:-webkit-box;-webkit-bo div.output_area .rendered_html table{margin-left:0;margin-right:0} div.output_area .rendered_html img{margin-left:0;margin-right:0} .output{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch} -@media (max-width:480px){div.output_area{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.output_area pre{margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline;color:#000;background-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;line-height:inherit} +@media (max-width:480px){div.output_area{display:-webkit-box;-webkit-box-orient:vertical;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:vertical;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.output_area pre{margin:0;padding:0;border:0;vertical-align:baseline;color:#000;background-color:transparent;border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0} div.output_subarea{padding:.4em .4em 0 .4em;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1} div.output_text{text-align:left;color:#000;line-height:1.21429em} div.output_stderr{background:#fdd;} @@ -1515,7 +1516,7 @@ ul#help_menu li a{overflow:hidden;padding-right:2.2em}ul#help_menu li a i{margin .notification_widget{color:#777;padding:1px 12px;margin:2px 4px;z-index:10;border:1px solid #ccc;border-radius:4px;background:rgba(240,240,240,0.5)}.notification_widget.span{padding-right:2px} div#pager_splitter{height:8px} #pager-container{position:relative;padding:15px 0} -div#pager{font-size:14px;line-height:20px;overflow:auto;display:none}div#pager pre{font-size:13px;line-height:1.21429em;color:#000;background-color:#f7f7f7;padding:.4em} +div#pager{font-size:14px;line-height:20px;overflow:auto;display:none}div#pager pre{line-height:1.21429em;color:#000;background-color:#f7f7f7;padding:.4em} .quickhelp{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;display:flex;flex-direction:row;align-items:stretch} .shortcut_key{display:inline-block;width:20ex;text-align:right;font-family:monospace} .shortcut_descr{display:inline-block;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1}