HamlCompressedRenderer.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /* SVN FILE: $Id: HamlCompressedRenderer.php 74 2010-04-20 12:20:29Z chris.l.yates $ */
  3. /**
  4. * HamlCompressedRenderer class file.
  5. * @author Chris Yates <chris.l.yates@gmail.com>
  6. * @copyright Copyright (c) 2010 PBM Web Development
  7. * @license http://phamlp.googlecode.com/files/license.txt
  8. * @package PHamlP
  9. * @subpackage Haml.renderers
  10. */
  11. /**
  12. * HamlCompressedRenderer class.
  13. * Output has minimal whitespace.
  14. * @package PHamlP
  15. * @subpackage Haml.renderers
  16. */
  17. class HamlCompressedRenderer extends HamlRenderer {
  18. /**
  19. * Renders the opening of a comment.
  20. * Only conditional comments are rendered
  21. */
  22. public function renderOpenComment($node) {
  23. if ($node->isConditional) return parent::renderOpenComment($node);
  24. }
  25. /**
  26. * Renders the closing of a comment.
  27. * Only conditional comments are rendered
  28. */
  29. public function renderCloseComment($node) {
  30. if ($node->isConditional) return parent::renderCloseComment($node);
  31. }
  32. /**
  33. * Renders the opening tag of an element
  34. */
  35. public function renderOpeningTag($node) {
  36. return ($node->isBlock ? '' : ' ') . parent::renderOpeningTag($node);
  37. }
  38. /**
  39. * Renders the closing tag of an element
  40. */
  41. public function renderClosingTag($node) {
  42. return parent::renderClosingTag($node) . ($node->isBlock ? '' : ' ');
  43. }
  44. }