Hi Senechaux

> Is there some way to get current tiddler name and tiddler field values
from within the parser?

No. Tiddlers are parsed independently of the current tiddler; it's only at
the rendering part of the process that the current tiddler concept exists.

Unfortunately, if you're trying to have the checkbox dynamically update the
underlying wikitext to change the state, then I'm afraid you've chosen a
very difficult first project! How are you getting on now?

Best wishes

Jeremy.






On Fri, Apr 24, 2015 at 10:57 PM, senechaux <[email protected]> wrote:

> Thanks Jeremy.. that helps a lot for the wikification.  Still struggling
> with the checkbox "default" to work properly.  Is there some way to get
> current tiddler name and tiddler field values from within the parser? (I
> suspect I have to check for field existence to get the checkbox "default"
> to work correctly.)  FYI, lots of time with TWC but still feeling my way
> around TW5
>
>
> On Thursday, April 23, 2015 at 6:54:51 PM UTC-5, senechaux wrote:
>>
>> Hi Guys,
>>
>> Not sure if this is possible but found it creating the checkbox with some
>> gotchas.
>> /*\
>> title: $:/core/modules/parsers/wikiparser/rules/checkboxrule.js
>> type: application/javascript
>> module-type: wikirule
>> \*/
>> (function(){
>>
>>   /*jslint node: true, browser: true */
>>   /*global $tw: false */
>>   "use strict";
>>
>>   exports.name = "checkboxrule";
>>   exports.types = {inline: true};
>>
>>   exports.init = function(parser) {
>>     this.parser = parser;
>>     // Regexp to match
>>     this.matchRegExp = /\[([xX_ ])\] ?(.*)/mg;
>>   };
>>
>>   exports.parse = function() {
>>     this.parser.pos = this.matchRegExp.lastIndex;
>>     var checked = ($tw.utils.trim(this.match[1]).toUpperCase()=="X");
>>     var lbl = $tw.utils.trim(this.match[2]);
>>     return [{type: "checkbox",
>>         tag: "$checkbox",
>>         attributes: {
>>             id            : {type: "string", value: "AM_"+lbl},
>>             field        : {type: "string", value: lbl},
>>             checked        : {type: "string", value: true},
>>             unchecked    : {type: "string", value: false},
>>             default        : {type: "string", value: checked}
>>         },
>>         children: [{
>>             type: "text",
>>             text: " "+lbl
>>         }]
>>     },
>>     {type: "element", tag: "br"}
>>     ];
>> };
>> })();
>> The use of a default appears to cause problems (a 3rd state appears where
>> 'checked' but field shows false) and the label doesn't get wikified.  Am I
>> going about this the wrong way or is this a valid rule?
>>
>> Thanks for your thoughts.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywikidev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/590db810-0b5e-42a4-a530-8b911889df4a%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywikidev/590db810-0b5e-42a4-a530-8b911889df4a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAPKKYJb0bskbc7_g7Q4iy_%3D5d1A48Lzha9xBhT9ac4%3Dqi0uDWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to