Hi MagoArcade

I’m not sure that I fully understand what you’re trying to do, but I can see a 
few red flags in the excerpts you’ve provided.

First, the core of this task is appears to be to substitute chunks of text into 
a template. This is one of those situations where text substitution via a macro 
is called for:

\define json-output()
{"$(id1)$":{"to":"$(id2)$","type":"$(type)$"}}
\end

<$var id1=..something.. id2=..something.. type=..something..>
<$action-setfield $tiddler="my tiddler" $field="my-field" 
$value=<<json-output>>/>
</$vars>

The macro definition uses $(var)$ syntax to refer to variable names that are 
substituted when the macro is subsequently evaluated.

For explanatory purposes, I’ve used a var widget to assign values to those 
variables, and then used the action-setfield widget to assign the result to a 
tiddler field.

With that outline in mind, I’ll briefly note a few issues with the code you 
provided:

> My heavily abridged code:
> 
> \define TmapEdgesGen(tmapid reltype)
> {"{{{ [[]make[%uuid%]] }}}":{"to":"$tmapid$","type":"$reltype$"}}
> \end
> 
> ....
> 
> <$select field="SearchTermDD" class="tw-edit-texteditor myTextEdit”>

Field names should be lowercase with dots, dashes, dollars and underscores.

> <$list filter="[regexp:<SearchTermWikid>]" emptyMessage="No Results" >
> <option value=<<currentTiddler!!title>>><$view field='title’/>

There’s no such construction as <<currentTiddler!!title>>. When used to quote 
attribute values, the double angle bracket syntax evaluates a macro name, not a 
tiddler text reference.

> </option>
> 
> ....
> 
> <$select field="rel_type" class="tw-edit-texteditor myTextEdit">
> <$list filter="[[$:/_DTrelTypes]indexes[]sort[title]]" variable="key">
> <$set name="val" filter="[[$:/_DTrelTypes]getindex<key>]">
> <option value=<<key>>><<key>></option>

Here you’re using <<key>> to display the key within the option element. That 
syntax causes the content of the variable “key” to be wikified (ie wiki syntax 
like bold and italics would be honoured). It’s usually better to use <$text> or 
<$view> to display raw text.

> 
> ....
> 
> <$set name="parentmapid" tiddler={{!!SearchTermDD}} field=tmap.id>
> 
> <$wikify name="tmaprelwikid" value="""<<TmapEdgesGen <<parentmapid>> 
> {{!!rel_type}} >>""” >

The wikify widget isn’t needed in simple cases of text substitution. It’s only 
required if the functionality of the full wikitext parsing engine is required.

Sorry for being brief, feel free to ask followups.

Best wishes

Jeremy


> 
> DEBUG
> ParentMapID: <<parentmapid>>
> RelTypeID: {{!!rel_type}}
> Tmap.rels: <<tmaprelwikid>>
> 
> 
> <<!!rel_type>> can contain spaces
> 
> <<parentmapid>> will never contain spaces
> 
> The output I get is:
> 
> DEBUG
> ParentMapID: 1bad2a3f-e5d7-4923-8bb1-73e2cdd36314
> 
> RelTypeID: Idea About
> 
> Tmap.rels:
> 
> 
> 
> I.e. nothing in <<tmaprelwikid>>
> 
> 
> 
> I've messed around with various permutations of brackets and quotes - cannot 
> find anyway to get this working. 
> 
> 
> 
> Any help appreciated.
> 
> 
> 
> -- 
> 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 
> <mailto:tiddlywiki+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/87ed32ae-07bd-4e3b-9938-e9d9be87a293%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/87ed32ae-07bd-4e3b-9938-e9d9be87a293%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/B8B5117A-6002-4197-8A3A-DB9247DE5CCF%40gmail.com.

Reply via email to