Add page breaks when needed

This commit is contained in:
Jake Howard 2017-05-10 20:52:00 +01:00
parent 8e5f6d512a
commit a072017525
2 changed files with 10 additions and 0 deletions

View file

@ -27,12 +27,21 @@ body.content {
img { img {
margin-top: $image-spacing; margin-top: $image-spacing;
width: 100%; width: 100%;
page-break-after: avoid;
} }
p.caption { p.caption {
margin: 1px 5px $image-spacing; margin: 1px 5px $image-spacing;
padding: 0; padding: 0;
font-style: italic; font-style: italic;
page-break-before: avoid;
} }
.references-title {
page-break-after: avoid;
}
h1, h2, h3, h4, h5, h6 {
page-break-after: avoid;
}
} }

View file

@ -12,6 +12,7 @@ def fix_references_title(content, config):
reference_element = soup.find('div', class_='references') reference_element = soup.find('div', class_='references')
if reference_element is not None: if reference_element is not None:
title = soup.new_tag('h1') title = soup.new_tag('h1')
title['class'] = 'references-title'
title.string = "References" title.string = "References"
reference_element.insert_before(title) reference_element.insert_before(title)
return soup.prettify() return soup.prettify()