renderer = new Doku_Renderer_xhtml(); } protected function render($rawwiki,$format='xhtml') { $instructions = p_get_instructions($rawwiki); return p_render($format, $instructions, $info); } function test_basic_singleline() { $in = NL.' ; Term : Definition'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_basic_multiline() { $in = NL.' ; Term'.NL .' : Definition'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_multiple_definitions() { $in = NL.' ; Term'.NL .' : Definition one'.NL .' : Definition two'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition one
'.NL .'
Definition two
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_newline_in_definition() { $in = NL.' ; Term'.NL .' : Definition one'.NL .'continues'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition one'.NL .'continues
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_newline_in_definition_with_following_para() { $in = NL.' ; Term'.NL .' : Definition one'.NL .'continues'.NL .NL .'Then new paragraph.'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition one'.NL .'continues
'.NL .'
'.NL .NL .'

'.NL .'Then new paragraph.'.NL .'

'.NL; $this->assertEquals($expected, $this->render($in)); } function test_basic_with_following_preformatted() { $in = NL.' ; Term'.NL .' : Definition'.NL .NL .' Preformatted'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition
'.NL .'
'.NL .'
Preformatted
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_nonfancy() { global $conf; $conf['plugin']['definitionlist']['dt_fancy'] = 0; $in1 = NL.' ; Term'.NL .' : Definition'.NL; $in2 = NL.' ; Term : Definition'.NL; $expected1 = '
'.NL .'
Term
'.NL .'
Definition
'.NL .'
'.NL; $expected2 = '
'.NL .'
Term
'.NL .'
Definition
'.NL .'
'.NL; $this->assertEquals($expected1, $this->render($in1)); $this->assertEquals($expected2, $this->render($in2)); } function test_custom_class_name() { global $conf; $conf['plugin']['definitionlist']['classname'] = 'foo'; $in = NL.' ; Term'.NL .' : Definition'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_two_dlists_with_blank_line_between() { $in = NL.' ; Term : Definition'.NL .NL.' ; Another term : Def'.NL; $expected = '
'.NL .'
Term
'.NL .'
Definition
'.NL .'
'.NL .'
'.NL .'
Another term
'.NL .'
Def
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_dd_with_ul() { $in = NL.' ; Term'.NL .' : Some parts:'.NL .' * Part 1'.NL .' * Part 2'.NL .NL .' ; Term 2'.NL .' : Def'.NL; $expected = '
'.NL .'
Term
'.NL .'
Some parts:'.NL .'
'.NL .'
Term 2
'.NL .'
Def
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_dd_with_ul_followed_by_ordered_list() { $in = NL.' ; Term'.NL .' : Some parts:'.NL .' * Part 1'.NL .' * Part 2'.NL .NL .NL .' - Item'.NL; $expected = '
'.NL .'
Term
'.NL .'
Some parts:'.NL .'
'.NL .'
'.NL .'
    '.NL .'
  1. Item
    '.NL .'
  2. '.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } function test_dd_with_ul_followed_by_2nd_dl() { $in = NL.' ; Term'.NL .' : Some parts:'.NL .' * Part 1'.NL .' * Part 2'.NL .NL .NL .' ; Term 2'.NL .' : Def'.NL; $expected = '
'.NL .'
Term
'.NL .'
Some parts:'.NL .'
'.NL .'
'.NL .'
'.NL .'
Term 2
'.NL .'
Def
'.NL .'
'.NL; $this->assertEquals($expected, $this->render($in)); } }