def gen_css(): dist_file = 'portfolio.css' # put 'style.css' first # otherwise @import will not be valid CSS src_files = ['style.css', 'colors.css', 'sizes.css'] css = "/* %s generated from %s */\n" % (dist_file, src_files) for css_file in src_files: css += read_file(src_dir + 'style/' + css_file) return css
def to_html(self, inline=False): if inline: img = read_file(dist_dir + self.src, 'b') src = data_url(img).strip() else: src = self.src html = tile_template.format(featured_tile_href=self.href, featured_tile_alt=self.alt, featured_tile_src=src) return html
def to_html(self, inline=False): if inline: img = read_file(dist_dir + self.src, 'b') src = data_url(img).strip() else: src = self.src html = tile_template.format( featured_tile_href = self.href, featured_tile_alt = self.alt, featured_tile_src = src ) return html
#!/usr/bin/env python import os import sys portfolio_root = os.getcwd() sys.path.append(portfolio_root + '/python') from portfolio_util import read_file, write_file, data_url, indent dist_dir = portfolio_root + '/dist/' src_dir = portfolio_root + '/src/' template_dir = portfolio_root + '/src/templates/' tile_template = read_file(template_dir + 'tile_template.html') page_template = read_file(template_dir + 'page_template.html') class Featured_Tile: def __init__(self, href, src, alt): self.href = href self.src = src self.alt = alt def to_html(self, inline=False): if inline: img = read_file(dist_dir + self.src, 'b') src = data_url(img).strip() else: src = self.src html = tile_template.format( featured_tile_href = self.href,
#!/usr/bin/env python import os import sys portfolio_root = os.getcwd() sys.path.append(portfolio_root + '/python') from portfolio_util import read_file, write_file, data_url, indent dist_dir = portfolio_root + '/dist/' src_dir = portfolio_root + '/src/' template_dir = portfolio_root + '/src/templates/' tile_template = read_file(template_dir + 'tile_template.html') page_template = read_file(template_dir + 'page_template.html') class Featured_Tile: def __init__(self, href, src, alt): self.href = href self.src = src self.alt = alt def to_html(self, inline=False): if inline: img = read_file(dist_dir + self.src, 'b') src = data_url(img).strip() else: src = self.src html = tile_template.format(featured_tile_href=self.href, featured_tile_alt=self.alt,