1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-12 02:10:27 +00:00

Switch over to procedures from macros

This commit is contained in:
jeremy@jermolene.com 2023-01-18 11:27:14 +00:00
parent b7df3e44bd
commit 74beb05360
2 changed files with 23 additions and 23 deletions

View File

@ -4,9 +4,9 @@ tags: $:/tags/Macro
<!-- <!--
Get items from a Flickr album/interestingness/collection etc. Get items from a Flickr album/interestingness/collection etc.
--> -->
\define flickr-get-items(method:"flickr.photosets.getPhotos",resultPhotoRoot:"photoset") \procedure flickr-get-items(method:"flickr.photosets.getPhotos",resultPhotoRoot:"photoset")
\define completion() \procedure completion()
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
<$action-log msg="In completion"/> <$action-log msg="In completion"/>
<$action-log/> <$action-log/>
@ -35,12 +35,12 @@ Get items from a Flickr album/interestingness/collection etc.
</$list> </$list>
\end completion \end completion
\define progress() \procedure progress()
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
<$action-log message="In progress-actions"/> <$action-log message="In progress-actions"/>
\end progress \end progress
\define request-url() \procedure request-url()
https://api.flickr.com/services/rest/ https://api.flickr.com/services/rest/
\end request-url \end request-url
@ -48,7 +48,7 @@ https://api.flickr.com/services/rest/
$message="tm-http-request" $message="tm-http-request"
url=<<request-url>> url=<<request-url>>
method="GET" method="GET"
query-method=<<__method__>> query-method=<<method>>
query-extras="geo" query-extras="geo"
query-format="json" query-format="json"
query-nojsoncallback="1" query-nojsoncallback="1"
@ -59,21 +59,21 @@ https://api.flickr.com/services/rest/
bind-progress="$:/temp/flickr/progress" bind-progress="$:/temp/flickr/progress"
oncompletion=<<completion>> oncompletion=<<completion>>
onprogress=<<progress>> onprogress=<<progress>>
var-start=<<__start__>> var-start=<<start>>
var-limit=<<__limit__>> var-limit=<<limit>>
var-resultPhotoRoot=<<__resultPhotoRoot__>> var-resultPhotoRoot=<<resultPhotoRoot>>
/> />
\end \end
\define flickr-get-album-items() \procedure flickr-get-album-items()
<$macrocall $name="flickr-get-items" method="flickr.photosets.getPhotos" resultPhotoRoot="photoset"/> <$macrocall $name="flickr-get-items" method="flickr.photosets.getPhotos" resultPhotoRoot="photoset"/>
\end \end
\define flickr-get-interesting-items() \procedure flickr-get-interesting-items()
<$macrocall $name="flickr-get-items" method="flickr.interestingness.getList" resultPhotoRoot="photos"/> <$macrocall $name="flickr-get-items" method="flickr.interestingness.getList" resultPhotoRoot="photos"/>
\end \end
\define flickr-actions() \procedure flickr-actions()
<$macrocall $name="flickr-get-album-items"/> <$macrocall $name="flickr-get-album-items"/>
\end \end

View File

@ -1,7 +1,7 @@
title: WidgetMessage: tm-http-request Example - Zotero title: WidgetMessage: tm-http-request Example - Zotero
tags: $:/tags/Macro tags: $:/tags/Macro
\define select-zotero-group() \procedure select-zotero-group()
Specify the Zotero group ID to import Specify the Zotero group ID to import
<$edit-text tiddler="$:/config/zotero-group" tag="input"/> or <$edit-text tiddler="$:/config/zotero-group" tag="input"/> or
<$select tiddler="$:/config/zotero-group"> <$select tiddler="$:/config/zotero-group">
@ -11,7 +11,7 @@ Specify the Zotero group ID to import
</$select> </$select>
\end \end
\define zotero-save-item(item) \procedure zotero-save-item(item)
<$action-createtiddler <$action-createtiddler
$basetitle={{{ =[[_zotero_import ]] =[<item>jsonget[key]] =[[ ]] =[<item>jsonget[title]] +[join[]] }}} $basetitle={{{ =[[_zotero_import ]] =[<item>jsonget[key]] =[[ ]] =[<item>jsonget[title]] +[join[]] }}}
text={{{ [<item>jsonget[title]] }}} text={{{ [<item>jsonget[title]] }}}
@ -24,15 +24,15 @@ Specify the Zotero group ID to import
</$action-createtiddler> </$action-createtiddler>
\end zotero-save-item \end zotero-save-item
\define zotero-save-items(data) \procedure zotero-save-items(data)
<$list filter="[<data>jsonindexes[]] :map[<data>jsonextract<currentTiddler>,[data]]" variable="item"> <$list filter="[<data>jsonindexes[]] :map[<data>jsonextract<currentTiddler>,[data]]" variable="item">
<$macrocall $name="zotero-save-item" item=<<item>>/> <$macrocall $name="zotero-save-item" item=<<item>>/>
</$list> </$list>
\end zotero-save-items \end zotero-save-items
\define zotero-get-items(start:"0",limit:"25") \procedure zotero-get-items(start:"0",limit:"25")
\define completion() \procedure completion()
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
<$action-log msg="In completion"/> <$action-log msg="In completion"/>
<$action-log/> <$action-log/>
@ -47,12 +47,12 @@ Specify the Zotero group ID to import
</$list> </$list>
\end completion \end completion
\define progress() \procedure progress()
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
<$action-log message="In progress-actions"/> <$action-log message="In progress-actions"/>
\end progress \end progress
\define request-url() \procedure request-url()
\rules only transcludeinline transcludeblock filteredtranscludeinline filteredtranscludeblock \rules only transcludeinline transcludeblock filteredtranscludeinline filteredtranscludeblock
https://api.zotero.org/groups/{{$:/config/zotero-group}}/items/ https://api.zotero.org/groups/{{$:/config/zotero-group}}/items/
\end request-url \end request-url
@ -64,20 +64,20 @@ https://api.zotero.org/groups/{{$:/config/zotero-group}}/items/
method="GET" method="GET"
query-format="json" query-format="json"
query-sort="title" query-sort="title"
query-start=<<__start__>> query-start=<<start>>
query-limit=<<__limit__>> query-limit=<<limit>>
header-accept="application/json" header-accept="application/json"
bind-status="$:/temp/zotero/status" bind-status="$:/temp/zotero/status"
bind-progress="$:/temp/zotero/progress" bind-progress="$:/temp/zotero/progress"
oncompletion=<<completion>> oncompletion=<<completion>>
onprogress=<<progress>> onprogress=<<progress>>
var-start=<<__start__>> var-start=<<start>>
var-limit=<<__limit__>> var-limit=<<limit>>
/> />
</$wikify> </$wikify>
\end \end
\define zotero-actions() \procedure zotero-actions()
<$macrocall $name="zotero-get-items" start="0" limit="50"/> <$macrocall $name="zotero-get-items" start="0" limit="50"/>
\end \end