Skip to content

Commit

Permalink
Merge pull request #1 from cityofaustin/pdf-prep
Browse files Browse the repository at this point in the history
Add support for PDF generation
  • Loading branch information
mattlangan authored Oct 28, 2019
2 parents e5b241c + cda3463 commit e2188cf
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
48 changes: 48 additions & 0 deletions _layouts/pdf.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<title>{{ site.title }}</title>
<meta name="robots" content="noindex">
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,maximum-scale=2">
<link rel="stylesheet" href="https://use.typekit.net/xtb6utt.css">
<link rel="stylesheet" type="text/css" media="all" href="{{ '/assets/css/print.css?v=' | append: site.github.build_revision | relative_url }}">
</head>
<body>
<main id="main_content" class="pdf-content">
<h1 style="text-align: center;">{{ site.title }}</h1>

<!-- Index page content -->
{%- assign homepage = site.pages | where:'title', 'Homepage' | first -%}
{{ homepage.content | markdownify }}

<!-- Content Sections -->
{%- assign sections = site.collections | sort: 'section_order' -%}
{%- for collection in sections -%}
{%- if collection.label != 'posts' -%}
<section>
{% assign items = collection.docs | sort: "order" %}
{% for item in items %}
{%- if item == items.first -%}
<h1>
<span>{{ collection.section_order }}</span>
{{ item.title }}
</h1>
{%- else -%}
<h2>
<span>{{ collection.section_order}}.{{forloop.index | minus: 1}}</span>
{{ item.title }}
</h2>
{%- endif -%}
{{ item.content | markdownify }}
{% endfor %}
</section>
{%- endif -%}
{%- endfor -%}
<section>
<a href="{{site.url}}">{{site.url}}</a>
</section>
</main>
</body>
</html>
45 changes: 45 additions & 0 deletions _sass/_print.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
html {
font-size: 14px;
}

header, nav, footer, #skip_nav_link {
display: none;
}

main {
padding: 1em;
}

.pdf-content {
font-family: 'Times New Roman', serif;

section {
border-bottom: 1px solid gray;

> * {
margin-left: 30px;
}

> h1 {
margin-left: 0;
}

h1, h2 {
span {
display: inline-block;
font-size: 1em;
margin-right: .2em;
padding: 0 .5em;
}
}
h1 span {
background-color: #f2f2f2;
}
h2 span {
border-left: 3px solid lightgray;
}
&:last-child {
border-bottom: none;
padding-top: 2em;
text-align: center;
}
}

li {
margin-left: 1em;
}

}

0 comments on commit e2188cf

Please sign in to comment.