List.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * XHTML 1.1 List Module, defines list-oriented elements. Core Module.
  4. */
  5. class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
  6. {
  7. public $name = 'List';
  8. // According to the abstract schema, the List content set is a fully formed
  9. // one or more expr, but it invariably occurs in an optional declaration
  10. // so we're not going to do that subtlety. It might cause trouble
  11. // if a user defines "List" and expects that multiple lists are
  12. // allowed to be specified, but then again, that's not very intuitive.
  13. // Furthermore, the actual XML Schema may disagree. Regardless,
  14. // we don't have support for such nested expressions without using
  15. // the incredibly inefficient and draconic Custom ChildDef.
  16. public $content_sets = array('Flow' => 'List');
  17. public function setup($config) {
  18. $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common');
  19. $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common');
  20. // XXX The wrap attribute is handled by MakeWellFormed. This is all
  21. // quite unsatisfactory, because we generated this
  22. // *specifically* for lists, and now a big chunk of the handling
  23. // is done properly by the List ChildDef. So actually, we just
  24. // want enough information to make autoclosing work properly,
  25. // and then hand off the tricky stuff to the ChildDef.
  26. $ol->wrap = 'li';
  27. $ul->wrap = 'li';
  28. $this->addElement('dl', 'List', 'Required: dt | dd', 'Common');
  29. $this->addElement('li', false, 'Flow', 'Common');
  30. $this->addElement('dd', false, 'Flow', 'Common');
  31. $this->addElement('dt', false, 'Inline', 'Common');
  32. }
  33. }
  34. // vim: et sw=4 sts=4