Closed kookma closed 1 year ago
May be because of this: -[list[$:/somepath/test]]
does not produce the expected output
Hi @kookma what's going on here is that the publish filter is applied when building the index.html file for the browser. Then when the index.html file is loaded, the sync process notices that there are tiddlers on the server that don't exist in the browser. It assumes that those tiddlers have been deleted in the browser, and so tries to delete those tiddlers from the server to sync things.
As you have found, the publish filter isn't really intended to be used with the client/server synchronisation. What are you trying to accomplish?
May be instead of removing content, that you do not want to publish you may create a new "render-template" similar to the "$:/plugins/tiddlywiki/tiddlyweb/save/offline" template which contains the stuff you want to publish ... just an idea
Thank you @Jermolene I have created several editions and publish single html TiddlyWiki files using the build command.
There are some tiddlers only needed when I use the editions on Node JS
I use publishFilter to remove them from index.html
Hi @kookma the render command allows variables to be set from the command line, so you don't need to include the definition of publishFilter within the wiki itself. For example:
"build": {
"index": [
"--render",
"$:/plugins/tiddlywiki/tiddlyweb/save/offline",
"index.html",
"text/plain",
"",
"publishFilter",
"-[[Test 201]] -[[Test 400]] -[[$:/somepath/test]] -[list[$:/somepath/test]]"
],
Thank you, Jeremy! Your solution works.
Further observations: (Updated: 2023.04.24)
$:/somepath/test
is removed$:/somepath/test
when I use publishFilter.Should I close this issue or leave it open?
I use your solution in tiddlywiki.info
"build": {
"index": [
"--render",
"$:/plugins/tiddlywiki/tiddlyweb/save/offline",
"index.html",
"text/plain",
"",
"publishFilter",
"-[[Test 201]] -[[Test 400]] -[[$:/somepath/test]] -[list[$:/somepath/test]]"
],
It works great! I created a global macro called singleFileExclusion
and modified above command as below
"",
"publishFilter",
"-[subfilter<singleFileExclusion>]"
The singleFileExclusion
contains filter expression of all tiddlers/plugins to be excluded from publishing with single index.html
@kookma ... Since the issue is resolved. Can we close it? ...
IMO your last post / solution would make a good example for a new tiddler eg: PublishFilter tagged Mechanisms at tw-docs
https://tiddlywiki.com/#Mechanisms:Mechanisms%20SavingMechanism
Hi Mario, Sure I will submit a PR and explain this to be included in documentation (target tw5.com)
Describe the bug
Using global publishFilter when building index.html removes system tiddlers from TiddlyWiki if they appear in the publishFilter
Expected behavior
The building process when using publishFilter contains system tiddlers should not touch the tiddlers in the TiddlyWiki (server, e.g test in the below example) itself.
To Reproduce
create a new wiki called test :
tiddlywiki test --init server
launch wiki
tiddlywiki test --listen
create some tiddlers
create a $:/config/PublishFilter tiddler tagged with
$:/tags/Macro
with below contentbuild index
tiddlywiki test --build index
refresh the wiki by pressing F5 or stop and restart the server
Problem: the
$:/somepath/test]
is removed from TiddlyWiki (server e.g. test here)I repeated the test any tiddler with
$:/
if appears in publishFilter will be removed from the server itself.Screenshots
No response
TiddlyWiki Configuration
Desktop (please complete the following information):
Additional context
This is part of
tiddlywiki.info
in test wikifolder