Skip to content

Commit 51f1ff0

Browse files
committed
add format to Decimal type
add format to Decimal type fix codesniffer issue
1 parent 63b9cad commit 51f1ff0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

types/Decimal.php

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Decimal extends AbstractMultiBaseType
2525
'prefix' => '',
2626
'postfix' => '',
2727
'engineering' => false,
28+
'format' => '',
2829
];
2930

3031
/**
@@ -37,6 +38,10 @@ class Decimal extends AbstractMultiBaseType
3738
*/
3839
public function renderValue($value, \Doku_Renderer $R, $mode)
3940
{
41+
if (preg_match("/^%(?:['+-:.]?\D?\d*\.?\d*)?[bdeEfFu]$/", $this->config['format'])) {
42+
$R->cdata($this->config['prefix'] . sprintf($this->config['format'], $value) . $this->config['postfix']);
43+
return true;
44+
}
4045

4146
if ($this->config['engineering']) {
4247
$unitsh = ['', 'k', 'M', 'G', 'T'];

0 commit comments

Comments
 (0)