Hey, Tony — The trouble in your case is that you're putting the formulas in quotes, which makes TiddlyWiki treat them as strings. The experimental syntax for attribute values is just *<tag attribute=(= 2+2 =) />* — no quotes outside the mushroom brackets. Generally I use the formula-vars <https://evanbalster.com/tiddlywiki/formulas.html#FormulaVarsWidget> widget when I want to set one or more variables to formula-computed values. You could use the vars widget with the new syntax for the same effect...
Be mindful of how you format the date strings, too (or use to_tw_date). Things I'm thinking about right now: - "if" and "else" widgets that work with formulas and switch their content on and off. - Functions to query transclusions/filters/variables with string arguments - eg. transclude(<<otherTiddler>>, "this-field") - eg. filter("[range[1," & <<rangeMax>> & "]]") - eg. variable("item" & <<index>>) - Functions to grab transclusions/variables as raw text rather than formula data. - Might make the functions above do this, and add a "datum" function that emulates the behavior of the direct syntax. On Friday, 29 December 2017 21:22:33 UTC-6, TonyM wrote: > > Post Script, > > Of note is being able to add calculations to elements in TiddlyWiki and > HTML which would otherwise be controlled using java script which is not so > accessible to a novice in TiddlyWiki. > > Keep up the good work. > Tony > > On Saturday, 30 December 2017 14:16:00 UTC+11, TonyM wrote: >> >> Evan, >> >> That works like a dream. Thank you. >> >> As you say "tiddlywiki-oriented functions" here are some that come to >> mind I am trying to identify based on the current implementation >> >> if then else or other logical operators to transclude a tiddler, or >> include content. >> >> For example hiding or displaying content based on logic from prior >> answers or calculations. >> >> I am currently building a couple of macros to provide buttons with the >> ability to increment a date by N days, weeks months etc... >> My Problem is ensuring the result not the formula is returned. I have >> calculated using formulas the new date and still struggling to right this >> back to the input date field. >> I think this already possible I am just trying to workout how to do it, >> and as simply as possible. >> >> Here is a snipit that is not working. >> >> \define commitdateaction(label,datefield,update) >> <$button tooltip="Change $datefield$ to $update$" class="tc-btn-invisible >> tc-tiddlylink" > >> <$action-setfield $field="$datefield$" $value="$update$"/> >> $label$ >> </$button> >> \end >> >> \define dateincrements(datefield,inc:"D W F M Q H Y") >> <$set name=indate value="(= tw_date( {{!!$datefield$}} ) =)"> >> <!-- Main Loop --> >> <$list filter="$inc$" variable=period> >> <$list filter="[<period>prefix[D]]" variable=incperiod> >> <!-- Day --> >> <$set name=multiple value="1"> >> <$set name=label >> value="(={{!!dateinc}}*<<multiple>>=)<<incperiod>>"> >> <$set name=newdate value="(=to_tw_date(add_days(<<indate>>, >> <<multiple>>*{{!!dateinc}}))=)" > >> <$macrocall $name="commitdateaction" label="<<label>>" >> datefield=$datefield$ update=<<newdate>> /> >> </$set> >> </$set> >> </$set> >> </$list> >> .... >> >> <$select field=dateinc default='1'> >> <$list filter='1 2 3 4 5 6 12' > >> <option value=<<currentTiddler>>><$view field='title'/></option> >> </$list> >> </$select> >> <!--- >> <$select field=dateincdec default='+'> >> <option value="+">+</option> >> <option value="-">-</option> >> </$select> >> Save and Provide Reset >> --> >> </$set> >> <<newdate>> >> \end >> >> Regards >> Tony >> >> >> On Saturday, 30 December 2017 13:07:44 UTC+11, Evan Balster wrote: >>> >>> Hello, Tony — >>> >>> Assuming you have both the formula plugin *and* the attribute-modules >>> plugin installed, un-quoting your attributes will make them into formulas >>> (instead of literal strings): >>> >>> \define showtodayrange(datefield1,datefield2) >>> <progress >>> value=(= days( date( {{!!$datefield1$}} ) , now() ) =) >>> max=(= days( date( {{!!$datefield1$}} ) , date( {{!!$datefield2$}} >>> )) =)/> >>> \end >>> >>> The attribute-modules plugin is really just a stand-in for my core pull >>> request, and the "safer" way to do this is to use the <<formula ...>> macro >>> instead of the direct syntax. In this case you do quote the formula, but >>> you don't include the mushroom brackets: >>> >>> \define showtodayrange(datefield1,datefield2) >>> <progress >>> value=<<formula "days( date( {{!!$datefield1$}} ) , now() )">> >>> max=<<formula "days( date( {{!!$datefield1$}} ) , date( >>> {{!!$datefield2$}} ))">>/> >>> \end >>> >>> Gets me thinking about how I'd like to add some more tiddlywiki-oriented >>> functions like transclude(tiddlerName, fieldName) and >>> filter(expressionString) to formulas... >>> >>> On Friday, 29 December 2017 19:47:37 UTC-6, TonyM wrote: >>>> >>>> Evan, >>>> >>>> Thanks for another update. >>>> >>>> FYI: I drag this to my wiki and it is named untitled until I hit the >>>> import button, not sure but there may be a plugin setting needing update. >>>> >>>> Also; >>>> >>>> I am trying to see if I can get the following to work, basicaly as a >>>> version of Formulas as Tag Attributes >>>> >>>> Total days between, with a progress bar of days so far relative to today >>>> >>>> \define showtodayrange(datefield1,datefield2) >>>> <progress value="(= days( date( {{!!$datefield1$}} ) , now() ) =)" >>>> max="(= days( date( {{!!$datefield1$}} ) , date( {{!!$datefield2$}} )) >>>> =)"></progress> >>>> \end >>>> >>>> Regards >>>> Tony >>>> >>>> >>>> On Saturday, 30 December 2017 10:59:55 UTC+11, Evan Balster wrote: >>>>> >>>>> Formula 0.1.7 released: >>>>> https://evanbalster.com/tiddlywiki/formulas.html >>>>> GitHub and issue tracking: >>>>> https://github.com/EvanBalster/TiddlyWikiFormula >>>>> >>>>> Changes: >>>>> >>>>> - Add math functions styled after GLSL for visual calculations >>>>> - fract, modulo/mod, atan2, clamp, mix, step, smoothstep >>>>> - Add capture group index to regexextract and regexextract1 >>>>> Functions >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#Functions>. >>>>> - EG. regexextract("cats, red cats, and blue cats", "([a-z]+) >>>>> cats", 1) results in red and blue. >>>>> - Fix FormulaWidget >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#FormulaWidget> >>>>> always >>>>> parsing output in inline mode. >>>>> - Make inline the default parsing mode for FormulaWidget >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#FormulaWidget> >>>>> . >>>>> - Add *experimental* $noRefresh option in FormulaVarsWidget >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#FormulaVarsWidget> >>>>> . >>>>> - This suppresses full-refreshing, resulting in a potentially >>>>> significant performance boost (see >>>>> >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#Harmonic%20Lattice>) >>>>> when variables change. >>>>> - This can cause incorrect refresh behavior. >>>>> - Add *experimental* support for Formulas as Tag Attributes >>>>> >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#Formulas%20as%20Tag%20Attributes> >>>>> . >>>>> - Example: <td colspan=(= 2+2 =)/> >>>>> - For now, this requires a second plugin >>>>> >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#%24%3A%2Fplugins%2Febalster%2Fattribute-modules> >>>>> that >>>>> modifies the TiddlyWiki core! >>>>> - I've started a Pull Request >>>>> <https://github.com/Jermolene/TiddlyWiki5/pull/3072> that would >>>>> add official support to TiddlyWiki core for extensions like this. >>>>> >>>>> The changes here mostly have to do with things I've been interested >>>>> in lately — specifically explorable explanations with SVG rendering >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#Real%20Projective%20Line> >>>>> and >>>>> datamining TiddlyWiki's source code with regular expressions >>>>> <https://evanbalster.com/tiddlywiki/formulas.html#Widget%20Variable%20Inspector> >>>>> . >>>>> >>>>> On Friday, 22 December 2017 20:07:54 UTC-6, TonyM wrote: >>>>>> >>>>>> Evan, >>>>>> >>>>>> Very small font, and 6 was, not easy to read. Sorry. >>>>>> >>>>>> I am doing the same as you, investing a great deal of time in >>>>>> tiddlywiki for professional reasons and maximising my return to the >>>>>> community, I have a dozen solutions in Progress and Have not published >>>>>> any >>>>>> yet. >>>>>> >>>>>> If it interests you >>>>>> The key one I am working on now, which is benefiting from your >>>>>> solution, thus I will need to bundle your plugin, is a "universal >>>>>> tiddler >>>>>> disposition tool". >>>>>> Be it code, macros, contacts, ideas, todo, book reading, book >>>>>> writing, reference notes etc... every tiddler can have or travel through >>>>>> various life cycles including reoccuring ones. >>>>>> I am providing a way to indicate the nature of each tiddler as it >>>>>> exists in the tiddlyverse, I am then providing canned listings according >>>>>> to >>>>>> these dispositions, which are largely date driven. >>>>>> >>>>>> The theory is, with nothing more than describing what a given tiddler >>>>>> is via its disposition, then using tools I provide to query such >>>>>> dispositions the user effectively gains an unlimited number of solutions >>>>>> and applications. >>>>>> >>>>>> For my business it turbo charges rapid development of solutions. >>>>>> >>>>>> This is the virtuous circle of a healthy open source community. >>>>>> >>>>>> Regards >>>>>> Tony >>>>>> >>>>>> On Saturday, 23 December 2017 12:29:30 UTC+11, Evan Balster wrote: >>>>>>> >>>>>>> Hey, Tony — >>>>>>> >>>>>>> Pleased to serve! I'm building this with my own needs in mind >>>>>>> foremost, but I happened to be in a situation where I could justify >>>>>>> putting >>>>>>> professional time into the project and make something fairly robust and >>>>>>> feature-rich. I get a lot of satisfaction out of putting together a >>>>>>> nice >>>>>>> tool, and it's a fun diversion from my larger project. :) >>>>>>> >>>>>>> The Get your Plugin indicates the plugin is Version 0.1.0 although >>>>>>>> it is now 0.1.6 >>>>>>> >>>>>>> >>>>>>> Et tu, cache? Try refreshing. >>>>>>> >>>>>>> >>>>>>> On Friday, 22 December 2017 19:14:40 UTC-6, TonyM wrote: >>>>>>>> >>>>>>>> Evan, >>>>>>>> >>>>>>>> For you >>>>>>>> At https://evanbalster.com/tiddlywiki/formulas.html the Get your >>>>>>>> Plugin indicates the plugin is Version 0.1.0 although it is now >>>>>>>> 0.1.6 >>>>>>>> >>>>>>>> From me >>>>>>>> Thanks so much for your work here, Looking ahead I can see dozens >>>>>>>> of features/solutions I wish to build, being supported by "formulas". >>>>>>>> >>>>>>>> It seems this path you have taken is already removing barriers, >>>>>>>> that appeared in tiddlywiki for some time, and providing shortcuts to >>>>>>>> others. >>>>>>>> >>>>>>>> Of course the number of features are so rich I have had too little >>>>>>>> time to investigate and test how to solve some of my problems. But you >>>>>>>> have >>>>>>>> made my obsession with tiddlywiki even stronger. >>>>>>>> >>>>>>>> You may of spent some time building this but that time is possibly >>>>>>>> small compared to the time I will now spend learning to leveraging it, >>>>>>>> not >>>>>>>> to mention that in the long run I will save time and reduce design to >>>>>>>> deployment times. >>>>>>>> >>>>>>>> Be aware, I for one, and I presume many others, are very grateful >>>>>>>> for your work here. I can only wish you all the best in return and >>>>>>>> thank >>>>>>>> you deeply. >>>>>>>> >>>>>>>> Regards >>>>>>>> Tony >>>>>>>> >>>>>>>> >>>>>>>> On Saturday, 23 December 2017 10:41:25 UTC+11, Evan Balster wrote: >>>>>>>>> >>>>>>>>> Announcing Formula 0.1.6: >>>>>>>>> https://evanbalster.com/tiddlywiki/formulas.html >>>>>>>>> GitHub & issue tracking: >>>>>>>>> https://github.com/EvanBalster/TiddlyWikiFormula >>>>>>>>> >>>>>>>>> - Enhanced performance. >>>>>>>>> - Add range Operator for counting. >>>>>>>>> - *FormulaWidget results are now wikified by default*. >>>>>>>>> - Made filter behavior more consistent with TiddlyWiki >>>>>>>>> - Support compound filters with + and - (these break >>>>>>>>> precedence rules). >>>>>>>>> - *Arrays now convert to strings in TiddlyWiki list format.* >>>>>>>>> - Implement escape sequences in String Literal. >>>>>>>>> - \\, \', \", \n, \r, \t, \v, \f, \b, \0, \u1234 (unicode) >>>>>>>>> - Add calendar functions: is_leap_year(y), days_in_year(y), >>>>>>>>> days_in_month(y,m) >>>>>>>>> - Add math functions: gcd and lcm >>>>>>>>> - Fix support for (?igm) flags in regular expression strings. >>>>>>>>> - Make regexextract and regexreplace search globally by >>>>>>>>> default. >>>>>>>>> - Make regexmatch and regexextract1 search non-globally by >>>>>>>>> default. >>>>>>>>> - Implement selective evaluation to save performance. >>>>>>>>> - Logic functions supported: if >>>>>>>>> - (Still experimenting with this, and may go in a very >>>>>>>>> different direction). >>>>>>>>> - Implement operand c >>>>>>>>> >>>>>>>>> -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4282b849-5de2-498b-9e93-7dc8d7512353%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.