This code:
\define ViewTiddlerAppended()
<$vars viewtext={{$(viewpath)$}}>
''VIEW TEXT:'' <$text text=<<viewtext>>/>
<$set name=shortpath filter="[{$(viewpath)$}splitregexp[^(.*?).$]]"
select=1 >
<br>''OUTPUT:'' [<<shortpath>>]
</$set>
</$vars>
\end
<$vars viewpath="$:/plugins/felixhayashi/tiddlymap/graph/views/map" >
<<ViewTiddlerAppended>>
</$vars>
Produces this result:
*VIEW TEXT:* { "8c44558c-cd16-4064-87b6-d4b40fd167e8": {
"x": -351, "y": -55 }, "565d2cae-a39e-4bec-b16b-543619cf2bd7": { "x":
-119, "y": -72 }, "13f94e2c-189b-439e-aa55-0c7a88d45f97": { "x": -132,
"y": 136 }, "e20a7328-d70c-477d-8103-1d99ffbf031b": { "x": -127, "y":
-191 }, "516a25e4-c141-4469-a790-229b90da4bfa": { "x": -126, "y": 11 },
"cd326bff-d50c-406a-a5ca-a87699ae7bbe": { "x": -461, "y": -201 },
"7a8b1138-dbb9-49c8-91d6-12b9f21929f2": { "x": -559, "y": -108 },
"6a96291a-44bc-4d77-9261-8cc7b2964e87": { "x": -281, "y": -255 },
"3cadefc8-4186-4524-968a-22083b54c0bc": { "x": 18, "y": -146 },
"41bb28a9-b37f-4628-9730-0a48234a7490": { "x": -582, "y": 13 },
"6a5db04b-27e0-4e0d-81a3-1a3c1b44e928": { "x": -503, "y": 144 },
"7cc70f20-3457-4641-a2ab-d6f0512ab092": { "x": -333, "y": 176 } }
*OUTPUT:* [{
"8c44558c-cd16-4064-87b6-d4b40fd167e8": { "x": -351, "y": -55 },
"565d2cae-a39e-4bec-b16b-543619cf2bd7": { "x": -119, "y": -72 },
"13f94e2c-189b-439e-aa55-0c7a88d45f97": { "x": -132, "y": 136 },
"e20a7328-d70c-477d-8103-1d99ffbf031b": { "x": -127, "y": -191 },
"516a25e4-c141-4469-a790-229b90da4bfa": { "x": -126, "y": 11 },
"cd326bff-d50c-406a-a5ca-a87699ae7bbe": { "x": -461, "y": -201 },
"7a8b1138-dbb9-49c8-91d6-12b9f21929f2": { "x": -559, "y": -108 },
"6a96291a-44bc-4d77-9261-8cc7b2964e87": { "x": -281, "y": -255 },
"3cadefc8-4186-4524-968a-22083b54c0bc": { "x": 18, "y": -146 },
"41bb28a9-b37f-4628-9730-0a48234a7490": { "x": -582, "y": 13 },
"6a5db04b-27e0-4e0d-81a3-1a3c1b44e928": { "x": -503, "y": 144 },
"7cc70f20-3457-4641-a2ab-d6f0512ab092": { "x": -333, "y": 176 } }]
Note that the last } is trimmed off. If it doesn't work for you, check if
there is a space on the end of your tiddler contents. This is literally
taking off
the last character, even if that character is a space.
-- Mark
On Monday, August 19, 2019 at 11:41:30 AM UTC-7, MagoArcade wrote:
>
> Thanks Mark - this looks really good. However, what I'm wanting to do it
> to truncate the !!text inside the tiddler identified by ``viewpath`` I
> can't seem to get this to work with that. For illustration:
>
> \define ViewTiddlerAppended()
> <$vars ViewText={{$(ViewPath)$!!text}}>
> VIEW TEXT: : <<ViewText>>
> <$set name=shortpath filter=
> "[{{$(ViewPath)$!!text}}splitregexp[^(.*?).$]]" select=1 >
> <br>OUTPUT: [<<shortpath>>]
> </$set>
> </$vars>
> \end
>
> Gives me:
>
> VIEW TEXT: : { "8c44558c-cd16-4064-87b6-d4b40fd167e8": { "x": -351, "y": -
> 55 }, "565d2cae-a39e-4bec-b16b-543619cf2bd7": { "x": -119, "y": -72 },
> "13f94e2c-189b-439e-aa55-0c7a88d45f97": { "x": -132, "y": 136 },
> "e20a7328-d70c-477d-8103-1d99ffbf031b": { "x": -127, "y": -191 },
> "516a25e4-c141-4469-a790-229b90da4bfa": { "x": -126, "y": 11 },
> "cd326bff-d50c-406a-a5ca-a87699ae7bbe": { "x": -461, "y": -201 },
> "7a8b1138-dbb9-49c8-91d6-12b9f21929f2": { "x": -559, "y": -108 },
> "6a96291a-44bc-4d77-9261-8cc7b2964e87": { "x": -281, "y": -255 },
> "3cadefc8-4186-4524-968a-22083b54c0bc": { "x": 18, "y": -146 },
> "41bb28a9-b37f-4628-9730-0a48234a7490": { "x": -582, "y": 13 },
> "6a5db04b-27e0-4e0d-81a3-1a3c1b44e928": { "x": -503, "y": 144 },
> "7cc70f20-3457-4641-a2ab-d6f0512ab092": { "x": -333, "y": 176 } }
> OUTPUT: []
>
> Any suggestions?
>
>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/224f3fd5-7d51-425c-aae9-78db238e8a35%40googlegroups.com.