dokuwiki-plugin-struct icon indicating copy to clipboard operation
dokuwiki-plugin-struct copied to clipboard

Add a format parameter to the Decimal type

Open saggi-dw opened this issue 1 year ago • 6 comments

A user on DokuWiki Forum need a special format for numbers. https://forum.dokuwiki.org/d/22218-how-to-force-leading-zeroes-when-using-a-bureacuracy-form-with-struct

This add a new config parameter for the Decimal type: format

If format is set and valid all other formatting parameters(roundto, decpoint, thousands, trimzeros, engineering) are ignored. format must be a valid format for sprintf and accepts the following number formats: bdeEfFu

saggi-dw avatar May 08 '24 12:05 saggi-dw

LGTM. Can you fix the code sniffer issue and squash your commits?

splitbrain avatar May 08 '24 12:05 splitbrain

I hope that was all correct. My first question: What is squashing? 🙈 I think it worked.

saggi-dw avatar May 08 '24 13:05 saggi-dw

Great. One more thing: can you please extend the unit tests to cover your new setting? See https://github.com/cosmocode/dokuwiki-plugin-struct/blob/master/_test/types/DecimalTest.php

splitbrain avatar May 13 '24 06:05 splitbrain

OK, test failed: There was 1 failure:

1) dokuwiki\plugin\struct\test\types\DecimalTest::test_renderValue with data set #43 ('1', '1 ', '-1', '.', ' ', true, '', '', false, '%u')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1 '
+'1'

I will fix that.

saggi-dw avatar May 13 '24 13:05 saggi-dw

The commit message is now total crap. Unfortunately, I have no idea whether it can still be changed...

saggi-dw avatar May 13 '24 14:05 saggi-dw

The commit message is now total crap. Unfortunately, I have no idea whether it can still be changed...

You can do a git commit --amend it lets you edit the last commit. Once done, do another force push.

splitbrain avatar May 14 '24 06:05 splitbrain