TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.98k stars 1.18k forks source link

$:/core/save/all ... $(publishFilter)$ doesn't work #4252

Closed pmario closed 5 years ago

pmario commented 5 years ago

to reproduce

Jermolene commented 5 years ago

Hi @pmario indeed, the template is rendered without global macros. The publish filter is intended to be used by creating a new template that defines the variable and then transcludes the main template. This reflects the fact that normally one wouldn't want it to be a global setting.

pmario commented 5 years ago

hmm, I've been struggling with this setting for ages and I consider myself a power user. The doc says, it is a global setting: https://tiddlywiki.com/#SavingMechanism point 4 ...

IMO it has to be a global setting:

$:/core/save/all tiddler is used in 2 other templates:

The config: $:/config/SaveWikiButton/Template is used in $:/core/ui/Buttons/save-wiki the "standard" save button.

With those connections in place $(publishFilter)$ needs to be global, because it's the only place that works for all elements that would probably want to save the wiki.

auto-save needs to work too!!!

If I need to overwrite many different core tiddlers on my own, "publishFilter" doesn't make sense. IMO we introduced it, so we don't need to overwrite $:/core/save/all.

$:/core/save/all is also used as a hardcoded fallback tiddler in several core modules. ... I don't see an other way as a global variable.

AnthonyMuscio commented 5 years ago

This issue may explain some strange save issue I have had. I would like to see a small set of "big Green Buttons" in Control panel > saving that allows saving

The save mechanism is core to functionality and modifications are both not straightforward and will potentially break things. There for I suggest serving such "features on a plate". If nothing else this acts as an emergency save and also makes any wiki a source of an empty wiki.

Jermolene commented 5 years ago

Hi @pmario we could fix this by adding an import pragma to the top of $:/core/save/all. However, that's quite a performance hit, and so I wonder whether it would make more sense to use a tiddler rather than a variable:

\define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ -[subfilter{$:/config/publish-filter}]
\end
{{$:/core/templates/tiddlywiki5.html}}
pmario commented 5 years ago

Can subfilter handle dirrerent filter runs? publishFilter can be anything -[[run] +[[run]]

Jermolene commented 5 years ago

Hi @pmario

Can subfilter handle dirrerent filter runs? publishFilter can be anything -[[run] +[[run]]

Indeed, the tiddler approach is less flexible.

I'll tentatively add the import pragma and let you give it some testing.