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

..Today-

conf/H10-Jan-2022-54

images/H10-Jan-2022-288285

lang/H10-Jan-2022-1816

source/H10-Jan-2022-206154

LICENSEH A D09-Jan-202217.7 KiB341281

README.mdH A D09-Jan-20226.3 KiB17089

action.phpH A D09-Jan-20222.6 KiB7258

helper.phpH A D09-Jan-20226.7 KiB224150

plugin.info.txtH A D09-Jan-2022170 87

syntax.phpH A D09-Jan-20225 KiB171124

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| width  |   | (0) length of the result field in the format: 10px  | if you need all numbers nicely below the other  |
77| formula  |   | (false) true  | shows the formula if true  |
78| display  |   | (flex) none  | none if you need to hide the pot ( it is still shown in the html code!)  |
79| float  | !  | (left) right  |   |
80| sepmil  |   | (,)  | the sign which separates the thousand (1.000,00)  |
81| sepdec  |   | (.)  | the sign which separates the decimals (0,00)  |
82| defaultentry  | ~value  |   | shortcut, if you have used "set=3" you can use ~3 to call all settings done within the pot with set=3  |
83| color+  |   |   | set a color for results above 0  |
84| color-  |   |   | set a color for results beneath 0  |
85| type  |   | (formula) text  | the pot can be used to calculate formulas or to set and reuse text  |
86
87
88
89#### more examples
90
91    <pot set=1 | potid=example | decimals=2 | currency=€ | sepdec=, | sepmil=. | display=none > 1100.01 </pot>
92
93Will not be displayed. ( display=none )
94
95    <pot ~1> {@example} + 1  </pot>
96
97Will be displayed as:  1.101,01 € ( because  of the formatting set with set=1 )
98
99
100
101#### calculating
102
103Besides the simple calculations ( + - * / ) more complex functions can be used (e.g. sin() cos() ...).
104
105Already set "< pot>" values can be retrieved and included in the formulas. To retrieve exactly one result write "{@potid}".
106
107    <pot> {@example} + 1 </pot> to fetch exactly one other pot result
108
109You 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.)
110
111    <pot> {#examp} </pot>                                 to sum up all pots where id "examp" occurs
112
113    <pot potid=example_5 > {&} </pot>                     to sum up all pots where this pod id ("example" without added numbers) occurs
114
115The 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 ).
116
117
118
119#### potid
120
121With "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.
122
123
124
125#### shortcuts
126
127Some signs are definde as shortcuts. You might use them in the "format" part.
128
129    <pot @example_5 > 1 </pot>                           is identical to  <pot potid=example_5 > 1 </pot>
130
131| shortcut | the same as |   |
132|---------| ------------| ----- |
133| @value  | potid=value |   |
134| #value | potid=value_(uniqueNumber) | nice to use in tables and to sum them with {#value} later |
135| ! | float= right | probebly best in tables to have your numbers nicely on the right side |
136| ~value | defaultentry=value | fetches page settings which were set erlier with "set=value" |
137
138
139
140#### text
141
142To use this plugin for text entries simply write:
143
144    <POT> my text </POT>         or      <pot format=text > my text </pot>
145
146You can use this text later on the page with {@value}. A other plugin with similar functions: [https://www.dokuwiki.org/plugin:fields|plugin fields].
147
148
149
150#### WYSiWYG editor
151
152Unfortunately, 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.
153
154
155
156#### SAFETY CONSIDERATIONS
157
158In the current development state, this plugin should not be used in productive environments or open wikis.
159
160
161
162#### PHP Javascript
163
164This 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.
165
166#### developer notes
167
168Unfortunately, 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.
169
170