lisps / const Goto Github PK
View Code? Open in Web Editor NEWDokuwiki Plugin
Home Page: http://dokuwiki.org/plugin:const
License: GNU General Public License v2.0
Dokuwiki Plugin
Home Page: http://dokuwiki.org/plugin:const
License: GNU General Public License v2.0
I'd like to define a constant on a single page on my DW, then be able to reference it from other pages to do calculations. This way, we'd only ever have to set some values in a single place, and have them work for several pages.
One way to do this would be to work with the output from the include plugin - at the top of the page you'd include a section or page, which would contain the const section. This assumes that you could have other const sections on the page and they'd just get concatenated.
Alternatively, the plugin could implement looking at another page itself, but it seems sensible to use the existing functionality of include and contribute any fixes needed.
My use case in more detail:
We have a fee for membership, and several things around the site are set in terms of that - for instance 2x monthly fee, 50% of monthly fee, and it's a pain to have to go around the site updating them all when the base fee changes. With consts across pages, we could just update a single place.
1st reason:
Line 220: if($ID != $this->page) return; is always true, since $this->page is always ''
2nd reason:
empty lines are thrown away and cause misaligned sections:
Line 83: $data = preg_split('/[\r\n]+/', $data, -1, PREG_SPLIT_NO_EMPTY); is the origin of this misbehaviour.
Why did you publish this really useless plugin?
Hi,
I was trying to use the plugin with the FontColor plugin. Couldn't do it because the < after the = in a var def breaks the entire code.
e.g.
<const>
var=<fc #ffff00>Yellow</fc>
</const>
Var Value: [%%var%%]
will break the page. If I remove the < char (obviously fc will stop working) works again.
Hope did help
Hi,
we are testing the const plugin and we notice that the CKGEdit plugin can´t manage the %% quotes for a given constant.
For example: myname=Bob Name: %%myname%%
Under DWEdit the output is Name: Bob - works like a charme :)
CKGEdit instead substitutes the %% with nowiki tags
Is there any way to wrap the constant and make it work with CKGEdit?
Cheers
Doesn't seem to work if you have "=" in the value, for example you want to build a URL:
C_URL=https://some.query.url/search?q=Then later in the document I have a reference like:
My URL = [[%%C_URL%%123456|123456]]
Or even an SQL plugin query like:
CONCAT('<a href="%%C_URL%%', reg.companyNumber, '">', reg.companyNumber, '</a>') AS companyNumber,
It doesn't resolve if the value contains "=", but if I take this out, it works.
I tried various methods to escape the "=" but it didn't work:
C_URL='https://some.query.url/search?q='
C_URL=https://some.query.url/search?q\=
C_URL=https://some.query.url/search?q\\=
C_URL=''https://some.query.url/search?q' . '=''
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.