A fork of hyde, the static site generation. Some patches will be pushed upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. """
  3. Use nose
  4. `$ pip install nose`
  5. `$ nosetests`
  6. """
  7. from hyde.generator import Generator
  8. from hyde.site import Site
  9. from fswrap import File
  10. from pyquery import PyQuery
  11. TEST_SITE = File(__file__).parent.parent.child_folder('_test')
  12. class TestBlockdown(object):
  13. def setUp(self):
  14. TEST_SITE.make()
  15. TEST_SITE.parent.child_folder(
  16. 'sites/test_jinja').copy_contents_to(TEST_SITE)
  17. def tearDown(self):
  18. TEST_SITE.delete()
  19. def test_can_parse_blockdown(self):
  20. s = Site(TEST_SITE)
  21. s.config.plugins = ['hyde.ext.plugins.text.BlockdownPlugin']
  22. txt = ("This template tests to make sure blocks can be replaced"
  23. "with markdownish syntax.")
  24. templ = """
  25. {%% extends "base.html" %%}
  26. =====title========
  27. %s
  28. ====/title========"""
  29. content = (templ.strip() % txt).strip()
  30. bd = File(TEST_SITE.child('content/blockdown.html'))
  31. bd.write(content)
  32. gen = Generator(s)
  33. gen.generate_resource_at_path(bd.path)
  34. res = s.content.resource_from_path(bd.path)
  35. target = File(
  36. s.config.deploy_root_path.child(res.relative_deploy_path))
  37. assert target.exists
  38. text = target.read_all()
  39. q = PyQuery(text)
  40. assert q('title').text().strip() == txt.strip()