• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..05-Feb-2023-

conf/H04-Aug-2022-54

images/H04-Aug-2022-288285

lang/H04-Aug-2022-1816

source/H04-Aug-2022-206154

LICENSEH A D03-Aug-202217.7 KiB341281

README.mdH A D03-Aug-20226.4 KiB17190

action.phpH A D03-Aug-20222.6 KiB7258

helper.phpH A D03-Aug-20226.7 KiB224150

plugin.info.txtH A D03-Aug-2022170 87

syntax.phpH A D03-Aug-20225.3 KiB180131

README.md

1# Dokuwiki Plugin pot
2
3in short:
4
5This [https://www.dokuwiki.org|Dokuwiki] plugin allows you to define “pot” in a page, which can be used anywhere in the document (page).
6
7Mainly it is used to calculate and display formatted numbers. In addition, the content can be retrieved in the further course of the page.
8
9
10
11
12
13
14
15
16<!--
17
18## pot Plugin
19
20---- plugin ----
21description: calculate and display formatted numbers
22author     : agapetus
23email      :
24type       : syntax
25lastupdate : 2021-12-27
26compatible : Hogfather
27depends    :
28conflicts  :
29similar    :
30tags       :
31
32downloadurl:
33bugtracker :
34sourcerepo :
35donationurl:
36
37----
38
39-->
40
41
42The pot plugin is based on the  [https://www.dokuwiki.org/plugin:calc|calc plugin] and inspired by [https://www.dokuwiki.org/plugin:fields|fields plugin] It allows to perform calculations and displays numbers in an appropriate formatting.
43
44
45
46### Syntax
47
48The easy way for example
49
50    <pot> 5 + 10 </pot>
51
52
53### format the result
54
55Additional parameters can be used to adjust the displayed result:
56
57    <pot currency=$ | decimals=2 > 5 + 10 </pot>
58
59You will get:  15.00 $
60
61There are three ways to customize the display of results:
62
63  * use the config in the admin section for a general design,
64  * use an page specific code to design an shortcut
65  * use the individual "< pot settings=setting  > " to adjust only this "< pot>"
66  * the general config settings will be merged ( overwritten ) by the page code (if set), and finally merged by the individual settings (if set).
67
68The values are a simple line of entries in the format: "key=value | key=value | key=value
69
70| key  | shortcut  | (default) value  | why  |
71| --- | --- | --- | --- |
72| set  |   | any number or word,  | with this key word you will set a page default, see below  |
73| potid  | @value or #value  | unique id for this pot, see below: shortcut  | necessary if you want to use this pot-result within an other pot  |
74| decimals  |   | (0) how many numbers after the decimal point  |   |
75| currency  |   | () symbols ( €,$,...) or letters ( EUR, DOL,..)  |   |
76|           |   | you can use _ to place the currency before or after the value: eg. "_ €" is replaced to "value €" and "€ _" is replaced to "€ value"  (default ist after)  |   |
77| width  |   | (0) length of the result field in the format: 10px  | if you need all numbers nicely below the other  |
78| formula  |   | (false) true  | shows the formula if true  |
79| display  |   | (flex) none  | none if you need to hide the pot ( it is still shown in the html code!)  |
80| float  | !  | (left) right  |   |
81| sepmil  |   | (,)  | the sign which separates the thousand (1.000,00)  |
82| sepdec  |   | (.)  | the sign which separates the decimals (0,00)  |
83| defaultentry  | ~value  |   | shortcut, if you have used "set=3" you can use ~3 to call all settings done within the pot with set=3  |
84| color+  |   |   | set a color for results above 0  |
85| color-  |   |   | set a color for results beneath 0  |
86| type  |   | (formula) text  | the pot can be used to calculate formulas or to set and reuse text  |
87
88
89
90#### more examples
91
92    <pot set=1 | potid=example | decimals=2 | currency=€ | sepdec=, | sepmil=. | display=none > 1100.01 </pot>
93
94Will not be displayed. ( display=none )
95
96    <pot ~1> {@example} + 1  </pot>
97
98Will be displayed as:  1.101,01 € ( because  of the formatting set with set=1 )
99
100
101
102#### calculating
103
104Besides the simple calculations ( + - * / ) more complex functions can be used (e.g. sin() cos() ...).
105
106Already set "< pot>" values can be retrieved and included in the formulas. To retrieve exactly one result write "{@potid}".
107
108    <pot> {@example} + 1 </pot> to fetch exactly one other pot result
109
110You also can also write "{#examp}" to get the sum of all pots above this entry which have the letters "examp" in it's potid. (Keep in mind it is the sum of all above ones, the hidden ones and the ones with automatically set potid as well.)
111
112    <pot> {#examp} </pot>                                 to sum up all pots where id "examp" occurs
113
114    <pot potid=example_5 > {&} </pot>                     to sum up all pots where this pod id ("example" without added numbers) occurs
115
116The calculation might be done with the result of former pots and not with the formulas ( have a look at "formula=true" to see more), this might give different results (e.g. because of the amount of decimals used ).
117
118
119
120#### potid
121
122With "potid" you can set individual names to each pot. If not, it will be set automatically. There is a simple rule in the automatically set name, it ads an rising number to the last potid set. Simply set "potid=example5" and the next pots will have: example6, example7, example8,... until you set a new name where the rising starts again.
123
124
125
126#### shortcuts
127
128Some signs are definde as shortcuts. You might use them in the "format" part.
129
130    <pot @example_5 > 1 </pot>                           is identical to  <pot potid=example_5 > 1 </pot>
131
132| shortcut | the same as |   |
133|---------| ------------| ----- |
134| @value  | potid=value |   |
135| #value | potid=value_(uniqueNumber) | nice to use in tables and to sum them with {#value} later |
136| ! | float= right | probebly best in tables to have your numbers nicely on the right side |
137| ~value | defaultentry=value | fetches page settings which were set erlier with "set=value" |
138
139
140
141#### text
142
143To use this plugin for text entries simply write:
144
145    <POT> my text </POT>         or      <pot format=text > my text </pot>
146
147You can use this text later on the page with {@value}. A other plugin with similar functions: [https://www.dokuwiki.org/plugin:fields|plugin fields].
148
149
150
151#### WYSiWYG editor
152
153Unfortunately, error messages occur when using [https://www.dokuwiki.org/plugin:prosemirror|plugin:prosemirror] and  [https://www.dokuwiki.org/plugin:edittable|plugin:edittable]. The error messages occur when preview is clicked in the editor. After regular saving of the page the display is as usual.
154
155
156
157#### SAFETY CONSIDERATIONS
158
159In the current development state, this plugin should not be used in productive environments or open wikis.
160
161
162
163#### PHP Javascript
164
165This first attempt is only done with php. That is why the calculations and name assignments are made from top to bottom. Possibly, at some point, a variant with javascript will be created in order to be able to retrieve the set values on the whole page unhindered.
166
167#### developer notes
168
169Unfortunately, I do not have the necessary time or knowledge to maintain this plugin permanently or to improve it significantly. Please feel free to use, copy and fork the plugin.
170
171