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.
 
 
 

48 lines
1.1 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 TestSyntext(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_syntext(self):
  20. text = u"""
  21. ~~~~~~~~css~~~~~~~
  22. .body{
  23. background-color: white;
  24. }
  25. ~~~~~~~~~~~~~~~~~~
  26. """
  27. site = Site(TEST_SITE)
  28. site.config.plugins = [
  29. 'hyde.ext.plugins.meta.MetaPlugin',
  30. 'hyde.ext.plugins.text.SyntextPlugin']
  31. syn = File(site.content.source_folder.child('syn.html'))
  32. syn.write(text)
  33. gen = Generator(site)
  34. gen.generate_all()
  35. f = File(site.config.deploy_root_path.child(syn.name))
  36. assert f.exists
  37. html = f.read_all()
  38. assert html
  39. q = PyQuery(html)
  40. assert q('figure.code').length == 1