-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderer.php
39 lines (35 loc) · 1.05 KB
/
renderer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Render Plugin for XHTML output,
* with preserved line break between non-ASCII characters removed,
* which may otherwise result in a blank between two characters unexpectedly.
*
* @author Huizhe Wang <[email protected]>
*/
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
require_once DOKU_INC . 'inc/parser/xhtml.php';
/**
* The Renderer
*/
class renderer_plugin_nonblank extends Doku_Renderer_xhtml {
/**
* Make available as XHTML replacement renderer
*
* @param string $format requested format
*/
public function canRender($format) {
return $format == 'xhtml';
}
/**
* Render plain text data, and remove the single line break
* if the previous and following characters are both full-width characters,
* especially CJK.
*
* @param $text
*/
function cdata($text) {
$esc = $this->_xmlEntities($text);
$this->doc .= preg_replace('/(?<=[^\x00-\xFF])\n(?=[^\x00-\xFF])/um', '', $esc);
}
}