Index: Makefile
==================================================================
--- Makefile
+++ Makefile
@@ -5,15 +5,18 @@
##
## Zettelstore is licensed under the latest version of the EUPL (European Union
## Public License). Please see file LICENSE.txt for your rights and obligations
## under this license.
-.PHONY: check api build release clean
+.PHONY: check relcheck api build release clean
check:
go run tools/build.go check
+relcheck:
+ go run tools/build.go relcheck
+
api:
go run tools/build.go testapi
version:
@echo $(shell go run tools/build.go version)
Index: README.md
==================================================================
--- README.md
+++ README.md
@@ -10,10 +10,16 @@
“Zettelstore”.
To get an initial impression, take a look at the
[manual](https://zettelstore.de/manual/). It is a live example of the
zettelstore software, running in read-only mode.
+
+[Zettelstore Client](https://zettelstore.de/client) provides client
+software to access Zettelstore via its API more easily, [Zettelstore
+Contrib](https://zettelstore.de/contrib) contains contributed software, which
+often connects to Zettelstore via its API. Some of the software packages may be
+experimental.
The software, including the manual, is licensed
under the [European Union Public License 1.2 (or
later)](https://zettelstore.de/home/file?name=LICENSE.txt&ci=trunk).
Index: VERSION
==================================================================
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
-0.0.15
+0.1.2
DELETED api/api.go
Index: api/api.go
==================================================================
--- api/api.go
+++ /dev/null
@@ -1,85 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2021 Detlef Stern
-//
-// This file is part of zettelstore.
-//
-// Zettelstore is licensed under the latest version of the EUPL (European Union
-// Public License). Please see file LICENSE.txt for your rights and obligations
-// under this license.
-//-----------------------------------------------------------------------------
-
-// Package api contains common definition used for client and server.
-package api
-
-// AuthJSON contains the result of an authentication call.
-type AuthJSON struct {
- Token string `json:"token"`
- Type string `json:"token_type"`
- Expires int `json:"expires_in"`
-}
-
-// ZidJSON contains the identifier data of a zettel.
-type ZidJSON struct {
- ID string `json:"id"`
-}
-
-// ZidMetaJSON contains the identifier and the metadata of a zettel.
-type ZidMetaJSON struct {
- ID string `json:"id"`
- Meta map[string]string `json:"meta"`
-}
-
-// ZidMetaRelatedList contains identifier/metadata of a zettel and the same for related zettel
-type ZidMetaRelatedList struct {
- ID string `json:"id"`
- Meta map[string]string `json:"meta"`
- List []ZidMetaJSON `json:"list"`
-}
-
-// ZettelLinksJSON store all links / connections from one zettel to other.
-type ZettelLinksJSON struct {
- ID string `json:"id"`
- Linked struct {
- Incoming []string `json:"incoming,omitempty"`
- Outgoing []string `json:"outgoing,omitempty"`
- Local []string `json:"local,omitempty"`
- External []string `json:"external,omitempty"`
- Meta []string `json:"meta,omitempty"`
- } `json:"linked"`
- Embedded struct {
- Outgoing []string `json:"outgoing,omitempty"`
- Local []string `json:"local,omitempty"`
- External []string `json:"external,omitempty"`
- } `json:"embedded,omitempty"`
- Cites []string `json:"cites,omitempty"`
-}
-
-// ZettelDataJSON contains all data for a zettel.
-type ZettelDataJSON struct {
- Meta map[string]string `json:"meta"`
- Encoding string `json:"encoding"`
- Content string `json:"content"`
-}
-
-// ZettelJSON contains all data for a zettel, the identifier, the metadata, and the content.
-type ZettelJSON struct {
- ID string `json:"id"`
- Meta map[string]string `json:"meta"`
- Encoding string `json:"encoding"`
- Content string `json:"content"`
-}
-
-// ZettelListJSON contains data for a zettel list.
-type ZettelListJSON struct {
- List []ZidMetaJSON `json:"list"`
-}
-
-// TagListJSON specifies the list/map of tags
-type TagListJSON struct {
- Tags map[string][]string `json:"tags"`
-}
-
-// RoleListJSON specifies the list of roles.
-type RoleListJSON struct {
- Roles []string `json:"role-list"`
-}
DELETED api/const.go
Index: api/const.go
==================================================================
--- api/const.go
+++ /dev/null
@@ -1,104 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2021 Detlef Stern
-//
-// This file is part of zettelstore.
-//
-// Zettelstore is licensed under the latest version of the EUPL (European Union
-// Public License). Please see file LICENSE.txt for your rights and obligations
-// under this license.
-//-----------------------------------------------------------------------------
-
-// Package api contains common definition used for client and server.
-package api
-
-import "fmt"
-
-// Additional HTTP constants used.
-const (
- MethodMove = "MOVE" // HTTP method for renaming a zettel
-
- HeaderAccept = "Accept"
- HeaderContentType = "Content-Type"
- HeaderDestination = "Destination"
- HeaderLocation = "Location"
-)
-
-// Values for HTTP query parameter.
-const (
- QueryKeyDepth = "depth"
- QueryKeyDir = "dir"
- QueryKeyEncoding = "_enc"
- QueryKeyLimit = "_limit"
- QueryKeyNegate = "_negate"
- QueryKeyOffset = "_offset"
- QueryKeyOrder = "_order"
- QueryKeyPart = "_part"
- QueryKeySearch = "_s"
- QueryKeySort = "_sort"
-)
-
-// Supported dir values.
-const (
- DirBackward = "backward"
- DirForward = "forward"
-)
-
-// Supported encoding values.
-const (
- EncodingDJSON = "djson"
- EncodingHTML = "html"
- EncodingNative = "native"
- EncodingText = "text"
- EncodingZMK = "zmk"
-)
-
-var mapEncodingEnum = map[string]EncodingEnum{
- EncodingDJSON: EncoderDJSON,
- EncodingHTML: EncoderHTML,
- EncodingNative: EncoderNative,
- EncodingText: EncoderText,
- EncodingZMK: EncoderZmk,
-}
-var mapEnumEncoding = map[EncodingEnum]string{}
-
-func init() {
- for k, v := range mapEncodingEnum {
- mapEnumEncoding[v] = k
- }
-}
-
-// Encoder returns the internal encoder code for the given encoding string.
-func Encoder(encoding string) EncodingEnum {
- if e, ok := mapEncodingEnum[encoding]; ok {
- return e
- }
- return EncoderUnknown
-}
-
-// EncodingEnum lists all valid encoder keys.
-type EncodingEnum uint8
-
-// Values for EncoderEnum
-const (
- EncoderUnknown EncodingEnum = iota
- EncoderDJSON
- EncoderHTML
- EncoderNative
- EncoderText
- EncoderZmk
-)
-
-// String representation of an encoder key.
-func (e EncodingEnum) String() string {
- if f, ok := mapEnumEncoding[e]; ok {
- return f
- }
- return fmt.Sprintf("*Unknown*(%d)", e)
-}
-
-// Supported part values.
-const (
- PartMeta = "meta"
- PartContent = "content"
- PartZettel = "zettel"
-)
DELETED api/urlbuilder.go
Index: api/urlbuilder.go
==================================================================
--- api/urlbuilder.go
+++ /dev/null
@@ -1,114 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2020-2021 Detlef Stern
-//
-// This file is part of zettelstore.
-//
-// Zettelstore is licensed under the latest version of the EUPL (European Union
-// Public License). Please see file LICENSE.txt for your rights and obligations
-// under this license.
-//-----------------------------------------------------------------------------
-
-// Package api contains common definition used for client and server.
-package api
-
-import (
- "net/url"
- "strings"
-
- "zettelstore.de/z/domain/id"
-)
-
-type urlQuery struct{ key, val string }
-
-// URLBuilder should be used to create zettelstore URLs.
-type URLBuilder struct {
- prefix string
- key byte
- path []string
- query []urlQuery
- fragment string
-}
-
-// NewURLBuilder creates a new URL builder with the given prefix and key.
-func NewURLBuilder(prefix string, key byte) *URLBuilder {
- return &URLBuilder{prefix: prefix, key: key}
-}
-
-// Clone an URLBuilder
-func (ub *URLBuilder) Clone() *URLBuilder {
- cpy := new(URLBuilder)
- cpy.key = ub.key
- if len(ub.path) > 0 {
- cpy.path = make([]string, 0, len(ub.path))
- cpy.path = append(cpy.path, ub.path...)
- }
- if len(ub.query) > 0 {
- cpy.query = make([]urlQuery, 0, len(ub.query))
- cpy.query = append(cpy.query, ub.query...)
- }
- cpy.fragment = ub.fragment
- return cpy
-}
-
-// SetZid sets the zettel identifier.
-func (ub *URLBuilder) SetZid(zid id.Zid) *URLBuilder {
- if len(ub.path) > 0 {
- panic("Cannot add Zid")
- }
- ub.path = append(ub.path, zid.String())
- return ub
-}
-
-// AppendPath adds a new path element
-func (ub *URLBuilder) AppendPath(p string) *URLBuilder {
- ub.path = append(ub.path, p)
- return ub
-}
-
-// AppendQuery adds a new query parameter
-func (ub *URLBuilder) AppendQuery(key, value string) *URLBuilder {
- ub.query = append(ub.query, urlQuery{key, value})
- return ub
-}
-
-// ClearQuery removes all query parameters.
-func (ub *URLBuilder) ClearQuery() *URLBuilder {
- ub.query = nil
- ub.fragment = ""
- return ub
-}
-
-// SetFragment stores the fragment
-func (ub *URLBuilder) SetFragment(s string) *URLBuilder {
- ub.fragment = s
- return ub
-}
-
-// String produces a string value.
-func (ub *URLBuilder) String() string {
- var sb strings.Builder
-
- sb.WriteString(ub.prefix)
- if ub.key != '/' {
- sb.WriteByte(ub.key)
- }
- for _, p := range ub.path {
- sb.WriteByte('/')
- sb.WriteString(url.PathEscape(p))
- }
- if len(ub.fragment) > 0 {
- sb.WriteByte('#')
- sb.WriteString(ub.fragment)
- }
- for i, q := range ub.query {
- if i == 0 {
- sb.WriteByte('?')
- } else {
- sb.WriteByte('&')
- }
- sb.WriteString(q.key)
- sb.WriteByte('=')
- sb.WriteString(url.QueryEscape(q.val))
- }
- return sb.String()
-}
Index: ast/inline.go
==================================================================
--- ast/inline.go
+++ ast/inline.go
@@ -199,26 +199,23 @@
// FormatKind specifies the format that is applied to the inline nodes.
type FormatKind uint8
// Constants for FormatCode
const (
- _ FormatKind = iota
- FormatItalic // Italic text.
- FormatEmph // Semantically emphasized text.
- FormatBold // Bold text.
- FormatStrong // Semantically strongly emphasized text.
- FormatUnder // Underlined text.
- FormatInsert // Inserted text.
- FormatStrike // Text that is no longer relevant or no longer accurate.
- FormatDelete // Deleted text.
- FormatSuper // Superscripted text.
- FormatSub // SubscriptedText.
- FormatQuote // Quoted text.
- FormatQuotation // Quotation text.
- FormatSmall // Smaller text.
- FormatSpan // Generic inline container.
- FormatMonospace // Monospaced text.
+ _ FormatKind = iota
+ FormatEmph // Emphasized text.
+ FormatStrong // Strongly emphasized text.
+ FormatInsert // Inserted text.
+ FormatDelete // Deleted text.
+ FormatSuper // Superscripted text.
+ FormatSub // SubscriptedText.
+ FormatQuote // Quoted text.
+ FormatQuotation // Quotation text.
+ FormatSmall // Smaller text.
+ FormatSpan // Generic inline container.
+ FormatMonospace // Monospaced text.
+ FormatEmphDeprecated // Deprecated kind of emphasized text.
)
func (*FormatNode) inlineNode() { /* Just a marker */ }
// WalkChildren walks to the formatted text.
Index: ast/ref.go
==================================================================
--- ast/ref.go
+++ ast/ref.go
@@ -35,11 +35,11 @@
u, err := url.Parse(s)
if err != nil {
return &Reference{URL: nil, Value: s, State: RefStateInvalid}
}
if len(u.Scheme)+len(u.Opaque)+len(u.Host) == 0 && u.User == nil {
- if _, err := id.Parse(u.Path); err == nil {
+ if _, err = id.Parse(u.Path); err == nil {
return &Reference{URL: u, Value: s, State: RefStateZettel}
}
if u.Path == "" && u.Fragment != "" {
return &Reference{URL: u, Value: s, State: RefStateSelf}
}
Index: auth/impl/impl.go
==================================================================
--- auth/impl/impl.go
+++ auth/impl/impl.go
@@ -17,10 +17,11 @@
"io"
"time"
"github.com/pascaldekloe/jwt"
+ "zettelstore.de/c/api"
"zettelstore.de/z/auth"
"zettelstore.de/z/auth/policy"
"zettelstore.de/z/box"
"zettelstore.de/z/config"
"zettelstore.de/z/domain/id"
@@ -81,14 +82,14 @@
// ErrNoZid signals that the 'zid' key is missing.
var ErrNoZid = errors.New("auth: missing zettel id")
// GetToken returns a token to be used for authentification.
func (a *myAuth) GetToken(ident *meta.Meta, d time.Duration, kind auth.TokenKind) ([]byte, error) {
- if role, ok := ident.Get(meta.KeyRole); !ok || role != meta.ValueRoleUser {
+ if role, ok := ident.Get(api.KeyRole); !ok || role != api.ValueRoleUser {
return nil, ErrNoUser
}
- subject, ok := ident.Get(meta.KeyUserID)
+ subject, ok := ident.Get(api.KeyUserID)
if !ok || subject == "" {
return nil, ErrNoIdent
}
now := time.Now().Round(time.Second)
@@ -131,12 +132,12 @@
ident := claims.Subject
if ident == "" {
return auth.TokenData{}, ErrNoIdent
}
if zidS, ok := claims.Set["zid"].(string); ok {
- if zid, err := id.Parse(zidS); err == nil {
- if kind, ok := claims.Set["_tk"].(float64); ok {
+ if zid, err2 := id.Parse(zidS); err2 == nil {
+ if kind, ok2 := claims.Set["_tk"].(float64); ok2 {
if auth.TokenKind(kind) == k {
return auth.TokenData{
Token: token,
Now: now,
Issued: claims.Issued.Time(),
@@ -169,11 +170,11 @@
return meta.UserRoleOwner
}
if a.IsOwner(user.Zid) {
return meta.UserRoleOwner
}
- if val, ok := user.Get(meta.KeyUserRole); ok {
+ if val, ok := user.Get(api.KeyUserRole); ok {
if ur := meta.GetUserRole(val); ur != meta.UserRoleUnknown {
return ur
}
}
return meta.UserRoleReader
Index: auth/policy/default.go
==================================================================
--- auth/policy/default.go
+++ auth/policy/default.go
@@ -10,46 +10,47 @@
// Package policy provides some interfaces and implementation for authorizsation policies.
package policy
import (
+ "zettelstore.de/c/api"
"zettelstore.de/z/auth"
"zettelstore.de/z/domain/meta"
)
type defaultPolicy struct {
manager auth.AuthzManager
}
-func (d *defaultPolicy) CanCreate(user, newMeta *meta.Meta) bool { return true }
-func (d *defaultPolicy) CanRead(user, m *meta.Meta) bool { return true }
-func (d *defaultPolicy) CanWrite(user, oldMeta, newMeta *meta.Meta) bool {
+func (*defaultPolicy) CanCreate(_, _ *meta.Meta) bool { return true }
+func (*defaultPolicy) CanRead(_, _ *meta.Meta) bool { return true }
+func (d *defaultPolicy) CanWrite(user, oldMeta, _ *meta.Meta) bool {
return d.canChange(user, oldMeta)
}
func (d *defaultPolicy) CanRename(user, m *meta.Meta) bool { return d.canChange(user, m) }
func (d *defaultPolicy) CanDelete(user, m *meta.Meta) bool { return d.canChange(user, m) }
func (d *defaultPolicy) canChange(user, m *meta.Meta) bool {
- metaRo, ok := m.Get(meta.KeyReadOnly)
+ metaRo, ok := m.Get(api.KeyReadOnly)
if !ok {
return true
}
if user == nil {
// If we are here, there is no authentication.
// See owner.go:CanWrite.
// No authentication: check for owner-like restriction, because the user
// acts as an owner
- return metaRo != meta.ValueUserRoleOwner && !meta.BoolValue(metaRo)
+ return metaRo != api.ValueUserRoleOwner && !meta.BoolValue(metaRo)
}
userRole := d.manager.GetUserRole(user)
switch metaRo {
- case meta.ValueUserRoleReader:
+ case api.ValueUserRoleReader:
return userRole > meta.UserRoleReader
- case meta.ValueUserRoleWriter:
+ case api.ValueUserRoleWriter:
return userRole > meta.UserRoleWriter
- case meta.ValueUserRoleOwner:
+ case api.ValueUserRoleOwner:
return userRole > meta.UserRoleOwner
}
return !meta.BoolValue(metaRo)
}
Index: auth/policy/owner.go
==================================================================
--- auth/policy/owner.go
+++ auth/policy/owner.go
@@ -10,10 +10,11 @@
// Package policy provides some interfaces and implementation for authorizsation policies.
package policy
import (
+ "zettelstore.de/c/api"
"zettelstore.de/z/auth"
"zettelstore.de/z/config"
"zettelstore.de/z/domain/meta"
)
@@ -32,11 +33,11 @@
func (o *ownerPolicy) userCanCreate(user, newMeta *meta.Meta) bool {
if o.manager.GetUserRole(user) == meta.UserRoleReader {
return false
}
- if role, ok := newMeta.Get(meta.KeyRole); ok && role == meta.ValueRoleUser {
+ if role, ok := newMeta.Get(api.KeyRole); ok && role == api.ValueRoleUser {
return false
}
return true
}
@@ -58,11 +59,11 @@
return true
}
if user == nil {
return false
}
- if role, ok := m.Get(meta.KeyRole); ok && role == meta.ValueRoleUser {
+ if role, ok := m.Get(api.KeyRole); ok && role == api.ValueRoleUser {
// Only the user can read its own zettel
return user.Zid == m.Zid
}
switch o.manager.GetUserRole(user) {
case meta.UserRoleReader, meta.UserRoleWriter, meta.UserRoleOwner:
@@ -73,14 +74,14 @@
return false
}
}
var noChangeUser = []string{
- meta.KeyID,
- meta.KeyRole,
- meta.KeyUserID,
- meta.KeyUserRole,
+ api.KeyID,
+ api.KeyRole,
+ api.KeyUserID,
+ api.KeyUserRole,
}
func (o *ownerPolicy) CanWrite(user, oldMeta, newMeta *meta.Meta) bool {
if user == nil || !o.pre.CanWrite(user, oldMeta, newMeta) {
return false
@@ -93,11 +94,11 @@
return true
}
if !o.userCanRead(user, oldMeta, vis) {
return false
}
- if role, ok := oldMeta.Get(meta.KeyRole); ok && role == meta.ValueRoleUser {
+ if role, ok := oldMeta.Get(api.KeyRole); ok && role == api.ValueRoleUser {
// Here we know, that user.Zid == newMeta.Zid (because of userCanRead) and
// user.Zid == newMeta.Zid (because oldMeta.Zid == newMeta.Zid)
for _, key := range noChangeUser {
if oldMeta.GetDefault(key, "") != newMeta.GetDefault(key, "") {
return false
@@ -144,10 +145,10 @@
return false
}
if o.manager.IsOwner(user.Zid) {
return true
}
- if val, ok := user.Get(meta.KeyUserRole); ok && val == meta.ValueUserRoleOwner {
+ if val, ok := user.Get(api.KeyUserRole); ok && val == api.ValueUserRoleOwner {
return true
}
return false
}
Index: auth/policy/policy_test.go
==================================================================
--- auth/policy/policy_test.go
+++ auth/policy/policy_test.go
@@ -13,10 +13,11 @@
import (
"fmt"
"testing"
+ "zettelstore.de/c/api"
"zettelstore.de/z/auth"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
)
@@ -57,13 +58,13 @@
type testAuthzManager struct {
readOnly bool
withAuth bool
}
-func (a *testAuthzManager) IsReadonly() bool { return a.readOnly }
-func (a *testAuthzManager) Owner() id.Zid { return ownerZid }
-func (a *testAuthzManager) IsOwner(zid id.Zid) bool { return zid == ownerZid }
+func (a *testAuthzManager) IsReadonly() bool { return a.readOnly }
+func (*testAuthzManager) Owner() id.Zid { return ownerZid }
+func (*testAuthzManager) IsOwner(zid id.Zid) bool { return zid == ownerZid }
func (a *testAuthzManager) WithAuth() bool { return a.withAuth }
func (a *testAuthzManager) GetUserRole(user *meta.Meta) meta.UserRole {
if user == nil {
@@ -73,11 +74,11 @@
return meta.UserRoleOwner
}
if a.IsOwner(user.Zid) {
return meta.UserRoleOwner
}
- if val, ok := user.Get(meta.KeyUserRole); ok {
+ if val, ok := user.Get(api.KeyUserRole); ok {
if ur := meta.GetUserRole(val); ur != meta.UserRoleUnknown {
return ur
}
}
return meta.UserRoleReader
@@ -85,12 +86,12 @@
type authConfig struct{ expert bool }
func (ac *authConfig) GetExpertMode() bool { return ac.expert }
-func (ac *authConfig) GetVisibility(m *meta.Meta) meta.Visibility {
- if vis, ok := m.Get(meta.KeyVisibility); ok {
+func (*authConfig) GetVisibility(m *meta.Meta) meta.Visibility {
+ if vis, ok := m.Get(api.KeyVisibility); ok {
return meta.GetVisibility(vis)
}
return meta.VisibilityLogin
}
@@ -249,11 +250,11 @@
loginZettel := newLoginZettel()
ownerZettel := newOwnerZettel()
expertZettel := newExpertZettel()
userZettel := newUserZettel()
writerNew := writer.Clone()
- writerNew.Set(meta.KeyUserRole, owner.GetDefault(meta.KeyUserRole, ""))
+ writerNew.Set(api.KeyUserRole, owner.GetDefault(api.KeyUserRole, ""))
roFalse := newRoFalseZettel()
roTrue := newRoTrueZettel()
roReader := newRoReaderZettel()
roWriter := newRoWriterZettel()
roOwner := newRoOwnerZettel()
@@ -576,109 +577,109 @@
)
func newAnon() *meta.Meta { return nil }
func newCreator() *meta.Meta {
user := meta.New(creatorZid)
- user.Set(meta.KeyTitle, "Creator")
- user.Set(meta.KeyRole, meta.ValueRoleUser)
- user.Set(meta.KeyUserRole, meta.ValueUserRoleCreator)
+ user.Set(api.KeyTitle, "Creator")
+ user.Set(api.KeyRole, api.ValueRoleUser)
+ user.Set(api.KeyUserRole, api.ValueUserRoleCreator)
return user
}
func newReader() *meta.Meta {
user := meta.New(readerZid)
- user.Set(meta.KeyTitle, "Reader")
- user.Set(meta.KeyRole, meta.ValueRoleUser)
- user.Set(meta.KeyUserRole, meta.ValueUserRoleReader)
+ user.Set(api.KeyTitle, "Reader")
+ user.Set(api.KeyRole, api.ValueRoleUser)
+ user.Set(api.KeyUserRole, api.ValueUserRoleReader)
return user
}
func newWriter() *meta.Meta {
user := meta.New(writerZid)
- user.Set(meta.KeyTitle, "Writer")
- user.Set(meta.KeyRole, meta.ValueRoleUser)
- user.Set(meta.KeyUserRole, meta.ValueUserRoleWriter)
+ user.Set(api.KeyTitle, "Writer")
+ user.Set(api.KeyRole, api.ValueRoleUser)
+ user.Set(api.KeyUserRole, api.ValueUserRoleWriter)
return user
}
func newOwner() *meta.Meta {
user := meta.New(ownerZid)
- user.Set(meta.KeyTitle, "Owner")
- user.Set(meta.KeyRole, meta.ValueRoleUser)
- user.Set(meta.KeyUserRole, meta.ValueUserRoleOwner)
+ user.Set(api.KeyTitle, "Owner")
+ user.Set(api.KeyRole, api.ValueRoleUser)
+ user.Set(api.KeyUserRole, api.ValueUserRoleOwner)
return user
}
func newOwner2() *meta.Meta {
user := meta.New(owner2Zid)
- user.Set(meta.KeyTitle, "Owner 2")
- user.Set(meta.KeyRole, meta.ValueRoleUser)
- user.Set(meta.KeyUserRole, meta.ValueUserRoleOwner)
+ user.Set(api.KeyTitle, "Owner 2")
+ user.Set(api.KeyRole, api.ValueRoleUser)
+ user.Set(api.KeyUserRole, api.ValueUserRoleOwner)
return user
}
func newZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(meta.KeyTitle, "Any Zettel")
+ m.Set(api.KeyTitle, "Any Zettel")
return m
}
func newPublicZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(meta.KeyTitle, "Public Zettel")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityPublic)
+ m.Set(api.KeyTitle, "Public Zettel")
+ m.Set(api.KeyVisibility, api.ValueVisibilityPublic)
return m
}
func newCreatorZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(meta.KeyTitle, "Creator Zettel")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityCreator)
+ m.Set(api.KeyTitle, "Creator Zettel")
+ m.Set(api.KeyVisibility, api.ValueVisibilityCreator)
return m
}
func newLoginZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(meta.KeyTitle, "Login Zettel")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityLogin)
+ m.Set(api.KeyTitle, "Login Zettel")
+ m.Set(api.KeyVisibility, api.ValueVisibilityLogin)
return m
}
func newOwnerZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(meta.KeyTitle, "Owner Zettel")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityOwner)
+ m.Set(api.KeyTitle, "Owner Zettel")
+ m.Set(api.KeyVisibility, api.ValueVisibilityOwner)
return m
}
func newExpertZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(meta.KeyTitle, "Expert Zettel")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityExpert)
+ m.Set(api.KeyTitle, "Expert Zettel")
+ m.Set(api.KeyVisibility, api.ValueVisibilityExpert)
return m
}
func newRoFalseZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(meta.KeyTitle, "No r/o Zettel")
- m.Set(meta.KeyReadOnly, "false")
+ m.Set(api.KeyTitle, "No r/o Zettel")
+ m.Set(api.KeyReadOnly, api.ValueFalse)
return m
}
func newRoTrueZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(meta.KeyTitle, "A r/o Zettel")
- m.Set(meta.KeyReadOnly, "true")
+ m.Set(api.KeyTitle, "A r/o Zettel")
+ m.Set(api.KeyReadOnly, api.ValueTrue)
return m
}
func newRoReaderZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(meta.KeyTitle, "Reader r/o Zettel")
- m.Set(meta.KeyReadOnly, meta.ValueUserRoleReader)
+ m.Set(api.KeyTitle, "Reader r/o Zettel")
+ m.Set(api.KeyReadOnly, api.ValueUserRoleReader)
return m
}
func newRoWriterZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(meta.KeyTitle, "Writer r/o Zettel")
- m.Set(meta.KeyReadOnly, meta.ValueUserRoleWriter)
+ m.Set(api.KeyTitle, "Writer r/o Zettel")
+ m.Set(api.KeyReadOnly, api.ValueUserRoleWriter)
return m
}
func newRoOwnerZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(meta.KeyTitle, "Owner r/o Zettel")
- m.Set(meta.KeyReadOnly, meta.ValueUserRoleOwner)
+ m.Set(api.KeyTitle, "Owner r/o Zettel")
+ m.Set(api.KeyReadOnly, api.ValueUserRoleOwner)
return m
}
func newUserZettel() *meta.Meta {
m := meta.New(userZid)
- m.Set(meta.KeyTitle, "Any User")
- m.Set(meta.KeyRole, meta.ValueRoleUser)
+ m.Set(api.KeyTitle, "Any User")
+ m.Set(api.KeyRole, api.ValueRoleUser)
return m
}
Index: box/box.go
==================================================================
--- box/box.go
+++ box/box.go
@@ -16,10 +16,11 @@
"errors"
"fmt"
"io"
"time"
+ "zettelstore.de/c/api"
"zettelstore.de/z/domain"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
"zettelstore.de/z/search"
)
@@ -246,22 +247,22 @@
if err.Zid.IsValid() {
return fmt.Sprintf(
"operation %q on zettel %v not allowed for user %v/%v",
err.Op,
err.Zid.String(),
- err.User.GetDefault(meta.KeyUserID, "?"),
+ err.User.GetDefault(api.KeyUserID, "?"),
err.User.Zid.String())
}
return fmt.Sprintf(
"operation %q not allowed for user %v/%v",
err.Op,
- err.User.GetDefault(meta.KeyUserID, "?"),
+ err.User.GetDefault(api.KeyUserID, "?"),
err.User.Zid.String())
}
// Is return true, if the error is of type ErrNotAllowed.
-func (err *ErrNotAllowed) Is(target error) bool { return true }
+func (*ErrNotAllowed) Is(error) bool { return true }
// ErrStarted is returned when trying to start an already started box.
var ErrStarted = errors.New("box is already started")
// ErrStopped is returned if calling methods on a box that was not started.
Index: box/compbox/compbox.go
==================================================================
--- box/compbox/compbox.go
+++ box/compbox/compbox.go
@@ -13,10 +13,11 @@
import (
"context"
"net/url"
+ "zettelstore.de/c/api"
"zettelstore.de/z/box"
"zettelstore.de/z/box/manager"
"zettelstore.de/z/domain"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
@@ -36,18 +37,18 @@
}
var myConfig *meta.Meta
var myZettel = map[id.Zid]struct {
meta func(id.Zid) *meta.Meta
- content func(*meta.Meta) string
+ content func(*meta.Meta) []byte
}{
- id.VersionZid: {genVersionBuildM, genVersionBuildC},
- id.HostZid: {genVersionHostM, genVersionHostC},
- id.OperatingSystemZid: {genVersionOSM, genVersionOSC},
- id.BoxManagerZid: {genManagerM, genManagerC},
- id.MetadataKeyZid: {genKeysM, genKeysC},
- id.StartupConfigurationZid: {genConfigZettelM, genConfigZettelC},
+ id.MustParse(api.ZidVersion): {genVersionBuildM, genVersionBuildC},
+ id.MustParse(api.ZidHost): {genVersionHostM, genVersionHostC},
+ id.MustParse(api.ZidOperatingSystem): {genVersionOSM, genVersionOSC},
+ id.MustParse(api.ZidBoxManager): {genManagerM, genManagerC},
+ id.MustParse(api.ZidMetadataKey): {genKeysM, genKeysC},
+ id.MustParse(api.ZidStartupConfiguration): {genConfigZettelM, genConfigZettelC},
}
// Get returns the one program box.
func getCompBox(boxNumber int, mf box.Enricher) box.ManagedBox {
return &compBox{number: boxNumber, enricher: mf}
@@ -145,14 +146,14 @@
st.ReadOnly = true
st.Zettel = len(myZettel)
}
func updateMeta(m *meta.Meta) {
- m.Set(meta.KeyNoIndex, meta.ValueTrue)
- m.Set(meta.KeySyntax, meta.ValueSyntaxZmk)
- m.Set(meta.KeyRole, meta.ValueRoleConfiguration)
- m.Set(meta.KeyLang, meta.ValueLangEN)
- m.Set(meta.KeyReadOnly, meta.ValueTrue)
- if _, ok := m.Get(meta.KeyVisibility); !ok {
- m.Set(meta.KeyVisibility, meta.ValueVisibilityExpert)
+ m.Set(api.KeyNoIndex, api.ValueTrue)
+ m.Set(api.KeySyntax, api.ValueSyntaxZmk)
+ m.Set(api.KeyRole, api.ValueRoleConfiguration)
+ m.Set(api.KeyLang, api.ValueLangEN)
+ m.Set(api.KeyReadOnly, api.ValueTrue)
+ if _, ok := m.Get(api.KeyVisibility); !ok {
+ m.Set(api.KeyVisibility, api.ValueVisibilityExpert)
}
}
Index: box/compbox/config.go
==================================================================
--- box/compbox/config.go
+++ box/compbox/config.go
@@ -10,43 +10,44 @@
// Package compbox provides zettel that have computed content.
package compbox
import (
- "strings"
+ "bytes"
+ "zettelstore.de/c/api"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
)
func genConfigZettelM(zid id.Zid) *meta.Meta {
if myConfig == nil {
return nil
}
m := meta.New(zid)
- m.Set(meta.KeyTitle, "Zettelstore Startup Configuration")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityExpert)
+ m.Set(api.KeyTitle, "Zettelstore Startup Configuration")
+ m.Set(api.KeyVisibility, api.ValueVisibilityExpert)
return m
}
-func genConfigZettelC(m *meta.Meta) string {
- var sb strings.Builder
+func genConfigZettelC(*meta.Meta) []byte {
+ var buf bytes.Buffer
for i, p := range myConfig.Pairs(false) {
if i > 0 {
- sb.WriteByte('\n')
+ buf.WriteByte('\n')
}
- sb.WriteString("; ''")
- sb.WriteString(p.Key)
- sb.WriteString("''")
+ buf.WriteString("; ''")
+ buf.WriteString(p.Key)
+ buf.WriteString("''")
if p.Value != "" {
- sb.WriteString("\n: ``")
+ buf.WriteString("\n: ``")
for _, r := range p.Value {
if r == '`' {
- sb.WriteByte('\\')
+ buf.WriteByte('\\')
}
- sb.WriteRune(r)
+ buf.WriteRune(r)
}
- sb.WriteString("``")
+ buf.WriteString("``")
}
}
- return sb.String()
+ return buf.Bytes()
}
Index: box/compbox/keys.go
==================================================================
--- box/compbox/keys.go
+++ box/compbox/keys.go
@@ -10,29 +10,30 @@
// Package compbox provides zettel that have computed content.
package compbox
import (
+ "bytes"
"fmt"
- "strings"
+ "zettelstore.de/c/api"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
)
func genKeysM(zid id.Zid) *meta.Meta {
m := meta.New(zid)
- m.Set(meta.KeyTitle, "Zettelstore Supported Metadata Keys")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityLogin)
+ m.Set(api.KeyTitle, "Zettelstore Supported Metadata Keys")
+ m.Set(api.KeyVisibility, api.ValueVisibilityLogin)
return m
}
-func genKeysC(*meta.Meta) string {
+func genKeysC(*meta.Meta) []byte {
keys := meta.GetSortedKeyDescriptions()
- var sb strings.Builder
- sb.WriteString("|=Name<|=Type<|=Computed?:|=Property?:\n")
+ var buf bytes.Buffer
+ buf.WriteString("|=Name<|=Type<|=Computed?:|=Property?:\n")
for _, kd := range keys {
- fmt.Fprintf(&sb,
+ fmt.Fprintf(&buf,
"|%v|%v|%v|%v\n", kd.Name, kd.Type.Name, kd.IsComputed(), kd.IsProperty())
}
- return sb.String()
+ return buf.Bytes()
}
Index: box/compbox/manager.go
==================================================================
--- box/compbox/manager.go
+++ box/compbox/manager.go
@@ -10,31 +10,32 @@
// Package compbox provides zettel that have computed content.
package compbox
import (
+ "bytes"
"fmt"
- "strings"
+ "zettelstore.de/c/api"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
"zettelstore.de/z/kernel"
)
func genManagerM(zid id.Zid) *meta.Meta {
m := meta.New(zid)
- m.Set(meta.KeyTitle, "Zettelstore Box Manager")
+ m.Set(api.KeyTitle, "Zettelstore Box Manager")
return m
}
-func genManagerC(*meta.Meta) string {
+func genManagerC(*meta.Meta) []byte {
kvl := kernel.Main.GetServiceStatistics(kernel.BoxService)
if len(kvl) == 0 {
- return "No statistics available"
+ return nil
}
- var sb strings.Builder
- sb.WriteString("|=Name|=Value>\n")
+ var buf bytes.Buffer
+ buf.WriteString("|=Name|=Value>\n")
for _, kv := range kvl {
- fmt.Fprintf(&sb, "| %v | %v\n", kv.Key, kv.Value)
+ fmt.Fprintf(&buf, "| %v | %v\n", kv.Key, kv.Value)
}
- return sb.String()
+ return buf.Bytes()
}
Index: box/compbox/version.go
==================================================================
--- box/compbox/version.go
+++ box/compbox/version.go
@@ -10,45 +10,45 @@
// Package compbox provides zettel that have computed content.
package compbox
import (
- "fmt"
-
+ "zettelstore.de/c/api"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
"zettelstore.de/z/kernel"
)
func getVersionMeta(zid id.Zid, title string) *meta.Meta {
m := meta.New(zid)
- m.Set(meta.KeyTitle, title)
- m.Set(meta.KeyVisibility, meta.ValueVisibilityExpert)
+ m.Set(api.KeyTitle, title)
+ m.Set(api.KeyVisibility, api.ValueVisibilityExpert)
return m
}
func genVersionBuildM(zid id.Zid) *meta.Meta {
m := getVersionMeta(zid, "Zettelstore Version")
- m.Set(meta.KeyVisibility, meta.ValueVisibilityPublic)
+ m.Set(api.KeyVisibility, api.ValueVisibilityPublic)
return m
}
-func genVersionBuildC(*meta.Meta) string {
- return kernel.Main.GetConfig(kernel.CoreService, kernel.CoreVersion).(string)
+func genVersionBuildC(*meta.Meta) []byte {
+ return []byte(kernel.Main.GetConfig(kernel.CoreService, kernel.CoreVersion).(string))
}
func genVersionHostM(zid id.Zid) *meta.Meta {
return getVersionMeta(zid, "Zettelstore Host")
}
-func genVersionHostC(*meta.Meta) string {
- return kernel.Main.GetConfig(kernel.CoreService, kernel.CoreHostname).(string)
+func genVersionHostC(*meta.Meta) []byte {
+ return []byte(kernel.Main.GetConfig(kernel.CoreService, kernel.CoreHostname).(string))
}
func genVersionOSM(zid id.Zid) *meta.Meta {
return getVersionMeta(zid, "Zettelstore Operating System")
}
-func genVersionOSC(*meta.Meta) string {
- return fmt.Sprintf(
- "%v/%v",
- kernel.Main.GetConfig(kernel.CoreService, kernel.CoreGoOS).(string),
- kernel.Main.GetConfig(kernel.CoreService, kernel.CoreGoArch).(string),
- )
+func genVersionOSC(*meta.Meta) []byte {
+ goOS := kernel.Main.GetConfig(kernel.CoreService, kernel.CoreGoOS).(string)
+ goArch := kernel.Main.GetConfig(kernel.CoreService, kernel.CoreGoArch).(string)
+ result := make([]byte, 0, len(goOS)+len(goArch)+1)
+ result = append(result, goOS...)
+ result = append(result, '/')
+ return append(result, goArch...)
}
Index: box/constbox/base.css
==================================================================
--- box/constbox/base.css
+++ box/constbox/base.css
@@ -8,13 +8,11 @@
height: 100%;
}
body {
margin: 0;
min-height: 100vh;
- text-rendering: optimizeSpeed;
line-height: 1.4;
- overflow-x: hidden;
background-color: #f8f8f8 ;
height: 100%;
}
nav.zs-menu {
background-color: hsl(210, 28%, 90%);
@@ -231,15 +229,34 @@
border-radius: .25rem;
padding: .1rem .2rem;
font-size: 95%;
}
.zs-example { border-style: dotted !important }
+ .zs-info {
+ background-color: lightblue;
+ padding: .5rem 1rem;
+ }
+ .zs-warning {
+ background-color: lightyellow;
+ padding: .5rem 1rem;
+ }
.zs-error {
background-color: lightpink;
border-style: none !important;
font-weight: bold;
}
+ .zs-ta-left { text-align:left }
+ .zs-ta-center { text-align:center }
+ .zs-ta-right { text-align:right }
+ .zs-monospace { font-family:monospace }
+ .zs-font-size-0 { font-size:75% }
+ .zs-font-size-1 { font-size:83% }
+ .zs-font-size-2 { font-size:100% }
+ .zs-font-size-3 { font-size:117% }
+ .zs-font-size-4 { font-size:150% }
+ .zs-font-size-5 { font-size:200% }
+ .zs-deprecated { border-style: dashed; padding: .2rem }
kbd {
background: hsl(210, 5%, 100%);
border: 1px solid hsl(210, 5%, 70%);
border-radius: .25rem;
padding: .1rem .2rem;
Index: box/constbox/base.mustache
==================================================================
--- box/constbox/base.mustache
+++ box/constbox/base.mustache
@@ -1,10 +1,6 @@
-
-
-
-
{{{MetaHeader}}}
@@ -60,7 +56,5 @@
{{#FooterHTML}}
{{/FooterHTML}}
-
-
Index: box/constbox/constbox.go
==================================================================
--- box/constbox/constbox.go
+++ box/constbox/constbox.go
@@ -14,10 +14,11 @@
import (
"context"
_ "embed" // Allow to embed file content
"net/url"
+ "zettelstore.de/c/api"
"zettelstore.de/z/box"
"zettelstore.de/z/box/manager"
"zettelstore.de/z/domain"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
@@ -118,270 +119,270 @@
const syntaxTemplate = "mustache"
var constZettelMap = map[id.Zid]constZettel{
id.ConfigurationZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Runtime Configuration",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: meta.ValueSyntaxNone,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityOwner,
+ api.KeyTitle: "Zettelstore Runtime Configuration",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: api.ValueSyntaxNone,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityOwner,
},
- domain.NewContent("")},
- id.LicenseZid: {
+ domain.NewContent(nil)},
+ id.MustParse(api.ZidLicense): {
constHeader{
- meta.KeyTitle: "Zettelstore License",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: meta.ValueSyntaxText,
- meta.KeyLang: meta.ValueLangEN,
- meta.KeyReadOnly: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityPublic,
+ api.KeyTitle: "Zettelstore License",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: api.ValueSyntaxText,
+ api.KeyLang: api.ValueLangEN,
+ api.KeyReadOnly: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityPublic,
},
domain.NewContent(contentLicense)},
- id.AuthorsZid: {
+ id.MustParse(api.ZidAuthors): {
constHeader{
- meta.KeyTitle: "Zettelstore Contributors",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: meta.ValueSyntaxZmk,
- meta.KeyLang: meta.ValueLangEN,
- meta.KeyReadOnly: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityPublic,
+ api.KeyTitle: "Zettelstore Contributors",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: api.ValueSyntaxZmk,
+ api.KeyLang: api.ValueLangEN,
+ api.KeyReadOnly: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityPublic,
},
domain.NewContent(contentContributors)},
- id.DependenciesZid: {
+ id.MustParse(api.ZidDependencies): {
constHeader{
- meta.KeyTitle: "Zettelstore Dependencies",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: meta.ValueSyntaxZmk,
- meta.KeyLang: meta.ValueLangEN,
- meta.KeyReadOnly: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityPublic,
+ api.KeyTitle: "Zettelstore Dependencies",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: api.ValueSyntaxZmk,
+ api.KeyLang: api.ValueLangEN,
+ api.KeyReadOnly: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityPublic,
},
domain.NewContent(contentDependencies)},
id.BaseTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Base HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Base HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentBaseMustache)},
id.LoginTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Login Form HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Login Form HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentLoginMustache)},
id.ZettelTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Zettel HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Zettel HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentZettelMustache)},
id.InfoTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Info HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Info HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentInfoMustache)},
id.ContextTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Context HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Context HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentContextMustache)},
id.FormTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Form HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Form HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentFormMustache)},
id.RenameTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Rename Form HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Rename Form HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentRenameMustache)},
id.DeleteTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Delete HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Delete HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentDeleteMustache)},
id.ListTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore List Zettel HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore List Zettel HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentListZettelMustache)},
id.RolesTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore List Roles HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore List Roles HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentListRolesMustache)},
id.TagsTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore List Tags HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore List Tags HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentListTagsMustache)},
id.ErrorTemplateZid: {
constHeader{
- meta.KeyTitle: "Zettelstore Error HTML Template",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: syntaxTemplate,
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityExpert,
+ api.KeyTitle: "Zettelstore Error HTML Template",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: syntaxTemplate,
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityExpert,
},
domain.NewContent(contentErrorMustache)},
- id.BaseCSSZid: {
+ id.MustParse(api.ZidBaseCSS): {
constHeader{
- meta.KeyTitle: "Zettelstore Base CSS",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: "css",
- meta.KeyNoIndex: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityPublic,
+ api.KeyTitle: "Zettelstore Base CSS",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: "css",
+ api.KeyNoIndex: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityPublic,
},
domain.NewContent(contentBaseCSS)},
- id.UserCSSZid: {
+ id.MustParse(api.ZidUserCSS): {
constHeader{
- meta.KeyTitle: "Zettelstore User CSS",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: "css",
- meta.KeyVisibility: meta.ValueVisibilityPublic,
+ api.KeyTitle: "Zettelstore User CSS",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: "css",
+ api.KeyVisibility: api.ValueVisibilityPublic,
},
- domain.NewContent("/* User-defined CSS */")},
+ domain.NewContent([]byte("/* User-defined CSS */"))},
id.EmojiZid: {
constHeader{
- meta.KeyTitle: "Generic Emoji",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: meta.ValueSyntaxGif,
- meta.KeyReadOnly: meta.ValueTrue,
- meta.KeyVisibility: meta.ValueVisibilityPublic,
+ api.KeyTitle: "Generic Emoji",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: api.ValueSyntaxGif,
+ api.KeyReadOnly: api.ValueTrue,
+ api.KeyVisibility: api.ValueVisibilityPublic,
},
domain.NewContent(contentEmoji)},
id.TOCNewTemplateZid: {
constHeader{
- meta.KeyTitle: "New Menu",
- meta.KeyRole: meta.ValueRoleConfiguration,
- meta.KeySyntax: meta.ValueSyntaxZmk,
- meta.KeyLang: meta.ValueLangEN,
- meta.KeyVisibility: meta.ValueVisibilityCreator,
+ api.KeyTitle: "New Menu",
+ api.KeyRole: api.ValueRoleConfiguration,
+ api.KeySyntax: api.ValueSyntaxZmk,
+ api.KeyLang: api.ValueLangEN,
+ api.KeyVisibility: api.ValueVisibilityCreator,
},
domain.NewContent(contentNewTOCZettel)},
- id.TemplateNewZettelZid: {
- constHeader{
- meta.KeyTitle: "New Zettel",
- meta.KeyRole: meta.ValueRoleZettel,
- meta.KeySyntax: meta.ValueSyntaxZmk,
- meta.KeyVisibility: meta.ValueVisibilityCreator,
- },
- domain.NewContent("")},
- id.TemplateNewUserZid: {
- constHeader{
- meta.KeyTitle: "New User",
- meta.KeyRole: meta.ValueRoleUser,
- meta.KeySyntax: meta.ValueSyntaxNone,
- meta.NewPrefix + meta.KeyCredential: "",
- meta.NewPrefix + meta.KeyUserID: "",
- meta.NewPrefix + meta.KeyUserRole: meta.ValueUserRoleReader,
- meta.KeyVisibility: meta.ValueVisibilityOwner,
- },
- domain.NewContent("")},
+ id.MustParse(api.ZidTemplateNewZettel): {
+ constHeader{
+ api.KeyTitle: "New Zettel",
+ api.KeyRole: api.ValueRoleZettel,
+ api.KeySyntax: api.ValueSyntaxZmk,
+ api.KeyVisibility: api.ValueVisibilityCreator,
+ },
+ domain.NewContent(nil)},
+ id.MustParse(api.ZidTemplateNewUser): {
+ constHeader{
+ api.KeyTitle: "New User",
+ api.KeyRole: api.ValueRoleUser,
+ api.KeySyntax: api.ValueSyntaxNone,
+ meta.NewPrefix + api.KeyCredential: "",
+ meta.NewPrefix + api.KeyUserID: "",
+ meta.NewPrefix + api.KeyUserRole: api.ValueUserRoleReader,
+ api.KeyVisibility: api.ValueVisibilityOwner,
+ },
+ domain.NewContent(nil)},
id.DefaultHomeZid: {
constHeader{
- meta.KeyTitle: "Home",
- meta.KeyRole: meta.ValueRoleZettel,
- meta.KeySyntax: meta.ValueSyntaxZmk,
- meta.KeyLang: meta.ValueLangEN,
+ api.KeyTitle: "Home",
+ api.KeyRole: api.ValueRoleZettel,
+ api.KeySyntax: api.ValueSyntaxZmk,
+ api.KeyLang: api.ValueLangEN,
},
domain.NewContent(contentHomeZettel)},
}
//go:embed license.txt
-var contentLicense string
+var contentLicense []byte
//go:embed contributors.zettel
-var contentContributors string
+var contentContributors []byte
//go:embed dependencies.zettel
-var contentDependencies string
+var contentDependencies []byte
//go:embed base.mustache
-var contentBaseMustache string
+var contentBaseMustache []byte
//go:embed login.mustache
-var contentLoginMustache string
+var contentLoginMustache []byte
//go:embed zettel.mustache
-var contentZettelMustache string
+var contentZettelMustache []byte
//go:embed info.mustache
-var contentInfoMustache string
+var contentInfoMustache []byte
//go:embed context.mustache
-var contentContextMustache string
+var contentContextMustache []byte
//go:embed form.mustache
-var contentFormMustache string
+var contentFormMustache []byte
//go:embed rename.mustache
-var contentRenameMustache string
+var contentRenameMustache []byte
//go:embed delete.mustache
-var contentDeleteMustache string
+var contentDeleteMustache []byte
//go:embed listzettel.mustache
-var contentListZettelMustache string
+var contentListZettelMustache []byte
//go:embed listroles.mustache
-var contentListRolesMustache string
+var contentListRolesMustache []byte
//go:embed listtags.mustache
-var contentListTagsMustache string
+var contentListTagsMustache []byte
//go:embed error.mustache
-var contentErrorMustache string
+var contentErrorMustache []byte
//go:embed base.css
-var contentBaseCSS string
+var contentBaseCSS []byte
//go:embed emoji_spin.gif
-var contentEmoji string
+var contentEmoji []byte
//go:embed newtoc.zettel
-var contentNewTOCZettel string
+var contentNewTOCZettel []byte
//go:embed home.zettel
-var contentHomeZettel string
+var contentHomeZettel []byte
Index: box/constbox/delete.mustache
==================================================================
--- box/constbox/delete.mustache
+++ box/constbox/delete.mustache
@@ -1,10 +1,27 @@
Do you really want to delete this zettel?
+{{#HasShadows}}
+
+
Infomation
+
If you delete this zettel, the previoulsy shadowed zettel from overlayed box {{ShadowedBox}} becomes available.
+
+{{/HasShadows}}
+{{#HasIncoming}}
+
+
Warning!
+
If you delete this zettel, incoming references from the following zettel will become invalid.
+
+{{#Incoming}}
+- {{Text}}
+{{/Incoming}}
+
+
+{{/HasIncoming}}
{{#MetaPairs}}
- {{Key}}:
- {{Value}}
{{/MetaPairs}}
Index: box/constbox/listtags.mustache
==================================================================
--- box/constbox/listtags.mustache
+++ box/constbox/listtags.mustache
@@ -3,8 +3,8 @@
Currently used tags
-{{#Tags}} {{Name}}{{Count}}
+{{#Tags}} {{Name}}{{Count}}
{{/Tags}}
Index: box/constbox/rename.mustache
==================================================================
--- box/constbox/rename.mustache
+++ box/constbox/rename.mustache
@@ -1,10 +1,21 @@
Do you really want to rename this zettel?
+{{#HasIncoming}}
+
+
Warning!
+
If you rename this zettel, incoming references from the following zettel will become invalid.
+
+{{#Incoming}}
+- {{Text}}
+{{/Incoming}}
+
+
+{{/HasIncoming}}