From b29d81ee2329d92a177bccab8ff8485042a37d68 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 9 Dec 2014 14:58:50 -0800 Subject: [PATCH 1/6] Add LESS that enables meta-p printing --- IPython/html/static/notebook/less/cell.less | 7 +++++++ IPython/html/static/notebook/less/codecell.less | 6 +++++- IPython/html/static/notebook/less/notebook.less | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/IPython/html/static/notebook/less/cell.less b/IPython/html/static/notebook/less/cell.less index ed4ad4a12..f24a868d5 100644 --- a/IPython/html/static/notebook/less/cell.less +++ b/IPython/html/static/notebook/less/cell.less @@ -21,6 +21,13 @@ div.cell { outline: none; } +/* Don't border the cells when printing */ +@media print { + div.cell { + border-color: transparent !important; + } +} + div.prompt { /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ min-width: 15ex; diff --git a/IPython/html/static/notebook/less/codecell.less b/IPython/html/static/notebook/less/codecell.less index 983e97ab0..97a34ba5e 100644 --- a/IPython/html/static/notebook/less/codecell.less +++ b/IPython/html/static/notebook/less/codecell.less @@ -1,4 +1,8 @@ -div.code_cell { +/* avoid page breaking on code cells when printing */ +@media print { + div.code_cell { + page-break-inside: avoid; + } } /* any special styling for code cells that are currently running goes here */ diff --git a/IPython/html/static/notebook/less/notebook.less b/IPython/html/static/notebook/less/notebook.less index 58ac2df88..a4727fbe4 100644 --- a/IPython/html/static/notebook/less/notebook.less +++ b/IPython/html/static/notebook/less/notebook.less @@ -91,3 +91,10 @@ p { .notebook_app #header { .box-shadow(@notebook-shadow); } + +/* Hide the header when printing */ +@media print { + #header, #header-spacer { + display: none !important; + } +} From bf18e0952196bf9b4fce758013a9a8e268fcd614 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 9 Dec 2014 14:59:19 -0800 Subject: [PATCH 2/6] invoke css --- IPython/html/static/style/ipython.min.css | 12 ++++++++++++ IPython/html/static/style/style.min.css | 23 +++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css index e809946b7..e3fd860fd 100644 --- a/IPython/html/static/style/ipython.min.css +++ b/IPython/html/static/style/ipython.min.css @@ -367,6 +367,12 @@ div.cell.selected { div.cell.edit_mode { border-color: green; } +/* Don't border the cells when printing */ +@media print { + div.cell { + border-color: transparent !important; + } +} div.prompt { /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ min-width: 15ex; @@ -457,6 +463,12 @@ div.unrecognized_cell .inner_cell a:hover { display: none; } } +/* avoid page breaking on code cells when printing */ +@media print { + div.code_cell { + page-break-inside: avoid; + } +} /* any special styling for code cells that are currently running goes here */ div.input { page-break-inside: avoid; diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css index 4a59dd8ba..eec705eac 100644 --- a/IPython/html/static/style/style.min.css +++ b/IPython/html/static/style/style.min.css @@ -7752,9 +7752,6 @@ div#header { /* Initially hidden to prevent FLOUC */ display: none; background-color: #ffffff; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; /* Display over codemirror */ z-index: 100; } @@ -8210,6 +8207,12 @@ div.cell.selected { div.cell.edit_mode { border-color: green; } +/* Don't border the cells when printing */ +@media print { + div.cell { + border-color: transparent !important; + } +} div.prompt { /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ min-width: 15ex; @@ -8300,6 +8303,12 @@ div.unrecognized_cell .inner_cell a:hover { display: none; } } +/* avoid page breaking on code cells when printing */ +@media print { + div.code_cell { + page-break-inside: avoid; + } +} /* any special styling for code cells that are currently running goes here */ div.input { page-break-inside: avoid; @@ -9495,6 +9504,13 @@ p { -webkit-box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25); box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25); } +/* Hide the header when printing */ +@media print { + #header, + #header-spacer { + display: none !important; + } +} /* CSS for the cell toolbar */ .celltoolbar { border: thin solid #CFCFCF; @@ -9681,7 +9697,6 @@ fieldset[disabled] #kernel_selector_widget > button.active { margin-top: 0px; } #menubar { - margin-top: 0px; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; From f497d06d0cc4d342011415bc7042cda2780a03ca Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Wed, 10 Dec 2014 10:43:51 -0800 Subject: [PATCH 3/6] Avoid using important --- IPython/html/static/notebook/less/cell.less | 15 ++++++++------- IPython/html/static/notebook/less/codecell.less | 6 +++--- IPython/html/static/notebook/less/notebook.less | 7 +++++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/IPython/html/static/notebook/less/cell.less b/IPython/html/static/notebook/less/cell.less index f24a868d5..448c570b6 100644 --- a/IPython/html/static/notebook/less/cell.less +++ b/IPython/html/static/notebook/less/cell.less @@ -8,10 +8,18 @@ div.cell { &.selected { border-color: @border_color; + /* Don't border the cells when printing */ + @media print { + border-color: transparent; + } } &.edit_mode { border-color: green; + /* Don't border the cells when printing */ + @media print { + border-color: transparent; + } } width: 100%; @@ -21,13 +29,6 @@ div.cell { outline: none; } -/* Don't border the cells when printing */ -@media print { - div.cell { - border-color: transparent !important; - } -} - div.prompt { /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ min-width: 15ex; diff --git a/IPython/html/static/notebook/less/codecell.less b/IPython/html/static/notebook/less/codecell.less index 97a34ba5e..accead851 100644 --- a/IPython/html/static/notebook/less/codecell.less +++ b/IPython/html/static/notebook/less/codecell.less @@ -1,6 +1,6 @@ -/* avoid page breaking on code cells when printing */ -@media print { - div.code_cell { +div.code_cell { + /* avoid page breaking on code cells when printing */ + @media print { page-break-inside: avoid; } } diff --git a/IPython/html/static/notebook/less/notebook.less b/IPython/html/static/notebook/less/notebook.less index a4727fbe4..823f6e5ee 100644 --- a/IPython/html/static/notebook/less/notebook.less +++ b/IPython/html/static/notebook/less/notebook.less @@ -90,11 +90,14 @@ p { .notebook_app #header { .box-shadow(@notebook-shadow); + @media print { + display: none; + } } /* Hide the header when printing */ @media print { - #header, #header-spacer { - display: none !important; + #header-spacer { + display: none; } } From d58d3a65a32e393a83eb629cf879727ef71dc4b7 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Wed, 10 Dec 2014 10:44:23 -0800 Subject: [PATCH 4/6] invoke css --- IPython/html/static/style/ipython.min.css | 16 +++++++++++---- IPython/html/static/style/style.min.css | 24 +++++++++++++++++------ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css index e3fd860fd..8fd97a0a0 100644 --- a/IPython/html/static/style/ipython.min.css +++ b/IPython/html/static/style/ipython.min.css @@ -363,14 +363,20 @@ div.cell { } div.cell.selected { border-color: #ababab; + /* Don't border the cells when printing */ +} +@media print { + div.cell.selected { + border-color: transparent; + } } div.cell.edit_mode { border-color: green; + /* Don't border the cells when printing */ } -/* Don't border the cells when printing */ @media print { - div.cell { - border-color: transparent !important; + div.cell.edit_mode { + border-color: transparent; } } div.prompt { @@ -463,7 +469,9 @@ div.unrecognized_cell .inner_cell a:hover { display: none; } } -/* avoid page breaking on code cells when printing */ +div.code_cell { + /* avoid page breaking on code cells when printing */ +} @media print { div.code_cell { page-break-inside: avoid; diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css index eec705eac..17878a06e 100644 --- a/IPython/html/static/style/style.min.css +++ b/IPython/html/static/style/style.min.css @@ -8203,14 +8203,20 @@ div.cell { } div.cell.selected { border-color: #ababab; + /* Don't border the cells when printing */ +} +@media print { + div.cell.selected { + border-color: transparent; + } } div.cell.edit_mode { border-color: green; + /* Don't border the cells when printing */ } -/* Don't border the cells when printing */ @media print { - div.cell { - border-color: transparent !important; + div.cell.edit_mode { + border-color: transparent; } } div.prompt { @@ -8303,7 +8309,9 @@ div.unrecognized_cell .inner_cell a:hover { display: none; } } -/* avoid page breaking on code cells when printing */ +div.code_cell { + /* avoid page breaking on code cells when printing */ +} @media print { div.code_cell { page-break-inside: avoid; @@ -9504,11 +9512,15 @@ p { -webkit-box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25); box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25); } +@media print { + .notebook_app #header { + display: none; + } +} /* Hide the header when printing */ @media print { - #header, #header-spacer { - display: none !important; + display: none; } } /* CSS for the cell toolbar */ From bdb0e9dd7a6c58d9827fa7cd80b13300692deba3 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Wed, 10 Dec 2014 10:50:41 -0800 Subject: [PATCH 5/6] Move header styles into base less --- IPython/html/static/base/less/page.less | 8 ++++++++ IPython/html/static/notebook/less/notebook.less | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/IPython/html/static/base/less/page.less b/IPython/html/static/base/less/page.less index e37e4cb84..56cc52fda 100644 --- a/IPython/html/static/base/less/page.less +++ b/IPython/html/static/base/less/page.less @@ -37,11 +37,19 @@ div#header { height: 0px; border-bottom: 1px solid @navbar-default-border; } + + @media print { + display: none !important; + } } #header-spacer { width: 100%; visibility: hidden; + + @media print { + display: none; + } } #ipython_notebook { diff --git a/IPython/html/static/notebook/less/notebook.less b/IPython/html/static/notebook/less/notebook.less index 823f6e5ee..58ac2df88 100644 --- a/IPython/html/static/notebook/less/notebook.less +++ b/IPython/html/static/notebook/less/notebook.less @@ -90,14 +90,4 @@ p { .notebook_app #header { .box-shadow(@notebook-shadow); - @media print { - display: none; - } -} - -/* Hide the header when printing */ -@media print { - #header-spacer { - display: none; - } } From 4842d48acefa55677d3571bca50e87135b6683a2 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Wed, 10 Dec 2014 10:51:00 -0800 Subject: [PATCH 6/6] invoke css --- IPython/html/static/style/style.min.css | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css index 17878a06e..33ccf92cb 100644 --- a/IPython/html/static/style/style.min.css +++ b/IPython/html/static/style/style.min.css @@ -7768,10 +7768,20 @@ div#header .header-bar { height: 0px; border-bottom: 1px solid #e7e7e7; } +@media print { + div#header { + display: none !important; + } +} #header-spacer { width: 100%; visibility: hidden; } +@media print { + #header-spacer { + display: none; + } +} #ipython_notebook { padding-left: 0px; padding-top: 3px; @@ -9512,17 +9522,6 @@ p { -webkit-box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25); box-shadow: 1px 4px 9px -6px rgba(0, 0, 0, 0.25); } -@media print { - .notebook_app #header { - display: none; - } -} -/* Hide the header when printing */ -@media print { - #header-spacer { - display: none; - } -} /* CSS for the cell toolbar */ .celltoolbar { border: thin solid #CFCFCF;