Ruby.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * XHTML 1.1 Ruby Annotation Module, defines elements that indicate
  4. * short runs of text alongside base text for annotation or pronounciation.
  5. */
  6. class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule
  7. {
  8. /**
  9. * @type string
  10. */
  11. public $name = 'Ruby';
  12. /**
  13. * @param HTMLPurifier_Config $config
  14. */
  15. public function setup($config)
  16. {
  17. $this->addElement(
  18. 'ruby',
  19. 'Inline',
  20. 'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))',
  21. 'Common'
  22. );
  23. $this->addElement('rbc', false, 'Required: rb', 'Common');
  24. $this->addElement('rtc', false, 'Required: rt', 'Common');
  25. $rb = $this->addElement('rb', false, 'Inline', 'Common');
  26. $rb->excludes = array('ruby' => true);
  27. $rt = $this->addElement('rt', false, 'Inline', 'Common', array('rbspan' => 'Number'));
  28. $rt->excludes = array('ruby' => true);
  29. $this->addElement('rp', false, 'Optional: #PCDATA', 'Common');
  30. }
  31. }
  32. // vim: et sw=4 sts=4