====== Const Plugin ====== ---- plugin ---- description: Work on wiki pages with constants, self defined variables and make calculations author : lisps, peterfromearth email : type : action,syntax lastupdate : 2023-04-04 compatible : Igor, Greebo, Frusterick Manners, Elenor Of Tsort, Detritus depends : conflicts : similar : fields tags : math, calculation, constants downloadurl: https://github.com/lisps/const/archive/master.zip bugtracker : https://github.com/lisps/const/issues sourcerepo : https://github.com/lisps/const/ donationurl: screenshot_img : ---- ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. ===== Examples/Usage ===== print=Calculation value1=10 value2=30 value3=%RANDOM% formular=(value1 * value2) + (value3 / 2) result:formular * Value 1 = %%value1%% * Value 2 = %%value2%% * Value 3 = %%value3%% %%print%% => %%formular%% = %%result%% **Results in:** * Value 1 = 10 * Value 2 = 30 * Value 3 = 30130 Calculation => (value1 * value2) + (value3 / 2) = 15365 ===== Syntax ===== - define anywhere in your page a ''%%%%'' Block. - with ''variable=string'' you can assign a string to the variable. You can also assign a constant to a variable. - with ''result:formular'' you can execute a formular and store the result in the result variable. Inside the formular constants and earlier defined variables are allowed. - to display a variable on the page, use ''%%variable%%'' or ''%%§§variable§§%%'' **Available constants are:** ^Constants ^ Description ^ |''%ID%'' | pageid ''noNS(cleanID(getID()))''| |''%NAMESPACE%'' | namespace ''getNS(cleanID(getID()))'' | |''%RANDOM%'' | random number ''strval(rand())'' | |''%USER%'' | username | |''%YEAR%'' | year ''%%date("Y")%%'' | |''%MONTH%'' | month ''%%date("m")%%''| |''%MONTHNAME%'' | monthname ''%%date("F")%%'' | |''%WEEK%'' | weeknumber ''%%date("W")%%'' | |''%DAY%'' | day ''%%date("d")%%'' | |''%DAYNAME%'' | dayname ''%%date("l")%%'' | |''%AUTOINDEX%'' | autoinkrement variable | ===== Configuration and Settings ===== ===== Development ===== === Change Log === [[https://travis-ci.org/lisps/const|{{ https://travis-ci.org/lisps/const.png?nocache|Build Status}}]] {{rss>https://github.com/lisps/const/commits/master.atom date}} === Known Bugs and Issues === >2014-03-18 This plugin works for me. But the section editing does not work anymore. I mean if you have some headlines, you can edit each headline separatly. If you do so, the headline gets corrupted. I think, the culculation of the position of the headline is wrong. >can anyone fix this? Thanx. > \\ >> Can you try the [[https://github.com/lisps/const/archive/master.zip|development version]]. If this does't help, please open a bug report on github and list your dokuwiki plugins. --- [[user>lisps]] //2014/03/19 07:35// === ToDo/Wish List === ===== FAQ ===== ===== Discussion ===== Any idea to set ''const'' at wiki level ? [[user>jerome|Jérôme Barotin]] --- //2023-02-26 10:50// This plugin doesn't work at all, is buggy and useless. Anyway, what is the reason for this trivial syntax component? > It is not helpful to anyone to write that this plugin is buggy without specifying what the bugs are. Can you please be more specific in order to help the author (and other users) identify any issues? > If you don't see a reason for the plugin you are free to not use it. --- [[user>ach|Anika Henke]] //2014/01/26 18:17// >>To be plain: **//The "comment" above doesn't work at all, is buggy and useless. Anyway, what is the reason for this trivial blah-blah?//** >>>This plugin conflicts with [[plugin:edittable]]: If [[plugin:const]] (Development snapshot) is used in a table, we can not edit the table without destroying the contents. --- [[user>MKo|Michael Kohn]] //2014-11-04 17:43// >>should be fixed now [[user>lisps]] //2015-01-31// >Thanks a lot! It works :-) --- [[user>MKo|Michael Kohn]] //2015-02-04 15:30// >>Would it be possible to use differently named constants? (Like crosssection_mm or Volume_L instead of value1 and value2) ? This would make the formulas much more easy to read... Anyway, thanks for your great work so far Ocko / 20.03 (?? How can I automatically sign in DK, like ~~~~ in MW?) >Just noticed it works, but only if you write everything in small letters, w/o special chars...! Can we control the decimals somehow? >>Good time of day! Can i use const plugin with [[plugin:include]] plugin? I want to use some variables in include page, but it's rendered as %variable% on final page... > The const variables are only relevant for the pages where they are defined. You can create a issue on github and i can have a look if I have time. Is is fot math oparations only? Would it be possible to have some string manipulation (e.g. concatanation) as well?