File indexing completed on 2024-05-12 06:02:05

0001 <?php
0002 
0003 /**
0004  * XHTML 1.1 List Module, defines list-oriented elements. Core Module.
0005  */
0006 class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
0007 {
0008     /**
0009      * @type string
0010      */
0011     public $name = 'List';
0012 
0013     // According to the abstract schema, the List content set is a fully formed
0014     // one or more expr, but it invariably occurs in an optional declaration
0015     // so we're not going to do that subtlety. It might cause trouble
0016     // if a user defines "List" and expects that multiple lists are
0017     // allowed to be specified, but then again, that's not very intuitive.
0018     // Furthermore, the actual XML Schema may disagree. Regardless,
0019     // we don't have support for such nested expressions without using
0020     // the incredibly inefficient and draconic Custom ChildDef.
0021 
0022     /**
0023      * @type array
0024      */
0025     public $content_sets = array('Flow' => 'List');
0026 
0027     /**
0028      * @param HTMLPurifier_Config $config
0029      */
0030     public function setup($config)
0031     {
0032         $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common');
0033         $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common');
0034         // XXX The wrap attribute is handled by MakeWellFormed.  This is all
0035         // quite unsatisfactory, because we generated this
0036         // *specifically* for lists, and now a big chunk of the handling
0037         // is done properly by the List ChildDef.  So actually, we just
0038         // want enough information to make autoclosing work properly,
0039         // and then hand off the tricky stuff to the ChildDef.
0040         $ol->wrap = 'li';
0041         $ul->wrap = 'li';
0042         $this->addElement('dl', 'List', 'Required: dt | dd', 'Common');
0043 
0044         $this->addElement('li', false, 'Flow', 'Common');
0045 
0046         $this->addElement('dd', false, 'Flow', 'Common');
0047         $this->addElement('dt', false, 'Inline', 'Common');
0048     }
0049 }
0050 
0051 // vim: et sw=4 sts=4