Skip to content

Commit

Permalink
Improved export print stylesheet
Browse files Browse the repository at this point in the history
* keep headers with bodies
* use pure CSS to break document into vulnerability type sections
* reduce background colors
* set foreground colors to mostly black
* paper does not support scrollbars in 2016, so just display the entire
  block of text
  • Loading branch information
stash-sfdc committed Nov 19, 2016
1 parent b6bb107 commit 0e07c7c
Showing 1 changed file with 82 additions and 2 deletions.
84 changes: 82 additions & 2 deletions exportTemplates/default.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@
body{
background-color: #e5e5e5;
color: #F0F1F2;
font-family: Arial, Helvetica, sans-serif;
font-family: Arial, Helvetica, sans-serif;
}

@media print {
body{
background-color: #fff;
color: #000;
}

h1, h2, h3, h4, h5{
page-break-after: avoid; /* keep headers with bodies */
}
}

a:link, a:visited, a:active{
Expand All @@ -18,6 +29,12 @@
color: #a5cfe7;
}

@media print {
a:link, a:visited, a:active, a:hover{
color: #000;
}
}

.strongP{
font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
font-weight: 600;
Expand All @@ -31,6 +48,13 @@
padding: 12px;
}

@media print {
.container{
background-color: #fff;
color: #000;
}
}

.header{
width: 900px;
height: 60px;
Expand All @@ -47,6 +71,12 @@
font-size: 22px;
}

@media print {
.header{
margin: 0;
}
}

.typeHeader{
width: 900px;
height: 30px;
Expand All @@ -64,6 +94,14 @@
left: -12px;
}

@media print {
.typeHeader{
margin: 0;
page-break-after: avoid; /* keep headers with bodies */
page-break-before: always; /* force types onto new page */
}
}

.vulnDescrip{
font-size: 10pt;
}
Expand Down Expand Up @@ -92,6 +130,16 @@
font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
}

@media print {
/* keep headers with bodies */
.findingHeader, .sectHeader{
page-break-after: avoid;
}
.finding, .sectBody{
page-break-before: avoid;
}
}

.code{
font-family: Consolas, Arial, Sans-Serif;
font-size: 10pt;
Expand All @@ -116,6 +164,20 @@
word-wrap: break-word; /* Internet Explorer 5.5+ */
}

@media print {
.code {
/* paper can't scroll: */
overflow-y: unset;
overflow-x: unset;
max-height: none;
/* same as 'pre': */
word-wrap: break-word;
/* try to keep it contiguous and with header: */
page-break-inside: avoid;
page-break-before: avoid;
}
}

.footer{
width: 900px;
margin: 0 auto;
Expand All @@ -128,6 +190,13 @@
text-align: center;
}

@media print {
.footer{
page-break-inside: avoid;
background-color: #e5e5e5;
}
}

hr{
border: 0;
height: 1px;
Expand All @@ -152,6 +221,18 @@
font-size: 10pt;
word-wrap: break-word;
}

@media print {
ol.vulns{
page-break-before: avoid; /* keep with opening text */
}
ol.toc > li{
page-break-inside: avoid; /* try to keep each TOC entry contig. */
}
ol.vulns > li{
page-break-before: avoid; /* keep with ol "header" */
}
}
</style>
</head>

Expand Down Expand Up @@ -201,7 +282,6 @@
<div class="typeHeader">
<a id='vuln<%=count%>'><%=h(v.type_str)%></a>
</div>
<div style='page-break-before:always;'></div>

<% if !v.type_html.nil? %>
<h3>Issue Description</h3>
Expand Down

0 comments on commit 0e07c7c

Please sign in to comment.