def setup_class(self): self.path = tempfile.mkdtemp(dir='.') os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') with open('layouts/atom.xml', 'w') as fp: fp.write( "{% for entry in env.entrylist %}\n{{ entry.content ~ '\n' }}\n{% endfor %}" ) self.conf = conf self.env = utils.Struct({ 'options': options, 'globals': utils.Struct() }) self.conf['filters'] = ['Markdown', 'h1'] self.conf['views'] = { '/:year/:slug/': { 'view': 'entry' }, '/atom.xml': { 'view': 'Atom', 'filters': ['h2', 'summarize+2'] } }
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') with open('layouts/atom.xml', 'w') as fp: fp.write( "{% for entry in env.entrylist %}\n{{ entry.content ~ '\n' }}\n{% endfor %}" ) self.conf = core.Configuration(conf) self.env = core.Environment({ 'options': options, 'globals': utils.Struct() }) self.conf['filters'] = ['Markdown', 'h1'] self.conf['views'] = { '/:year/:slug/': { 'view': 'entry' }, '/atom.xml': { 'view': 'Atom', 'filters': ['h2', 'summarize+2'] } } yield
def setup_class(self): self.path = tempfile.mkdtemp(dir='.') os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') self.conf = conf self.env = utils.Struct({ 'options': options, 'globals': utils.Struct() }) self.conf['filters'] = ['HTML'] self.conf['views'] = {'/:year/:slug/': {'view': 'entry'}}
def __context__(self): with attest.tempdir() as path: self.path = path os.chdir(self.path) os.mkdir('content/') os.mkdir('layouts/') with open('layouts/main.html', 'w') as fp: fp.write('{{ env.entrylist[0].content }}\n') self.conf = core.Configuration(conf) self.env = core.Environment({'options': options, 'globals': utils.Struct()}) self.conf['filters'] = ['HTML'] self.conf['views'] = {'/:year/:slug/': {'view': 'entry'}} yield
# -*- coding: utf-8 -*- from acrylamid import log, utils, core from acrylamid.filters import initialize, get_filters import attest tt = attest.Tests() log.init('foo', 35) conf = core.Configuration({'lang': 'en', 'theme': ''}) env = utils.Struct({ 'path': '', 'engine': None, 'options': type('X', (), {'ignore': False}) }) initialize([], conf, env) # now we have filters in path from acrylamid.filters.hyphenation import build class Entry(object): permalink = '/foo/' def __init__(self, lang='en'): self.lang = lang