Style images

This commit is contained in:
Jake Howard 2017-05-10 18:14:30 +01:00
parent 85f52065bc
commit d620bc52b0
3 changed files with 25 additions and 3 deletions

View file

@ -16,7 +16,22 @@ body.cover {
} }
} }
body, html {
$image_spacing: 30px;
body.content {
line-height: 1.5; line-height: 1.5;
font-size: 12px; font-size: 12px;
img {
width: 100%;
margin-top: $image_spacing
}
p.caption {
margin: 0 5px $image_spacing;
padding: 0;
font-style: italic;
}
} }

View file

@ -25,6 +25,13 @@ def add_base_tag(doc, config):
return soup.prettify() return soup.prettify()
def add_body_class(doc, config):
logger.debug("Adding Body Class...")
soup = BeautifulSoup(doc, 'html.parser')
soup.body['class'] = 'content'
return soup.prettify()
def render_template(html, config): def render_template(html, config):
logger.debug("Rendering Template...") logger.debug("Rendering Template...")
template = Template(html) template = Template(html)
@ -36,9 +43,9 @@ def parse_template(doc, config):
for parser in [ for parser in [
fix_references_title, fix_references_title,
add_base_tag, add_base_tag,
render_template add_body_class,
]: ]:
parsed_doc = parser(parsed_doc, config) parsed_doc = parser(parsed_doc, config)
return parsed_doc return render_template(parsed_doc, config)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 801 B