add new store.info.template and store.info.tiddler.template tiddlers

the info.tiddler.template is tagged: $:/tags/InfoTiddlerTemplate so
several tagged tiddlers can be injected, if needed.

Important: The templates have to use the TW HTML template syntax

On branch 6684-add-last-saved-timestamp
Changes to be committed:
	new file:   core/templates/store.info.template.html.tid
	new file:   core/templates/store.info.tiddler.template.tid
This commit is contained in:
pmario 2024-01-31 10:40:35 +01:00
parent d7d9c83fea
commit c89b351cb4
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,21 @@
title: $:/core/templates/store.info.template.html
\whitespace trim
<!-- Unencrypted -->
<$list filter="[[$:/isEncrypted]get[text]else[no]match[no]]">
<$list filter="[[storeAreaFormat]is[variable]getvariable[]else[json]match[json]]">
<!-- New-style JSON store area -->
`<script class="tiddlywiki-tiddler-store" type="application/json">[`
<$let
newline={{{ [charcode[10]] }}}
join=`,$(newline)$`
>
<$text text=<<newline>>/>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/InfoTiddlerTemplate]]">
<$transclude mode=block/>
</$list>
<$text text=<<newline>>/>
</$let>
`]</script>`
</$list>
</$list>

View File

@ -0,0 +1,22 @@
title: $:/core/templates/store.info.tiddler.template
tags: $:/tags/InfoTiddlerTemplate
<!-- This template will be injected into the html file when the wiki is saved. It is activated by $:/core/templates/store.info.template.html -->
\whitespace trim
\procedure readableFormat() [UTC]YYYY-0MM-0DD 0hh:0mm:0ss.0XXX UTC TZD
<!-- It's needed to use variables, to have the absolute same timestamp for all tiddlers -->
<$let
timestamp={{{ [<now format:[UTC]YYYY0MM0DD0hh0mm0ss0XXX>] }}}
timeReadable={{{ [<timestamp>format:date<readableFormat>] }}}
>
<% if [{$:/info/browser}match[yes]] %>
`{"title": "$:/info/last-saved/timestamp", "created":"`<<timestamp>>`", "modified":"`<<timestamp>>`", "text":"`<<timestamp>>`"}`
<$text text=<<join>>/>
`{"title": "$:/info/last-saved/date", "created":"`<<timestamp>>`", "modified":"`<<timestamp>>`", "text":"`<<timeReadable>>`"}`
<% elseif [{$:/info/node}match[yes]] %>
`{"title": "$:/info/server-created-wiki/timestamp", "created":"`<<timestamp>>`", "modified":"`<<timestamp>>`", "text":"`<<timestamp>>`"}`
<$text text=<<join>>/>
`{"title": "$:/info/server-created-wiki/date", "created":"`<<timestamp>>`", "modified":"`<<timestamp>>`", "text":"`<<timeReadable>>`"}`
<% endif %>
</$let>