From 51f1ff0fc18269988cd7458edd943f609137d10e Mon Sep 17 00:00:00 2001 From: saggi-dw Date: Wed, 8 May 2024 13:53:05 +0200 Subject: [PATCH] add format to Decimal type add format to Decimal type fix codesniffer issue --- types/Decimal.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/Decimal.php b/types/Decimal.php index 255b8c0f..88204daa 100644 --- a/types/Decimal.php +++ b/types/Decimal.php @@ -25,6 +25,7 @@ class Decimal extends AbstractMultiBaseType 'prefix' => '', 'postfix' => '', 'engineering' => false, + 'format' => '', ]; /** @@ -37,6 +38,10 @@ class Decimal extends AbstractMultiBaseType */ public function renderValue($value, \Doku_Renderer $R, $mode) { + if (preg_match("/^%(?:['+-:.]?\D?\d*\.?\d*)?[bdeEfFu]$/", $this->config['format'])) { + $R->cdata($this->config['prefix'] . sprintf($this->config['format'], $value) . $this->config['postfix']); + return true; + } if ($this->config['engineering']) { $unitsh = ['', 'k', 'M', 'G', 'T'];