mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-05 01:26:18 +00:00
39 lines
2.6 KiB
Plaintext
39 lines
2.6 KiB
Plaintext
title: $:/language/Help/fetch
|
|
description: Fetch tiddlers from wiki by URL
|
|
|
|
Fetch one or more files over HTTP/HTTPS, and import the tiddlers matching a filter, optionally transforming the incoming titles.
|
|
|
|
```
|
|
--fetch file <url> <import-filter> <transform-filter>
|
|
--fetch files <url-filter> <import-filter> <transform-filter>
|
|
--fetch raw-file <url> <transform-filter>
|
|
--fetch raw-files <url-filter> <transform-filter>
|
|
```
|
|
|
|
The "file" and "files" variants fetch the specified files and attempt to import the tiddlers within them (the same processing as if the files were dragged into the browser window). The "raw-file" and "raw-files" variants fetch the specified files and then store the raw file data in tiddlers, without applying the import logic.
|
|
|
|
With the "file" and "raw-file" variants only a single file is fetched and the first parameter is the URL of the file to read.
|
|
|
|
With the "files" and "raw-files" variants, multiple files are fetched and the first parameter is a filter yielding a list of URLs of the files to read. For example, given a set of tiddlers tagged "remote-server" that have a field "url" the filter `[tag[remote-server]get[url]]` will retrieve all the available URLs.
|
|
|
|
For the "file" and "files" variants, the `<import-filter>` parameter specifies a filter determining which tiddlers are imported. It defaults to `[all[tiddlers]]` if not provided.
|
|
|
|
For all variants, the `<transform-filter>` parameter specifies an optional filter that transforms the titles of the imported tiddlers. For example, `[addprefix[$:/myimports/]]` would add the prefix `$:/myimports/` to each title.
|
|
|
|
Preceding the `--fetch` command with `--verbose` will output progress information during the import.
|
|
|
|
Note that TiddlyWiki will not fetch an older version of an already loaded plugin.
|
|
|
|
The following example retrieves all the non-system tiddlers from https://tiddlywiki.com and saves them to a JSON file:
|
|
|
|
```
|
|
tiddlywiki --verbose --fetch file "https://tiddlywiki.com/" "[!is[system]]" "" --rendertiddler "$:/core/templates/exporters/JsonFile" output.json text/plain "" exportFilter "[!is[system]]"
|
|
```
|
|
|
|
The following example retrieves the "favicon" file from tiddlywiki.com and saves it in a file called "output.ico". Note that the intermediate tiddler "Icon Tiddler" is quoted in the "--fetch" command because it is being used as a transformation filter to replace the default title, while there are no quotes for the "--savetiddler" command because it is being used directly as a title.
|
|
|
|
```
|
|
tiddlywiki --verbose --fetch raw-file "https://tiddlywiki.com/favicon.ico" "[[Icon Tiddler]]" --savetiddler "Icon Tiddler" output.ico
|
|
```
|
|
|