Index: VERSION ================================================================== --- VERSION +++ VERSION @@ -1,1 +1,1 @@ -0.22.0 +0.23.0-dev Index: cmd/cmd_run.go ================================================================== --- cmd/cmd_run.go +++ cmd/cmd_run.go @@ -93,43 +93,45 @@ if assetDir := kern.GetConfig(kernel.WebService, kernel.WebAssetDir).(string); assetDir != "" { const assetPrefix = "/assets/" webSrv.Handle(assetPrefix, http.StripPrefix(assetPrefix, http.FileServer(http.Dir(assetDir)))) webSrv.Handle("/favicon.ico", wui.MakeFaviconHandler(assetDir)) } + + const isAPI = true // Web user interface if !authManager.IsReadonly() { - webSrv.AddListRoute('c', server.MethodGet, wui.MakeGetZettelFromListHandler(&ucQuery, &ucEvaluate, ucListRoles, ucListSyntax)) - webSrv.AddListRoute('c', server.MethodPost, wui.MakePostCreateZettelHandler(&ucCreateZettel)) - webSrv.AddZettelRoute('c', server.MethodGet, wui.MakeGetCreateZettelHandler( - ucGetZettel, &ucCreateZettel, ucListRoles, ucListSyntax)) - webSrv.AddZettelRoute('c', server.MethodPost, wui.MakePostCreateZettelHandler(&ucCreateZettel)) - webSrv.AddZettelRoute('d', server.MethodGet, wui.MakeGetDeleteZettelHandler(ucGetZettel, ucGetAllZettel)) - webSrv.AddZettelRoute('d', server.MethodPost, wui.MakePostDeleteZettelHandler(&ucDelete)) - webSrv.AddZettelRoute('e', server.MethodGet, wui.MakeEditGetZettelHandler(ucGetZettel, ucListRoles, ucListSyntax)) - webSrv.AddZettelRoute('e', server.MethodPost, wui.MakeEditSetZettelHandler(&ucUpdate)) - } - webSrv.AddListRoute('g', server.MethodGet, wui.MakeGetGoActionHandler(&ucRefresh)) - webSrv.AddListRoute('h', server.MethodGet, wui.MakeListHTMLMetaHandler(&ucQuery, &ucTagZettel, &ucRoleZettel, &ucReIndex)) - webSrv.AddZettelRoute('h', server.MethodGet, wui.MakeGetHTMLZettelHandler(&ucEvaluate, ucGetZettel)) - webSrv.AddListRoute('i', server.MethodGet, wui.MakeGetLoginOutHandler()) - webSrv.AddListRoute('i', server.MethodPost, wui.MakePostLoginHandler(&ucAuthenticate)) - webSrv.AddZettelRoute('i', server.MethodGet, wui.MakeGetInfoHandler( + webSrv.AddListRoute(!isAPI, 'c', server.MethodGet, wui.MakeGetZettelFromListHandler(&ucQuery, &ucEvaluate, ucListRoles, ucListSyntax)) + webSrv.AddListRoute(!isAPI, 'c', server.MethodPost, wui.MakePostCreateZettelHandler(&ucCreateZettel)) + webSrv.AddZettelRoute(!isAPI, 'c', server.MethodGet, wui.MakeGetCreateZettelHandler( + ucGetZettel, &ucCreateZettel, ucListRoles, ucListSyntax)) + webSrv.AddZettelRoute(!isAPI, 'c', server.MethodPost, wui.MakePostCreateZettelHandler(&ucCreateZettel)) + webSrv.AddZettelRoute(!isAPI, 'd', server.MethodGet, wui.MakeGetDeleteZettelHandler(ucGetZettel, ucGetAllZettel)) + webSrv.AddZettelRoute(!isAPI, 'd', server.MethodPost, wui.MakePostDeleteZettelHandler(&ucDelete)) + webSrv.AddZettelRoute(!isAPI, 'e', server.MethodGet, wui.MakeEditGetZettelHandler(ucGetZettel, ucListRoles, ucListSyntax)) + webSrv.AddZettelRoute(!isAPI, 'e', server.MethodPost, wui.MakeEditSetZettelHandler(&ucUpdate)) + } + webSrv.AddListRoute(!isAPI, 'g', server.MethodGet, wui.MakeGetGoActionHandler(&ucRefresh)) + webSrv.AddListRoute(!isAPI, 'h', server.MethodGet, wui.MakeListHTMLMetaHandler(&ucQuery, &ucTagZettel, &ucRoleZettel, &ucReIndex)) + webSrv.AddZettelRoute(!isAPI, 'h', server.MethodGet, wui.MakeGetHTMLZettelHandler(&ucEvaluate, ucGetZettel)) + webSrv.AddListRoute(!isAPI, 'i', server.MethodGet, wui.MakeGetLoginOutHandler()) + webSrv.AddListRoute(!isAPI, 'i', server.MethodPost, wui.MakePostLoginHandler(&ucAuthenticate)) + webSrv.AddZettelRoute(!isAPI, 'i', server.MethodGet, wui.MakeGetInfoHandler( ucParseZettel, ucGetReferences, &ucEvaluate, ucGetZettel, ucGetAllZettel, &ucQuery)) // API - webSrv.AddListRoute('a', server.MethodPost, a.MakePostLoginHandler(&ucAuthenticate)) - webSrv.AddListRoute('a', server.MethodPut, a.MakeRenewAuthHandler()) - webSrv.AddZettelRoute('r', server.MethodGet, a.MakeGetReferencesHandler(ucParseZettel, ucGetReferences)) - webSrv.AddListRoute('x', server.MethodGet, a.MakeGetDataHandler(ucVersion)) - webSrv.AddListRoute('x', server.MethodPost, a.MakePostCommandHandler(&ucIsAuth, &ucRefresh)) - webSrv.AddListRoute('z', server.MethodGet, a.MakeQueryHandler(&ucQuery, &ucTagZettel, &ucRoleZettel, &ucReIndex)) - webSrv.AddZettelRoute('z', server.MethodGet, a.MakeGetZettelHandler(ucGetZettel, ucParseZettel, ucEvaluate)) + webSrv.AddListRoute(isAPI, 'a', server.MethodPost, a.MakePostLoginHandler(&ucAuthenticate)) + webSrv.AddListRoute(isAPI, 'a', server.MethodPut, a.MakeRenewAuthHandler()) + webSrv.AddZettelRoute(isAPI, 'r', server.MethodGet, a.MakeGetReferencesHandler(ucParseZettel, ucGetReferences)) + webSrv.AddListRoute(isAPI, 'x', server.MethodGet, a.MakeGetDataHandler(ucVersion)) + webSrv.AddListRoute(isAPI, 'x', server.MethodPost, a.MakePostCommandHandler(&ucIsAuth, &ucRefresh)) + webSrv.AddListRoute(isAPI, 'z', server.MethodGet, a.MakeQueryHandler(&ucQuery, &ucTagZettel, &ucRoleZettel, &ucReIndex)) + webSrv.AddZettelRoute(isAPI, 'z', server.MethodGet, a.MakeGetZettelHandler(ucGetZettel, ucParseZettel, ucEvaluate)) if !authManager.IsReadonly() { - webSrv.AddListRoute('z', server.MethodPost, a.MakePostCreateZettelHandler(&ucCreateZettel)) - webSrv.AddZettelRoute('z', server.MethodPut, a.MakeUpdateZettelHandler(&ucUpdate)) - webSrv.AddZettelRoute('z', server.MethodDelete, a.MakeDeleteZettelHandler(&ucDelete)) + webSrv.AddListRoute(isAPI, 'z', server.MethodPost, a.MakePostCreateZettelHandler(&ucCreateZettel)) + webSrv.AddZettelRoute(isAPI, 'z', server.MethodPut, a.MakeUpdateZettelHandler(&ucUpdate)) + webSrv.AddZettelRoute(isAPI, 'z', server.MethodDelete, a.MakeDeleteZettelHandler(&ucDelete)) } if authManager.WithAuth() { webSrv.SetUserRetriever(usecase.NewGetUserByZid(boxManager)) } Index: docs/manual/00001004010000.zettel ================================================================== --- docs/manual/00001004010000.zettel +++ docs/manual/00001004010000.zettel @@ -2,11 +2,11 @@ title: Zettelstore startup configuration role: manual tags: #configuration #manual #zettelstore syntax: zmk created: 20210126175322 -modified: 20250627155145 +modified: 20250828135622 The configuration file, specified by the ''-c CONFIGFILE'' [[command line option|00001004051000]], allows you to specify some startup options. These cannot be stored in a [[configuration zettel|00001004020000]] because they are needed before Zettelstore can start or because of security reasons. For example, Zettelstore needs to know in advance on which network address it must listen or where zettel are stored. An attacker that is able to change the owner can do anything. @@ -49,11 +49,10 @@ If no ''box-uri-1'' key is given, the overall effect will be the same as if only ''box-uri-1'' was specified with the value ""dir://.zettel"". In this case, even a key ''box-uri-2'' will be ignored. ; [!debug-mode|''debug-mode''] : If set to [[true|00001006030500]], allows to debug the Zettelstore software (mostly used by Zettelstore developers). - Disables any timeout values of the internal web server and does not send some security-related data. Sets [[''log-level''|#log-level]] to ""debug"". Enables [[''runtime-profiling''|#runtime-profiling]]. Do not enable it for a production server. Index: docs/manual/00001004051000.zettel ================================================================== --- docs/manual/00001004051000.zettel +++ docs/manual/00001004051000.zettel @@ -2,11 +2,11 @@ title: The ''run'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk created: 20210126175322 -modified: 20250627160733 +modified: 20250828135353 === ``zettelstore run`` This starts the web service. ``` @@ -24,15 +24,13 @@ ; [!d|''-d DIR''] : Specifies ''DIR'' as the directory that contains all zettel. Default is ''./zettel'' (''.\\zettel'' on Windows), where ''.'' denotes the ""current directory"". ; [!debug|''-debug''] -: Allows better debugging of the internal web server by disabling any timeout values. - You should specify this only as a developer. - Especially do not enable it for a production server. +: Allows debugging of the internal web server. + Same as setting [[''debug-mode''|00001004010000#debug-mode]] to ""true"". - [[https://blog.cloudflare.com/exposing-go-on-the-internet/#timeouts]] contains a good explanation for the usefulness of sensitive timeout values. ; [!p|''-p PORT''] : Specifies the integer value ''PORT'' as the TCP port, where the Zettelstore web server listens for requests. Default: 23123. Index: docs/manual/00001006030000.zettel ================================================================== --- docs/manual/00001006030000.zettel +++ docs/manual/00001006030000.zettel @@ -2,19 +2,21 @@ title: Supported Key Types role: manual tags: #manual #meta #reference #zettel #zettelstore syntax: zmk created: 20210126175322 -modified: 20250115172354 +modified: 20250708154024 All [[supported metadata keys|00001006020000]] conform to a type. User-defined metadata keys conform also to a type, based on the suffix of the key. |=Suffix|Type | ''-date'' | [[Timestamp|00001006034500]] | ''-number'' | [[Number|00001006033000]] +| ''-ref'' | [[Identifier|00001006032000]] +| ''-refs'' | [[IdentifierSet|00001006032500]] | ''-role'' | [[Word|00001006035500]] | ''-time'' | [[Timestamp|00001006034500]] | ''-url'' | [[URL|00001006035000]] | ''-zettel'' | [[Identifier|00001006032000]] | ''-zid'' | [[Identifier|00001006032000]] Index: docs/manual/00001010000000.zettel ================================================================== --- docs/manual/00001010000000.zettel +++ docs/manual/00001010000000.zettel @@ -2,11 +2,11 @@ title: Security role: manual tags: #configuration #manual #security #zettelstore syntax: zmk created: 20210126175322 -modified: 20250102212014 +modified: 20250828121450 Your zettel may contain sensitive content. You probably want to ensure that only authorized persons can read and/or modify them. Zettelstore ensures this in various ways. @@ -63,6 +63,6 @@ To enforce encryption, [[authenticated sessions|00001010040700]] are marked as secure by default. If you still want to access the Zettelstore remotely without encryption, you must change the startup configuration. Otherwise, authentication will not work. -* [[Use a server for encryption|00001010090100]] +* [[Use a server, also for encryption|00001010090100]] Index: docs/manual/00001010090100.zettel ================================================================== --- docs/manual/00001010090100.zettel +++ docs/manual/00001010090100.zettel @@ -1,12 +1,12 @@ id: 00001010090100 -title: External server to encrypt message transport +title: External server, also to encrypt message transport role: manual tags: #configuration #encryption #manual #security #zettelstore syntax: zmk created: 20210126175322 -modified: 20250701125905 +modified: 20250828135632 Since Zettelstore does not encrypt the messages it exchanges with its clients, you may need some additional software to enable encryption. === Public-key encryption To enable encryption, you probably use some kind of encryption keys. @@ -67,5 +67,18 @@ This will forward requests with the prefix ""/manual/"" to the running Zettelstore. All other requests will be handled by Caddy itself. In this case you must specify the [[startup configuration key ''url-prefix''|00001004010000#url-prefix]] with the value ""/manual/"". This is to allow Zettelstore to ignore the prefix while reading web requests and to give the correct URLs with the given prefix when sending a web response. + +=== Cross-origin protection + +Zettelstore protects you against [[Cross-Site Request Forgery (CSRF)|https://developer.mozilla.org/en-US/docs/Web/Security/Attacks/CSRF]]. +The protection will work only if the external server forwards certain HTTP request headers to Zettelstore: + +* [[''Sec-Fetch-Site''|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Site]] is read first and should contain the values ""same-origin"" or ""none"". +* [[''Origin''|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin]] is read next, if ''Sec-Fetch-Site'' is either missing or contains other values. + In this case ''Origin'' should contain the same host name as read via header [[''Host''|https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Host]]. + +Otherwise, an cross-origin request will be detected. + +To debug the configuration of the external server, Zettelstore will log the received header values, if Zettelstore is run with the [[''-debug''|00001004051000#debug]] parameter. Index: docs/manual/00001012920525.zettel ================================================================== --- docs/manual/00001012920525.zettel +++ docs/manual/00001012920525.zettel @@ -2,11 +2,11 @@ title: SHTML Encoding role: manual tags: #api #manual #reference #zettelstore syntax: zmk created: 20230316181044 -modified: 20250102180003 +modified: 20250806192348 A zettel representation that is a [[s-expression|00001012930000]], syntactically similar to the [[Sz encoding|00001012920516]], but denotes [[HTML|00001012920510]] semantics. It is derived from a XML encoding in s-expressions, called [[SXML|https://en.wikipedia.org/wiki/SXML]]. It is (relatively) easy to parse and contains everything to transform it into real HTML. @@ -30,7 +30,7 @@ This allows a more space economic storage of data. An HTML tag like ``< a href="link">Text`` is encoded in SHTML with a list, where the first element is a symbol named a the tag. The second element is an optional encoding of the tag's attributes. Further elements are either other tag encodings or a string. -The above tag is encoded as ``(a (@ (href . "link")) "Text")``. -Also possible is to encode the attribute without pairs: ``(a (@ (href "link")) "Text")`` (note the missing full stop character). +The above tag is encoded as ``(a ((href . "link")) "Text")``. +Also possible is to encode the attribute without pairs: ``(a ((href "link")) "Text")`` (note the missing full stop character). Index: docs/manual/00001018000000.zettel ================================================================== --- docs/manual/00001018000000.zettel +++ docs/manual/00001018000000.zettel @@ -2,11 +2,11 @@ title: Troubleshooting role: manual tags: #manual #zettelstore syntax: zmk created: 20211027105921 -modified: 20250627130445 +modified: 20250828140447 This page lists some problems and their solutions that may occur when using your Zettelstore. === Installation * **Problem:** When you double-click on the Zettelstore executable icon, macOS complains that Zettelstore is an application from an unknown developer. @@ -23,10 +23,14 @@ ** **Explanation:** A local running Zettelstore typically means, that you are accessing the Zettelstore using a URL with schema ''http://'', and not ''https://'', for example ''http://localhost:23123/''. The difference between these two is the missing encryption of user name / password and for the answer of the Zettelstore if you use the ''http://'' schema. To be secure by default, the Zettelstore will not work in an insecure environment. ** **Solution 1:** If you are sure that your communication medium is safe, even if you use the ''http:/\/'' schema (for example, you are running the Zettelstore on the same computer you are working on, or if the Zettelstore is running on a computer in your protected local network), then you could add the entry ''insecure-cookie: true'' in your [[startup configuration|00001004010000#insecure-cookie]] file. ** **Solution 2:** If you are not sure about the security of your communication medium (for example, if unknown persons might use your local network), then you should run an [[external server|00001010090100]] in front of your Zettelstore to enable the use of the ''https://'' schema. +* **Problem:** [[Authentication is enabled|00001010040100]] for a Zettelstore running behind an external server (e.g. for encryption) + Entering user name and password produces an error message, stating that a ""cross-origin request"" was detected. +** **Explanation:** The external web server dos not transfer needed HTTP header data to your Zettelstore. +** **Solution:** Try to run Zettelstore in debug mode, as described in [[Cross-origin protection|00001010090100#cross-origin-protection]]. === Working with Zettel Files * **Problem:** When you delete a zettel file by removing it from the ""disk"", e.g. by dropping it into the trash folder, by dragging into another folder, or by removing it from the command line, Zettelstore sometimes does not detect the change. If you access the zettel via Zettelstore, an error is reported. ** **Explanation:** Sometimes, the operating system does not tell Zettelstore about the removed zettel. Index: go.mod ================================================================== --- go.mod +++ go.mod @@ -1,21 +1,21 @@ module zettelstore.de/z -go 1.24 +go 1.25 require ( github.com/fsnotify/fsnotify v1.9.0 - github.com/yuin/goldmark v1.7.12 - golang.org/x/crypto v0.39.0 - golang.org/x/term v0.32.0 + github.com/yuin/goldmark v1.7.13 + golang.org/x/crypto v0.41.0 + golang.org/x/term v0.34.0 t73f.de/r/sx v0.0.0-20250707071435-95b82f7d24bb - t73f.de/r/sxwebs v0.0.0-20250707071704-c44197610ee4 - t73f.de/r/webs v0.0.0-20250707071548-227f3e99db55 + t73f.de/r/sxwebs v0.0.0-20250806170342-a33d11a3e7c5 + t73f.de/r/webs v0.0.0-20250723141744-5e8deae4d17b t73f.de/r/zero v0.0.0-20250703105709-bb38976d4455 - t73f.de/r/zsc v0.0.0-20250707072124-be388711ad2a + t73f.de/r/zsc v0.0.0-20250825142132-c4bc92002e77 t73f.de/r/zsx v0.0.0-20250707071920-5e29047e4db7 ) require ( - golang.org/x/sys v0.33.0 // indirect - golang.org/x/text v0.26.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect ) Index: go.sum ================================================================== --- go.sum +++ go.sum @@ -1,24 +1,24 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY= -github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= -golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= -golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= -golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= -golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= -golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= -golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= -golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA= +github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= t73f.de/r/sx v0.0.0-20250707071435-95b82f7d24bb h1:cYvTOpaJinh/EPB7i8nx7PtT7hniuSP+NZr74P9U+fE= t73f.de/r/sx v0.0.0-20250707071435-95b82f7d24bb/go.mod h1:uglbFdRHlcpQVVyCNh4Fd7jbKo8alGBCjRp0aZv8IIg= -t73f.de/r/sxwebs v0.0.0-20250707071704-c44197610ee4 h1:WbT8qQAQjqx1S0syci6yWi+YiNQFFYVBkOSfSYIRid4= -t73f.de/r/sxwebs v0.0.0-20250707071704-c44197610ee4/go.mod h1:zSel+qtBHV9NglxDHlFFPwvaetlZh4H0pLyd7OkpkpQ= -t73f.de/r/webs v0.0.0-20250707071548-227f3e99db55 h1:gl4XpbrzrtAFDY+4V9bixLTUruhzEcwvfKiZi1NqJY4= -t73f.de/r/webs v0.0.0-20250707071548-227f3e99db55/go.mod h1:b8/5E5Pe6WSWqh+T+sxLO5ZLiGVkuL5tgh86kx2OAIg= +t73f.de/r/sxwebs v0.0.0-20250806170342-a33d11a3e7c5 h1:7r1SP0h9QySrRDz9qYWZ/xuEEyJi3XYHtxRIoW2BhoM= +t73f.de/r/sxwebs v0.0.0-20250806170342-a33d11a3e7c5/go.mod h1:CvFDV0czGR0qFVdTYrdy8WIIu5OvA3tFD/td1mim/lA= +t73f.de/r/webs v0.0.0-20250723141744-5e8deae4d17b h1:LmJ0STcaUyGgH2jVa/nKifmJedl0njdnMwPxqX6zLQg= +t73f.de/r/webs v0.0.0-20250723141744-5e8deae4d17b/go.mod h1:b8/5E5Pe6WSWqh+T+sxLO5ZLiGVkuL5tgh86kx2OAIg= t73f.de/r/zero v0.0.0-20250703105709-bb38976d4455 h1:TFRPPexX2WrwuF03hC+Be2ONx2bPzMMBlNDn0rk88eI= t73f.de/r/zero v0.0.0-20250703105709-bb38976d4455/go.mod h1:Ovx7CYsjz45BNuIEMGZfqA7NdQxERydJqUGnOBoQaXQ= -t73f.de/r/zsc v0.0.0-20250707072124-be388711ad2a h1:p12BTQ8TdKZy6GcCRgVINKSeoMz0wBPcNG7ssYvLNrc= -t73f.de/r/zsc v0.0.0-20250707072124-be388711ad2a/go.mod h1:JnkeoahGBxNK0gDcTnAIfDP2rAP33BtnAU1/rCEewC8= +t73f.de/r/zsc v0.0.0-20250825142132-c4bc92002e77 h1:6lVP6GncOfcja9dgPYp8xpT64ifNcIxjbIiIkrQWxXQ= +t73f.de/r/zsc v0.0.0-20250825142132-c4bc92002e77/go.mod h1:ACj+29+EDXQcxHqixxiiIyEfXHZ/SyH28YBVRjBzSk8= t73f.de/r/zsx v0.0.0-20250707071920-5e29047e4db7 h1:ERxpb1Hqln+NXoZDK6sqjmX3BzeoLO+O64f4bK0B6dk= t73f.de/r/zsx v0.0.0-20250707071920-5e29047e4db7/go.mod h1:64/AjQ1GnEBoBhXI1D0bDMGDj7JCbtZUTT3WoA7kS0s= Index: internal/box/constbox/base.sxn ================================================================== --- internal/box/constbox/base.sxn +++ internal/box/constbox/base.sxn @@ -10,53 +10,53 @@ ;;; SPDX-License-Identifier: EUPL-1.2 ;;; SPDX-FileCopyrightText: 2023-present Detlef Stern ;;;---------------------------------------------------------------------------- `(@@@@ -(html ,@(if lang `((@ (lang ,lang)))) +(html ,@(if lang `(((lang ,lang)))) (head - (meta (@ (charset "utf-8"))) - (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) - (meta (@ (name "generator") (content "Zettelstore"))) - (meta (@ (name "format-detection") (content "telephone=no"))) + (meta ((charset "utf-8"))) + (meta ((name "viewport") (content "width=device-width, initial-scale=1.0"))) + (meta ((name "generator") (content "Zettelstore"))) + (meta ((name "format-detection") (content "telephone=no"))) ,@META-HEADER - (link (@ (rel "stylesheet") (href ,css-base-url))) - (link (@ (rel "stylesheet") (href ,css-user-url))) + (link ((rel "stylesheet") (href ,css-base-url))) + (link ((rel "stylesheet") (href ,css-user-url))) ,@(ROLE-DEFAULT-meta (current-frame)) ,@(let* ((frame (current-frame))(rem (resolve-symbol 'ROLE-EXTRA-meta frame))) (if (defined? rem) (rem frame))) (title ,title)) (body - (nav (@ (class "zs-menu")) - (a (@ (href ,home-url)) "Home") - ,@(if with-auth - `((div (@ (class "zs-dropdown")) - (button "User") - (nav (@ (class "zs-dropdown-content")) - ,@(if user-is-valid - `((a (@ (href ,user-zettel-url)) ,user-ident) - (a (@ (href ,logout-url)) "Logout")) - `((a (@ (href ,login-url)) "Login")) - ) - ))) - ) - (div (@ (class "zs-dropdown")) - (button "Lists") - (nav (@ (class "zs-dropdown-content")) - ,@list-urls - ,@(if (symbol-bound? 'refresh-url) `((a (@ (href ,refresh-url)) "Refresh"))) - )) - ,@(if new-zettel-links - `((div (@ (class "zs-dropdown")) - (button "New") - (nav (@ (class "zs-dropdown-content")) - ,@(map wui-link new-zettel-links) - ))) - ) - (search (form (@ (action ,search-url)) - (input (@ (type "search") (inputmode "search") (name ,query-key-query) - (title "General search field, with same behaviour as search field in search result list") - (placeholder "Search..") (dir "auto"))))) - ) - (main (@ (class "content")) ,DETAIL) + (nav ((class "zs-menu")) + ,(wui-href home-url "Home") + ,@(if with-auth + `((div ((class "zs-dropdown")) + (button "User") + (nav ((class "zs-dropdown-content")) + ,@(if user-is-valid + `(,(wui-href user-zettel-url user-ident) + ,(wui-href logout-url "Logout")) + `(,(wui-href login-url "Login")) + ) + ))) + ) + (div ((class "zs-dropdown")) + (button "Lists") + (nav ((class "zs-dropdown-content")) + ,@list-urls + ,(if (symbol-bound? 'refresh-url) (wui-href refresh-url "Refresh")) + )) + ,@(if new-zettel-links + `((div ((class "zs-dropdown")) + (button "New") + (nav ((class "zs-dropdown-content")) + ,@(map wui-link new-zettel-links) + ))) + ) + (search (form ((action ,search-url)) + (input ((type "search") (inputmode "search") (name ,query-key-query) + (title "General search field, with same behaviour as search field in search result list") + (placeholder "Search..") (dir "auto"))))) + ) + (main ((class "content")) ,DETAIL) ,@(if FOOTER `((footer (hr) ,@FOOTER))) ,@(if debug-mode '((div (b "WARNING: Debug mode is enabled. DO NOT USE IN PRODUCTION!")))) ))) Index: internal/box/constbox/constbox.go ================================================================== --- internal/box/constbox/constbox.go +++ internal/box/constbox/constbox.go @@ -164,71 +164,71 @@ constHeader{ meta.KeyTitle: "Zettelstore Base HTML Template", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20230510155100", - meta.KeyModified: "20250623131400", + meta.KeyModified: "20250806182400", meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentBaseSxn)}, id.ZidLoginTemplate: { constHeader{ meta.KeyTitle: "Zettelstore Login Form HTML Template", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20200804111624", - meta.KeyModified: "20240219145200", + meta.KeyModified: "20250806182600", meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentLoginSxn)}, id.ZidZettelTemplate: { constHeader{ meta.KeyTitle: "Zettelstore Zettel HTML Template", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20230510155300", - meta.KeyModified: "20250626113800", + meta.KeyModified: "20250806182700", meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentZettelSxn)}, id.ZidInfoTemplate: { constHeader{ meta.KeyTitle: "Zettelstore Info HTML Template", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20200804111624", - meta.KeyModified: "20250624160000", + meta.KeyModified: "20250806182500", meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentInfoSxn)}, id.ZidFormTemplate: { constHeader{ meta.KeyTitle: "Zettelstore Form HTML Template", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20200804111624", - meta.KeyModified: "20250612180300", + meta.KeyModified: "20250806182500", meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentFormSxn)}, id.ZidDeleteTemplate: { constHeader{ meta.KeyTitle: "Zettelstore Delete HTML Template", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20200804111624", - meta.KeyModified: "20250612180200", + meta.KeyModified: "20250806182500", meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentDeleteSxn)}, id.ZidListTemplate: { constHeader{ meta.KeyTitle: "Zettelstore List Zettel HTML Template", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20230704122100", - meta.KeyModified: "20250612180200", + meta.KeyModified: "20250806182600", meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentListZettelSxn)}, id.ZidErrorTemplate: { constHeader{ @@ -255,11 +255,11 @@ constHeader{ meta.KeyTitle: "Zettelstore Sxn Base Code", meta.KeyRole: meta.ValueRoleConfiguration, meta.KeySyntax: meta.ValueSyntaxSxn, meta.KeyCreated: "20230619132800", - meta.KeyModified: "20250624200200", + meta.KeyModified: "20250806182700", meta.KeyReadOnly: meta.ValueTrue, meta.KeyVisibility: meta.ValueVisibilityExpert, }, zettel.NewContent(contentBaseCodeSxn)}, id.ZidBaseCSS: { Index: internal/box/constbox/delete.sxn ================================================================== --- internal/box/constbox/delete.sxn +++ internal/box/constbox/delete.sxn @@ -13,27 +13,27 @@ `(article (header (h1 "Delete Zettel " ,zid)) (p "Do you really want to delete this zettel?") ,@(if shadowed-box - `((div (@ (class "zs-info")) + `((div ((class "zs-info")) (h2 "Information") (p "If you delete this zettel, the previously shadowed zettel from overlayed box " ,shadowed-box " becomes available.") )) ) ,@(if incoming - `((div (@ (class "zs-warning")) + `((div ((class "zs-warning")) (h2 "Warning!") (p "If you delete this zettel, incoming references from the following zettel will become invalid.") (ul ,@(map wui-item-link incoming)) )) ) ,@(if (and (symbol-bound? 'useless) useless) - `((div (@ (class "zs-warning")) + `((div ((class "zs-warning")) (h2 "Warning!") (p "Deleting this zettel will also delete the following files, so that they will not be interpreted as content for this zettel.") (ul ,@(map wui-item useless)) )) ) ,(wui-meta-desc metapairs) - (form (@ (method "POST")) (input (@ (class "zs-primary") (type "submit") (value "Delete")))) + (form ((method "POST")) (input ((class "zs-primary") (type "submit") (value "Delete")))) ) Index: internal/box/constbox/form.sxn ================================================================== --- internal/box/constbox/form.sxn +++ internal/box/constbox/form.sxn @@ -11,53 +11,53 @@ ;;; SPDX-FileCopyrightText: 2023-present Detlef Stern ;;;---------------------------------------------------------------------------- `(article (header (h1 ,heading)) - (form (@ (action ,form-action-url) (method "POST") (enctype "multipart/form-data")) + (form ((action ,form-action-url) (method "POST") (enctype "multipart/form-data")) (div - (label (@ (for "zs-title")) "Title " (a (@ (title "Main heading of this zettel.")) (@H "ⓘ"))) - (input (@ (class "zs-input") (type "text") (id "zs-title") (name "title") + (label ((for "zs-title")) "Title " (a ((title "Main heading of this zettel.")) (@H "ⓘ"))) + (input ((class "zs-input") (type "text") (id "zs-title") (name "title") (title "Title of this zettel") (placeholder "Title..") (value ,meta-title) (dir "auto") (autofocus)))) (div - (label (@ (for "zs-role")) "Role " (a (@ (title "One word, without spaces, to set the main role of this zettel.")) (@H "ⓘ"))) - (input (@ (class "zs-input") (type "text") (pattern "\\w*") (id "zs-role") (name "role") + (label ((for "zs-role")) "Role " (a ((title "One word, without spaces, to set the main role of this zettel.")) (@H "ⓘ"))) + (input ((class "zs-input") (type "text") (pattern "\\w*") (id "zs-role") (name "role") (title "One word, letters and digits, but no spaces, to set the main role of the zettel.") (placeholder "role..") (value ,meta-role) (dir "auto") ,@(if role-data '((list "zs-role-data"))) )) ,@(wui-datalist "zs-role-data" role-data) ) (div - (label (@ (for "zs-tags")) "Tags " (a (@ (title "Tags must begin with an '#' sign. They are separated by spaces.")) (@H "ⓘ"))) - (input (@ (class "zs-input") (type "text") (id "zs-tags") (name "tags") + (label ((for "zs-tags")) "Tags " (a ((title "Tags must begin with an '#' sign. They are separated by spaces.")) (@H "ⓘ"))) + (input ((class "zs-input") (type "text") (id "zs-tags") (name "tags") (title "Tags/keywords to categorize the zettel. Each tags is a word that begins with a '#' character; they are separated by spaces") (placeholder "#tag") (value ,meta-tags) (dir "auto")))) (div - (label (@ (for "zs-meta")) "Metadata " (a (@ (title "Other metadata for this zettel. Each line contains a key/value pair, separated by a colon ':'.")) (@H "ⓘ"))) - (textarea (@ (class "zs-input") (id "zs-meta") (name "meta") (rows "4") + (label ((for "zs-meta")) "Metadata " (a ((title "Other metadata for this zettel. Each line contains a key/value pair, separated by a colon ':'.")) (@H "ⓘ"))) + (textarea ((class "zs-input") (id "zs-meta") (name "meta") (rows "4") (title "Additional metadata about the zettel") (placeholder "metakey: metavalue") (dir "auto")) ,meta)) (div - (label (@ (for "zs-syntax")) "Syntax " (a (@ (title "Syntax of zettel content below, one word. Typically 'zmk' (for zettelmarkup).")) (@H "ⓘ"))) - (input (@ (class "zs-input") (type "text") (pattern "\\w*") (id "zs-syntax") (name "syntax") + (label ((for "zs-syntax")) "Syntax " (a ((title "Syntax of zettel content below, one word. Typically 'zmk' (for zettelmarkup).")) (@H "ⓘ"))) + (input ((class "zs-input") (type "text") (pattern "\\w*") (id "zs-syntax") (name "syntax") (title "Syntax/format of zettel content below, one word, letters and digits, no spaces.") (placeholder "syntax..") (value ,meta-syntax) (dir "auto") ,@(if syntax-data '((list "zs-syntax-data"))) )) ,@(wui-datalist "zs-syntax-data" syntax-data) ) ,@(if (symbol-bound? 'content) `((div - (label (@ (for "zs-content")) "Content " (a (@ (title "Content for this zettel, according to above syntax.")) (@H "ⓘ"))) - (textarea (@ (class "zs-input zs-content") (id "zs-content") (name "content") (rows "20") + (label ((for "zs-content")) "Content " (a ((title "Content for this zettel, according to above syntax.")) (@H "ⓘ"))) + (textarea ((class "zs-input zs-content") (id "zs-content") (name "content") (rows "20") (title "Zettel content, according to the given syntax") (placeholder "Zettel content..") (dir "auto")) ,content) )) ) (div - (input (@ (class "zs-primary") (type "submit") (value "Submit"))) - (input (@ (class "zs-secondary") (type "submit") (value "Save") (formaction "?save"))) - (input (@ (class "zs-upload") (type "file") (id "zs-file") (name "file"))) + (input ((class "zs-primary") (type "submit") (value "Submit"))) + (input ((class "zs-secondary") (type "submit") (value "Save") (formaction "?save"))) + (input ((class "zs-upload") (type "file") (id "zs-file") (name "file"))) )) ) Index: internal/box/constbox/info.sxn ================================================================== --- internal/box/constbox/info.sxn +++ internal/box/constbox/info.sxn @@ -12,22 +12,22 @@ ;;;---------------------------------------------------------------------------- `(article (header (h1 "Information for Zettel " ,zid) (p - (a (@ (href ,web-url)) "Web") - ,@(if (symbol-bound? 'edit-url) `((@H " · ") (a (@ (href ,edit-url)) "Edit"))) - (@H " · ") (a (@ (href ,context-full-url)) "Full Context") + ,(wui-href web-url "Web") + ,@(if (symbol-bound? 'edit-url) `((@H " · ") ,(wui-href edit-url "Edit"))) + (@H " · ") ,(wui-href context-full-url "Full Context") ,@(if (symbol-bound? 'thread-query-url) - `((@H " · [") (a (@ (href ,thread-query-url)) "Thread") - ,@(if (symbol-bound? 'folge-query-url) `((@H ", ") (a (@ (href ,folge-query-url)) "Folge"))) - ,@(if (symbol-bound? 'sequel-query-url) `((@H ", ") (a (@ (href ,sequel-query-url)) "Sequel"))) + `((@H " · [") ,(wui-href thread-query-url "Thread") + ,@(if (symbol-bound? 'folge-query-url) `((@H ", ") ,(wui-href folge-query-url "Folge"))) + ,@(if (symbol-bound? 'sequel-query-url) `((@H ", ") ,(wui-href sequel-query-url "Sequel"))) (@H "]"))) ,@(ROLE-DEFAULT-actions (current-frame)) ,@(let* ((frame (current-frame))(rea (resolve-symbol 'ROLE-EXTRA-actions frame))) (if (defined? rea) (rea frame))) - ,@(if (symbol-bound? 'reindex-url) `((@H " · ") (a (@ (href ,reindex-url)) "Reindex"))) - ,@(if (symbol-bound? 'delete-url) `((@H " · ") (a (@ (href ,delete-url)) "Delete"))) + ,@(if (symbol-bound? 'reindex-url) `((@H " · ") ,(wui-href reindex-url "Reindex"))) + ,@(if (symbol-bound? 'delete-url) `((@H " · ") ,(wui-href delete-url "Delete"))) ) ) (h2 "Interpreted Metadata") (table ,@(map wui-info-meta-table-row metadata)) (h2 "References") @@ -35,12 +35,12 @@ ,@(if query-links `((h3 "Queries") (ul ,@(map wui-item-link query-links)))) ,@(if ext-links `((h3 "External") (ul ,@(map wui-item-popup-link ext-links)))) (h3 "Unlinked") ,@unlinked-content (form - (label (@ (for "phrase")) "Search Phrase") - (input (@ (class "zs-input") (type "text") (id "phrase") (name ,query-key-phrase) (placeholder "Phrase..") (value ,phrase))) + (label ((for "phrase")) "Search Phrase") + (input ((class "zs-input") (type "text") (id "phrase") (name ,query-key-phrase) (placeholder "Phrase..") (value ,phrase))) ) (h2 "Parts and encodings") ,(wui-enc-matrix enc-eval) (h3 "Parsed (not evaluated)") ,(wui-enc-matrix enc-parsed) Index: internal/box/constbox/listzettel.sxn ================================================================== --- internal/box/constbox/listzettel.sxn +++ internal/box/constbox/listzettel.sxn @@ -11,40 +11,40 @@ ;;; SPDX-FileCopyrightText: 2023-present Detlef Stern ;;;---------------------------------------------------------------------------- `(article (header (h1 ,heading)) - (search (form (@ (action ,search-url)) - (input (@ (class "zs-input") (type "search") (inputmode "search") (name ,query-key-query) + (search (form ((action ,search-url)) + (input ((class "zs-input") (type "search") (inputmode "search") (name ,query-key-query) (title "Contains the search that leads to the list below. You're allowed to modify it") (placeholder "Search..") (value ,query-value) (dir "auto"))))) ,@(if (symbol-bound? 'tag-zettel) - `((p (@ (class "zs-meta-zettel")) "Tag zettel: " ,@tag-zettel)) + `((p ((class "zs-meta-zettel")) "Tag zettel: " ,@tag-zettel)) ) ,@(if (symbol-bound? 'create-tag-zettel) - `((p (@ (class "zs-meta-zettel")) "Create tag zettel: " ,@create-tag-zettel)) + `((p ((class "zs-meta-zettel")) "Create tag zettel: " ,@create-tag-zettel)) ) ,@(if (symbol-bound? 'role-zettel) - `((p (@ (class "zs-meta-zettel")) "Role zettel: " ,@role-zettel)) + `((p ((class "zs-meta-zettel")) "Role zettel: " ,@role-zettel)) ) ,@(if (symbol-bound? 'create-role-zettel) - `((p (@ (class "zs-meta-zettel")) "Create role zettel: " ,@create-role-zettel)) + `((p ((class "zs-meta-zettel")) "Create role zettel: " ,@create-role-zettel)) ) ,@content ,@endnotes - (form (@ (action ,(if (symbol-bound? 'create-url) create-url))) + (form ((action ,(if (symbol-bound? 'create-url) create-url))) ,(if (symbol-bound? 'data-url) `(@L "Other encodings" ,(if (> num-entries 3) `(@L " of these " ,num-entries " entries: ") ": ") - (a (@ (href ,data-url)) "data") + ,(wui-href data-url "data") ", " - (a (@ (href ,plain-url)) "plain") + ,(wui-href plain-url "plain") ) ) ,@(if (symbol-bound? 'create-url) - `((input (@ (type "hidden") (name ,query-key-query) (value ,query-value))) - (input (@ (type "hidden") (name ,query-key-seed) (value ,seed))) - (input (@ (class "zs-primary") (type "submit") (value "Save As Zettel"))) + `((input ((type "hidden") (name ,query-key-query) (value ,query-value))) + (input ((type "hidden") (name ,query-key-seed) (value ,seed))) + (input ((class "zs-primary") (type "submit") (value "Save As Zettel"))) ) ) ) ) Index: internal/box/constbox/login.sxn ================================================================== --- internal/box/constbox/login.sxn +++ internal/box/constbox/login.sxn @@ -11,17 +11,17 @@ ;;; SPDX-FileCopyrightText: 2023-present Detlef Stern ;;;---------------------------------------------------------------------------- `(article (header (h1 "Login")) - ,@(if retry '((div (@ (class "zs-indication zs-error")) "Wrong user name / password. Try again."))) - (form (@ (method "POST") (action "")) - (div - (label (@ (for "username")) "User name:") - (input (@ (class "zs-input") (type "text") (id "username") (name "username") (placeholder "Your user name..") (autofocus)))) - (div - (label (@ (for "password")) "Password:") - (input (@ (class "zs-input") (type "password") (id "password") (name "password") (placeholder "Your password..")))) - (div - (input (@ (class "zs-primary") (type "submit") (value "Login")))) + ,@(if retry '((div ((class "zs-indication zs-error")) "Wrong user name / password. Try again."))) + (form ((method "POST") (action "")) + (div + (label ((for "username")) "User name:") + (input ((class "zs-input") (type "text") (id "username") (name "username") (placeholder "Your user name..") (autofocus)))) + (div + (label ((for "password")) "Password:") + (input ((class "zs-input") (type "password") (id "password") (name "password") (placeholder "Your password..")))) + (div + (input ((class "zs-primary") (type "submit") (value "Login")))) ) ) Index: internal/box/constbox/wuicode.sxn ================================================================== --- internal/box/constbox/wuicode.sxn +++ internal/box/constbox/wuicode.sxn @@ -17,17 +17,20 @@ (defun wui-item (s) `(li ,s)) ;; wui-info-meta-table-row takes a pair and translates it into a HTML table row ;; with two columns. (defun wui-info-meta-table-row (p) - `(tr (td (@ (class zs-info-meta-key)) ,(car p)) (td (@ (class zs-info-meta-value)) ,(cdr p)))) + `(tr (td ((class zs-info-meta-key)) ,(car p)) (td ((class zs-info-meta-value)) ,(cdr p)))) + +;; wui-href builds an HTML link +(defun wui-href (url text . attrs) `(a ((href ,url) ,@attrs) ,text)) ;; wui-local-link translates a local link into HTML. -(defun wui-local-link (l) `(li (a (@ (href ,l )) ,l))) +(defun wui-local-link (l) `(li ,(wui-href l l))) ;; wui-link takes a link (title . url) and returns a HTML reference. -(defun wui-link (q) `(a (@ (href ,(cdr q))) ,(car q))) +(defun wui-link (q) (wui-href (cdr q) (car q))) ;; wui-item-link taks a pair (text . url) and returns a HTML link inside ;; a list item. (defun wui-item-link (q) `(li ,(wui-link q))) @@ -36,20 +39,20 @@ (defun wui-tdata-link (q) `(td ,(wui-link q))) ;; wui-item-popup-link is like 'wui-item-link, but the HTML link will open ;; a new tab / window. (defun wui-item-popup-link (e) - `(li (a (@ (href ,e) (target "_blank") (rel "external noreferrer")) ,e))) + `(li ,(wui-href e e '(target "_blank") '(rel "external noreferrer")))) ;; wui-option-value returns a value for an HTML option element. -(defun wui-option-value (v) `(option (@ (value ,v)))) +(defun wui-option-value (v) `(option ((value ,v)))) ;; wui-datalist returns a HTML datalist with the given HTML identifier and a ;; list of values. (defun wui-datalist (id lst) (if lst - `((datalist (@ (id ,id)) ,@(map wui-option-value lst))))) + `((datalist ((id ,id)) ,@(map wui-option-value lst))))) ;; wui-pair-desc-item takes a pair '(term . text) and returns a list with ;; a HTML description term and a HTML description data. (defun wui-pair-desc-item (p) `((dt ,(car p)) (dd ,(cdr p)))) @@ -67,11 +70,11 @@ ;; wui-optional-link puts the text into a link, if symbol is defined. Otherwise just return the text (defun wui-optional-link (text url-sym) (let ((url (resolve-symbol url-sym))) (if (defined? url) - `(a (@ (href ,(resolve-symbol url-sym))) ,text) + (wui-href url text) text))) ;; CSS-ROLE-map is a mapping (pair list, assoc list) of role names to zettel ;; identifier. It is used in the base template to update the metadata of the ;; HTML page to include some role specific CSS code. @@ -82,11 +85,11 @@ ;; specific code should include the returned list of this function. (defun ROLE-DEFAULT-meta (frame) `(,@(let* ((meta-role (resolve-symbol 'meta-role frame)) (entry (assoc CSS-ROLE-map meta-role))) (if (pair? entry) - `((link (@ (rel "stylesheet") (href ,(zid-content-path (cdr entry)))))) + `((link ((rel "stylesheet") (href ,(zid-content-path (cdr entry)))))) ) ) ) ) @@ -94,33 +97,33 @@ (defvar ACTION-SEPARATOR '(@H " · ")) ;; ROLE-DEFAULT-actions returns the default text for actions. (defun ROLE-DEFAULT-actions (frame) `(,@(let ((copy-url (resolve-symbol 'copy-url frame))) - (if (defined? copy-url) `((@H " · ") (a (@ (href ,copy-url)) "Copy")))) + (if (defined? copy-url) `((@H " · ") ,(wui-href copy-url "Copy")))) ,@(let ((sequel-url (resolve-symbol 'sequel-url frame))) - (if (defined? sequel-url) `((@H " · ") (a (@ (href ,sequel-url)) "Sequel")))) + (if (defined? sequel-url) `((@H " · ") ,(wui-href sequel-url "Sequel")))) ,@(let ((folge-url (resolve-symbol 'folge-url frame))) - (if (defined? folge-url) `((@H " · ") (a (@ (href ,folge-url)) "Folge")))) + (if (defined? folge-url) `((@H " · ") ,(wui-href folge-url "Folge")))) ) ) ;; ROLE-tag-actions returns an additional action "Zettel" for zettel with role "tag". (defun ROLE-tag-actions (frame) `(,@(let ((title (resolve-symbol 'title frame))) (if (and (defined? title) title) - `(,ACTION-SEPARATOR (a (@ (href ,(query->url (concat "tags:" title)))) "Zettel")) + `(,ACTION-SEPARATOR ,(wui-href (query->url (concat "tags:" title)) "Zettel")) ) ) ) ) ;; ROLE-role-actions returns an additional action "Zettel" for zettel with role "role". (defun ROLE-role-actions (frame) `(,@(let ((title (resolve-symbol 'title frame))) (if (and (defined? title) title) - `(,ACTION-SEPARATOR (a (@ (href ,(query->url (concat "role:" title)))) "Zettel")) + `(,ACTION-SEPARATOR ,(wui-href (query->url (concat "role:" title)) "Zettel")) ) ) ) ) Index: internal/box/constbox/zettel.sxn ================================================================== --- internal/box/constbox/zettel.sxn +++ internal/box/constbox/zettel.sxn @@ -12,21 +12,21 @@ ;;;---------------------------------------------------------------------------- `(article (header (h1 ,heading) - (div (@ (class "zs-meta")) - ,@(if (symbol-bound? 'edit-url) `((a (@ (href ,edit-url)) "Edit") (@H " · "))) + (div ((class "zs-meta")) + ,@(if (symbol-bound? 'edit-url) `(,(wui-href edit-url "Edit") (@H " · "))) ,zid (@H " · ") - (a (@ (href ,info-url)) "Info") (@H " · ") - "(" ,@(if (symbol-bound? 'role-url) `((a (@ (href ,role-url)) ,meta-role))) + ,(wui-href info-url "Info") (@H " · ") + "(" ,@(if (symbol-bound? 'role-url) `(,(wui-href role-url meta-role))) ,@(if (and (symbol-bound? 'folge-role-url) (symbol-bound? 'meta-folge-role)) - `((@H " → ") (a (@ (href ,folge-role-url)) ,meta-folge-role))) + `((@H " → ") ,(wui-href folge-role-url meta-folge-role))) ")" ,@(if tag-refs `((@H " · ") ,@tag-refs)) - (@H " · ") (a (@ (href ,context-url)) "Context") - ,@(if (symbol-bound? 'thread-query-url) `((@H " · ") (a (@ (href ,thread-query-url)) "Thread"))) + (@H " · ") ,(wui-href context-url "Context") + ,@(if (symbol-bound? 'thread-query-url) `((@H " · ") ,(wui-href thread-query-url "Thread"))) ,@(ROLE-DEFAULT-actions (current-frame)) ,@(let* ((frame (current-frame))(rea (resolve-symbol 'ROLE-EXTRA-actions frame))) (if (defined? rea) (rea frame))) ,@(if superior-refs `((br) "Superior: " ,superior-refs)) ,@(if prequel-refs `((br) ,(wui-optional-link "Prequel" 'sequel-query-url) ": " ,prequel-refs)) ,@(if precursor-refs `((br) ,(wui-optional-link "Precursor" 'folge-query-url) ": " ,precursor-refs)) @@ -37,17 +37,17 @@ ,@content ,endnotes ,@(if (or folge-links sequel-links back-links subordinate-links) `((nav ,@(if folge-links - `((details (@ (,folge-open)) + `((details ((,folge-open)) (summary ,(wui-optional-link "Folgezettel" 'folge-query-url)) (ul ,@(map wui-item-link folge-links))))) ,@(if sequel-links - `((details (@ (,sequel-open)) + `((details ((,sequel-open)) (summary ,(wui-optional-link "Sequel" 'sequel-query-url)) (ul ,@(map wui-item-link sequel-links))))) - ,@(if subordinate-links `((details (@ (,subordinate-open)) (summary "Subordinates") (ul ,@(map wui-item-link subordinate-links))))) - ,@(if back-links `((details (@ (,back-open)) (summary "Incoming") (ul ,@(map wui-item-link back-links))))) + ,@(if subordinate-links `((details ((,subordinate-open)) (summary "Subordinates") (ul ,@(map wui-item-link subordinate-links))))) + ,@(if back-links `((details ((,back-open)) (summary "Incoming") (ul ,@(map wui-item-link back-links))))) )) ) ) Index: internal/encoder/encoder_blob_test.go ================================================================== --- internal/encoder/encoder_blob_test.go +++ internal/encoder/encoder_blob_test.go @@ -43,11 +43,11 @@ 0x42, 0x60, 0x82, }, expect: expectMap{ encoderHTML: `
Hello\nWorld
",
encoderMD: "",
encoderSz: `(BLOCK (VERBATIM-EVAL () "Hello\nWorld"))`,
- encoderSHTML: "((pre (code (@ (class . \"zs-eval\")) \"Hello\\nWorld\")))",
+ encoderSHTML: "((pre (code ((class . \"zs-eval\")) \"Hello\\nWorld\")))",
encoderText: "Hello\nWorld",
encoderZmk: useZmk,
},
},
{
@@ -271,11 +271,11 @@
zmk: "$$$\nHello\n\\LaTeX\n$$$",
expect: expectMap{
encoderHTML: "Hello\n\\LaTeX
",
encoderMD: "",
encoderSz: `(BLOCK (VERBATIM-MATH () "Hello\n\\LaTeX"))`,
- encoderSHTML: "((pre (code (@ (class . \"zs-math\")) \"Hello\\n\\\\LaTeX\")))",
+ encoderSHTML: "((pre (code ((class . \"zs-math\")) \"Hello\\n\\\\LaTeX\")))",
encoderText: "Hello\n\\LaTeX",
encoderZmk: useZmk,
},
},
{
@@ -334,11 +334,11 @@
|f1|f2|=f3`,
expect: expectMap{
encoderHTML: `h1 | h2 | h3 |
---|---|---|
c1 | c2 | c3 |
f1 | f2 | =f3 |
Text1
Text1
„quotes“
`, encoderMD: "„quotes“", encoderSz: `(BLOCK (PARA (FORMAT-QUOTE (("lang" . "de")) (TEXT "quotes"))))`, - encoderSHTML: `((p (span (@ (lang . "de")) (@H "„") "quotes" (@H "“"))))`, + encoderSHTML: `((p (span ((lang . "de")) (@H "„") "quotes" (@H "“"))))`, encoderText: `quotes`, encoderZmk: `""quotes""{lang="de"}`, }, }, { @@ -187,11 +187,11 @@ zmk: `""""{lang=unknown}`, expect: expectMap{ encoderHTML: `""
`, encoderMD: """", encoderSz: `(BLOCK (PARA (FORMAT-QUOTE (("lang" . "unknown")))))`, - encoderSHTML: `((p (span (@ (lang . "unknown")) (@H """ """))))`, + encoderSHTML: `((p (span ((lang . "unknown")) (@H """ """))))`, encoderText: ``, encoderZmk: `""""{lang="unknown"}`, }, }, { @@ -307,11 +307,11 @@ zmk: `$$\TeX$$`, expect: expectMap{ encoderHTML: `\TeX
« abc »
`, encoderMD: "« abc »", encoderSz: `(BLOCK (PARA (FORMAT-SPAN (("lang" . "fr")) (FORMAT-QUOTE () (TEXT "abc")))))`, - encoderSHTML: `((p (span (@ (lang . "fr")) (@L (@H "«" " ") "abc" (@H " " "»")))))`, + encoderSHTML: `((p (span ((lang . "fr")) (@L (@H "«" " ") "abc" (@H " " "»")))))`, encoderText: `abc`, encoderZmk: `::""abc""::{lang="fr"}`, }, }, { @@ -414,11 +414,11 @@ zmk: `[^endnote]`, expect: expectMap{ encoderHTML: `