Index: Makefile
==================================================================
--- Makefile
+++ Makefile
@@ -5,18 +5,15 @@
##
## 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 relcheck api build release clean
+.PHONY: check 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
@@ -11,16 +11,10 @@
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).
[Stay tuned](https://twitter.com/zettelstore)…
Index: VERSION
==================================================================
--- VERSION
+++ VERSION
@@ -1,1 +1,1 @@
-0.1.2
+0.0.15
ADDED api/api.go
Index: api/api.go
==================================================================
--- api/api.go
+++ api/api.go
@@ -0,0 +1,85 @@
+//-----------------------------------------------------------------------------
+// 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"`
+}
ADDED api/const.go
Index: api/const.go
==================================================================
--- api/const.go
+++ api/const.go
@@ -0,0 +1,104 @@
+//-----------------------------------------------------------------------------
+// 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"
+)
ADDED api/urlbuilder.go
Index: api/urlbuilder.go
==================================================================
--- api/urlbuilder.go
+++ api/urlbuilder.go
@@ -0,0 +1,114 @@
+//-----------------------------------------------------------------------------
+// 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,23 +199,26 @@
// FormatKind specifies the format that is applied to the inline nodes.
type FormatKind uint8
// Constants for FormatCode
const (
- _ 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.
+ _ 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.
)
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,11 +17,10 @@
"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"
@@ -82,14 +81,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(api.KeyRole); !ok || role != api.ValueRoleUser {
+ if role, ok := ident.Get(meta.KeyRole); !ok || role != meta.ValueRoleUser {
return nil, ErrNoUser
}
- subject, ok := ident.Get(api.KeyUserID)
+ subject, ok := ident.Get(meta.KeyUserID)
if !ok || subject == "" {
return nil, ErrNoIdent
}
now := time.Now().Round(time.Second)
@@ -132,12 +131,12 @@
ident := claims.Subject
if ident == "" {
return auth.TokenData{}, ErrNoIdent
}
if zidS, ok := claims.Set["zid"].(string); ok {
- if zid, err2 := id.Parse(zidS); err2 == nil {
- if kind, ok2 := claims.Set["_tk"].(float64); ok2 {
+ if zid, err := id.Parse(zidS); err == nil {
+ if kind, ok := claims.Set["_tk"].(float64); ok {
if auth.TokenKind(kind) == k {
return auth.TokenData{
Token: token,
Now: now,
Issued: claims.Issued.Time(),
@@ -170,11 +169,11 @@
return meta.UserRoleOwner
}
if a.IsOwner(user.Zid) {
return meta.UserRoleOwner
}
- if val, ok := user.Get(api.KeyUserRole); ok {
+ if val, ok := user.Get(meta.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,47 +10,46 @@
// 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 (*defaultPolicy) CanCreate(_, _ *meta.Meta) bool { return true }
-func (*defaultPolicy) CanRead(_, _ *meta.Meta) bool { return true }
-func (d *defaultPolicy) CanWrite(user, oldMeta, _ *meta.Meta) bool {
+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 {
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(api.KeyReadOnly)
+ metaRo, ok := m.Get(meta.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 != api.ValueUserRoleOwner && !meta.BoolValue(metaRo)
+ return metaRo != meta.ValueUserRoleOwner && !meta.BoolValue(metaRo)
}
userRole := d.manager.GetUserRole(user)
switch metaRo {
- case api.ValueUserRoleReader:
+ case meta.ValueUserRoleReader:
return userRole > meta.UserRoleReader
- case api.ValueUserRoleWriter:
+ case meta.ValueUserRoleWriter:
return userRole > meta.UserRoleWriter
- case api.ValueUserRoleOwner:
+ case meta.ValueUserRoleOwner:
return userRole > meta.UserRoleOwner
}
return !meta.BoolValue(metaRo)
}
Index: auth/policy/owner.go
==================================================================
--- auth/policy/owner.go
+++ auth/policy/owner.go
@@ -10,11 +10,10 @@
// 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"
)
@@ -33,11 +32,11 @@
func (o *ownerPolicy) userCanCreate(user, newMeta *meta.Meta) bool {
if o.manager.GetUserRole(user) == meta.UserRoleReader {
return false
}
- if role, ok := newMeta.Get(api.KeyRole); ok && role == api.ValueRoleUser {
+ if role, ok := newMeta.Get(meta.KeyRole); ok && role == meta.ValueRoleUser {
return false
}
return true
}
@@ -59,11 +58,11 @@
return true
}
if user == nil {
return false
}
- if role, ok := m.Get(api.KeyRole); ok && role == api.ValueRoleUser {
+ if role, ok := m.Get(meta.KeyRole); ok && role == meta.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:
@@ -74,14 +73,14 @@
return false
}
}
var noChangeUser = []string{
- api.KeyID,
- api.KeyRole,
- api.KeyUserID,
- api.KeyUserRole,
+ meta.KeyID,
+ meta.KeyRole,
+ meta.KeyUserID,
+ meta.KeyUserRole,
}
func (o *ownerPolicy) CanWrite(user, oldMeta, newMeta *meta.Meta) bool {
if user == nil || !o.pre.CanWrite(user, oldMeta, newMeta) {
return false
@@ -94,11 +93,11 @@
return true
}
if !o.userCanRead(user, oldMeta, vis) {
return false
}
- if role, ok := oldMeta.Get(api.KeyRole); ok && role == api.ValueRoleUser {
+ if role, ok := oldMeta.Get(meta.KeyRole); ok && role == meta.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
@@ -145,10 +144,10 @@
return false
}
if o.manager.IsOwner(user.Zid) {
return true
}
- if val, ok := user.Get(api.KeyUserRole); ok && val == api.ValueUserRoleOwner {
+ if val, ok := user.Get(meta.KeyUserRole); ok && val == meta.ValueUserRoleOwner {
return true
}
return false
}
Index: auth/policy/policy_test.go
==================================================================
--- auth/policy/policy_test.go
+++ auth/policy/policy_test.go
@@ -13,11 +13,10 @@
import (
"fmt"
"testing"
- "zettelstore.de/c/api"
"zettelstore.de/z/auth"
"zettelstore.de/z/domain/id"
"zettelstore.de/z/domain/meta"
)
@@ -58,13 +57,13 @@
type testAuthzManager struct {
readOnly bool
withAuth bool
}
-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) 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) WithAuth() bool { return a.withAuth }
func (a *testAuthzManager) GetUserRole(user *meta.Meta) meta.UserRole {
if user == nil {
@@ -74,11 +73,11 @@
return meta.UserRoleOwner
}
if a.IsOwner(user.Zid) {
return meta.UserRoleOwner
}
- if val, ok := user.Get(api.KeyUserRole); ok {
+ if val, ok := user.Get(meta.KeyUserRole); ok {
if ur := meta.GetUserRole(val); ur != meta.UserRoleUnknown {
return ur
}
}
return meta.UserRoleReader
@@ -86,12 +85,12 @@
type authConfig struct{ expert bool }
func (ac *authConfig) GetExpertMode() bool { return ac.expert }
-func (*authConfig) GetVisibility(m *meta.Meta) meta.Visibility {
- if vis, ok := m.Get(api.KeyVisibility); ok {
+func (ac *authConfig) GetVisibility(m *meta.Meta) meta.Visibility {
+ if vis, ok := m.Get(meta.KeyVisibility); ok {
return meta.GetVisibility(vis)
}
return meta.VisibilityLogin
}
@@ -250,11 +249,11 @@
loginZettel := newLoginZettel()
ownerZettel := newOwnerZettel()
expertZettel := newExpertZettel()
userZettel := newUserZettel()
writerNew := writer.Clone()
- writerNew.Set(api.KeyUserRole, owner.GetDefault(api.KeyUserRole, ""))
+ writerNew.Set(meta.KeyUserRole, owner.GetDefault(meta.KeyUserRole, ""))
roFalse := newRoFalseZettel()
roTrue := newRoTrueZettel()
roReader := newRoReaderZettel()
roWriter := newRoWriterZettel()
roOwner := newRoOwnerZettel()
@@ -577,109 +576,109 @@
)
func newAnon() *meta.Meta { return nil }
func newCreator() *meta.Meta {
user := meta.New(creatorZid)
- user.Set(api.KeyTitle, "Creator")
- user.Set(api.KeyRole, api.ValueRoleUser)
- user.Set(api.KeyUserRole, api.ValueUserRoleCreator)
+ user.Set(meta.KeyTitle, "Creator")
+ user.Set(meta.KeyRole, meta.ValueRoleUser)
+ user.Set(meta.KeyUserRole, meta.ValueUserRoleCreator)
return user
}
func newReader() *meta.Meta {
user := meta.New(readerZid)
- user.Set(api.KeyTitle, "Reader")
- user.Set(api.KeyRole, api.ValueRoleUser)
- user.Set(api.KeyUserRole, api.ValueUserRoleReader)
+ user.Set(meta.KeyTitle, "Reader")
+ user.Set(meta.KeyRole, meta.ValueRoleUser)
+ user.Set(meta.KeyUserRole, meta.ValueUserRoleReader)
return user
}
func newWriter() *meta.Meta {
user := meta.New(writerZid)
- user.Set(api.KeyTitle, "Writer")
- user.Set(api.KeyRole, api.ValueRoleUser)
- user.Set(api.KeyUserRole, api.ValueUserRoleWriter)
+ user.Set(meta.KeyTitle, "Writer")
+ user.Set(meta.KeyRole, meta.ValueRoleUser)
+ user.Set(meta.KeyUserRole, meta.ValueUserRoleWriter)
return user
}
func newOwner() *meta.Meta {
user := meta.New(ownerZid)
- user.Set(api.KeyTitle, "Owner")
- user.Set(api.KeyRole, api.ValueRoleUser)
- user.Set(api.KeyUserRole, api.ValueUserRoleOwner)
+ user.Set(meta.KeyTitle, "Owner")
+ user.Set(meta.KeyRole, meta.ValueRoleUser)
+ user.Set(meta.KeyUserRole, meta.ValueUserRoleOwner)
return user
}
func newOwner2() *meta.Meta {
user := meta.New(owner2Zid)
- user.Set(api.KeyTitle, "Owner 2")
- user.Set(api.KeyRole, api.ValueRoleUser)
- user.Set(api.KeyUserRole, api.ValueUserRoleOwner)
+ user.Set(meta.KeyTitle, "Owner 2")
+ user.Set(meta.KeyRole, meta.ValueRoleUser)
+ user.Set(meta.KeyUserRole, meta.ValueUserRoleOwner)
return user
}
func newZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(api.KeyTitle, "Any Zettel")
+ m.Set(meta.KeyTitle, "Any Zettel")
return m
}
func newPublicZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(api.KeyTitle, "Public Zettel")
- m.Set(api.KeyVisibility, api.ValueVisibilityPublic)
+ m.Set(meta.KeyTitle, "Public Zettel")
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityPublic)
return m
}
func newCreatorZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(api.KeyTitle, "Creator Zettel")
- m.Set(api.KeyVisibility, api.ValueVisibilityCreator)
+ m.Set(meta.KeyTitle, "Creator Zettel")
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityCreator)
return m
}
func newLoginZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(api.KeyTitle, "Login Zettel")
- m.Set(api.KeyVisibility, api.ValueVisibilityLogin)
+ m.Set(meta.KeyTitle, "Login Zettel")
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityLogin)
return m
}
func newOwnerZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(api.KeyTitle, "Owner Zettel")
- m.Set(api.KeyVisibility, api.ValueVisibilityOwner)
+ m.Set(meta.KeyTitle, "Owner Zettel")
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityOwner)
return m
}
func newExpertZettel() *meta.Meta {
m := meta.New(visZid)
- m.Set(api.KeyTitle, "Expert Zettel")
- m.Set(api.KeyVisibility, api.ValueVisibilityExpert)
+ m.Set(meta.KeyTitle, "Expert Zettel")
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityExpert)
return m
}
func newRoFalseZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(api.KeyTitle, "No r/o Zettel")
- m.Set(api.KeyReadOnly, api.ValueFalse)
+ m.Set(meta.KeyTitle, "No r/o Zettel")
+ m.Set(meta.KeyReadOnly, "false")
return m
}
func newRoTrueZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(api.KeyTitle, "A r/o Zettel")
- m.Set(api.KeyReadOnly, api.ValueTrue)
+ m.Set(meta.KeyTitle, "A r/o Zettel")
+ m.Set(meta.KeyReadOnly, "true")
return m
}
func newRoReaderZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(api.KeyTitle, "Reader r/o Zettel")
- m.Set(api.KeyReadOnly, api.ValueUserRoleReader)
+ m.Set(meta.KeyTitle, "Reader r/o Zettel")
+ m.Set(meta.KeyReadOnly, meta.ValueUserRoleReader)
return m
}
func newRoWriterZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(api.KeyTitle, "Writer r/o Zettel")
- m.Set(api.KeyReadOnly, api.ValueUserRoleWriter)
+ m.Set(meta.KeyTitle, "Writer r/o Zettel")
+ m.Set(meta.KeyReadOnly, meta.ValueUserRoleWriter)
return m
}
func newRoOwnerZettel() *meta.Meta {
m := meta.New(zettelZid)
- m.Set(api.KeyTitle, "Owner r/o Zettel")
- m.Set(api.KeyReadOnly, api.ValueUserRoleOwner)
+ m.Set(meta.KeyTitle, "Owner r/o Zettel")
+ m.Set(meta.KeyReadOnly, meta.ValueUserRoleOwner)
return m
}
func newUserZettel() *meta.Meta {
m := meta.New(userZid)
- m.Set(api.KeyTitle, "Any User")
- m.Set(api.KeyRole, api.ValueRoleUser)
+ m.Set(meta.KeyTitle, "Any User")
+ m.Set(meta.KeyRole, meta.ValueRoleUser)
return m
}
Index: box/box.go
==================================================================
--- box/box.go
+++ box/box.go
@@ -16,11 +16,10 @@
"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"
)
@@ -247,22 +246,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(api.KeyUserID, "?"),
+ err.User.GetDefault(meta.KeyUserID, "?"),
err.User.Zid.String())
}
return fmt.Sprintf(
"operation %q not allowed for user %v/%v",
err.Op,
- err.User.GetDefault(api.KeyUserID, "?"),
+ err.User.GetDefault(meta.KeyUserID, "?"),
err.User.Zid.String())
}
// Is return true, if the error is of type ErrNotAllowed.
-func (*ErrNotAllowed) Is(error) bool { return true }
+func (err *ErrNotAllowed) Is(target 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,11 +13,10 @@
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"
@@ -37,18 +36,18 @@
}
var myConfig *meta.Meta
var myZettel = map[id.Zid]struct {
meta func(id.Zid) *meta.Meta
- content func(*meta.Meta) []byte
+ content func(*meta.Meta) string
}{
- 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},
+ id.VersionZid: {genVersionBuildM, genVersionBuildC},
+ id.HostZid: {genVersionHostM, genVersionHostC},
+ id.OperatingSystemZid: {genVersionOSM, genVersionOSC},
+ id.BoxManagerZid: {genManagerM, genManagerC},
+ id.MetadataKeyZid: {genKeysM, genKeysC},
+ id.StartupConfigurationZid: {genConfigZettelM, genConfigZettelC},
}
// Get returns the one program box.
func getCompBox(boxNumber int, mf box.Enricher) box.ManagedBox {
return &compBox{number: boxNumber, enricher: mf}
@@ -146,14 +145,14 @@
st.ReadOnly = true
st.Zettel = len(myZettel)
}
func updateMeta(m *meta.Meta) {
- 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)
+ 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)
}
}
Index: box/compbox/config.go
==================================================================
--- box/compbox/config.go
+++ box/compbox/config.go
@@ -10,44 +10,43 @@
// Package compbox provides zettel that have computed content.
package compbox
import (
- "bytes"
+ "strings"
- "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(api.KeyTitle, "Zettelstore Startup Configuration")
- m.Set(api.KeyVisibility, api.ValueVisibilityExpert)
+ m.Set(meta.KeyTitle, "Zettelstore Startup Configuration")
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityExpert)
return m
}
-func genConfigZettelC(*meta.Meta) []byte {
- var buf bytes.Buffer
+func genConfigZettelC(m *meta.Meta) string {
+ var sb strings.Builder
for i, p := range myConfig.Pairs(false) {
if i > 0 {
- buf.WriteByte('\n')
+ sb.WriteByte('\n')
}
- buf.WriteString("; ''")
- buf.WriteString(p.Key)
- buf.WriteString("''")
+ sb.WriteString("; ''")
+ sb.WriteString(p.Key)
+ sb.WriteString("''")
if p.Value != "" {
- buf.WriteString("\n: ``")
+ sb.WriteString("\n: ``")
for _, r := range p.Value {
if r == '`' {
- buf.WriteByte('\\')
+ sb.WriteByte('\\')
}
- buf.WriteRune(r)
+ sb.WriteRune(r)
}
- buf.WriteString("``")
+ sb.WriteString("``")
}
}
- return buf.Bytes()
+ return sb.String()
}
Index: box/compbox/keys.go
==================================================================
--- box/compbox/keys.go
+++ box/compbox/keys.go
@@ -10,30 +10,29 @@
// 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(api.KeyTitle, "Zettelstore Supported Metadata Keys")
- m.Set(api.KeyVisibility, api.ValueVisibilityLogin)
+ m.Set(meta.KeyTitle, "Zettelstore Supported Metadata Keys")
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityLogin)
return m
}
-func genKeysC(*meta.Meta) []byte {
+func genKeysC(*meta.Meta) string {
keys := meta.GetSortedKeyDescriptions()
- var buf bytes.Buffer
- buf.WriteString("|=Name<|=Type<|=Computed?:|=Property?:\n")
+ var sb strings.Builder
+ sb.WriteString("|=Name<|=Type<|=Computed?:|=Property?:\n")
for _, kd := range keys {
- fmt.Fprintf(&buf,
+ fmt.Fprintf(&sb,
"|%v|%v|%v|%v\n", kd.Name, kd.Type.Name, kd.IsComputed(), kd.IsProperty())
}
- return buf.Bytes()
+ return sb.String()
}
Index: box/compbox/manager.go
==================================================================
--- box/compbox/manager.go
+++ box/compbox/manager.go
@@ -10,32 +10,31 @@
// 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(api.KeyTitle, "Zettelstore Box Manager")
+ m.Set(meta.KeyTitle, "Zettelstore Box Manager")
return m
}
-func genManagerC(*meta.Meta) []byte {
+func genManagerC(*meta.Meta) string {
kvl := kernel.Main.GetServiceStatistics(kernel.BoxService)
if len(kvl) == 0 {
- return nil
+ return "No statistics available"
}
- var buf bytes.Buffer
- buf.WriteString("|=Name|=Value>\n")
+ var sb strings.Builder
+ sb.WriteString("|=Name|=Value>\n")
for _, kv := range kvl {
- fmt.Fprintf(&buf, "| %v | %v\n", kv.Key, kv.Value)
+ fmt.Fprintf(&sb, "| %v | %v\n", kv.Key, kv.Value)
}
- return buf.Bytes()
+ return sb.String()
}
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 (
- "zettelstore.de/c/api"
+ "fmt"
+
"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(api.KeyTitle, title)
- m.Set(api.KeyVisibility, api.ValueVisibilityExpert)
+ m.Set(meta.KeyTitle, title)
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityExpert)
return m
}
func genVersionBuildM(zid id.Zid) *meta.Meta {
m := getVersionMeta(zid, "Zettelstore Version")
- m.Set(api.KeyVisibility, api.ValueVisibilityPublic)
+ m.Set(meta.KeyVisibility, meta.ValueVisibilityPublic)
return m
}
-func genVersionBuildC(*meta.Meta) []byte {
- return []byte(kernel.Main.GetConfig(kernel.CoreService, kernel.CoreVersion).(string))
+func genVersionBuildC(*meta.Meta) string {
+ return kernel.Main.GetConfig(kernel.CoreService, kernel.CoreVersion).(string)
}
func genVersionHostM(zid id.Zid) *meta.Meta {
return getVersionMeta(zid, "Zettelstore Host")
}
-func genVersionHostC(*meta.Meta) []byte {
- return []byte(kernel.Main.GetConfig(kernel.CoreService, kernel.CoreHostname).(string))
+func genVersionHostC(*meta.Meta) string {
+ return 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) []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...)
+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),
+ )
}
Index: box/constbox/base.css
==================================================================
--- box/constbox/base.css
+++ box/constbox/base.css
@@ -8,11 +8,13 @@
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%);
@@ -229,34 +231,15 @@
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,6 +1,10 @@
+
+
+
+
{{{MetaHeader}}}
@@ -56,5 +60,7 @@
{{#FooterHTML}}
{{/FooterHTML}}
+
+
Index: box/constbox/constbox.go
==================================================================
--- box/constbox/constbox.go
+++ box/constbox/constbox.go
@@ -14,11 +14,10 @@
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"
@@ -119,270 +118,270 @@
const syntaxTemplate = "mustache"
var constZettelMap = map[id.Zid]constZettel{
id.ConfigurationZid: {
constHeader{
- api.KeyTitle: "Zettelstore Runtime Configuration",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: api.ValueSyntaxNone,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityOwner,
+ meta.KeyTitle: "Zettelstore Runtime Configuration",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: meta.ValueSyntaxNone,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityOwner,
},
- domain.NewContent(nil)},
- id.MustParse(api.ZidLicense): {
+ domain.NewContent("")},
+ id.LicenseZid: {
constHeader{
- api.KeyTitle: "Zettelstore License",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: api.ValueSyntaxText,
- api.KeyLang: api.ValueLangEN,
- api.KeyReadOnly: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityPublic,
+ meta.KeyTitle: "Zettelstore License",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: meta.ValueSyntaxText,
+ meta.KeyLang: meta.ValueLangEN,
+ meta.KeyReadOnly: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityPublic,
},
domain.NewContent(contentLicense)},
- id.MustParse(api.ZidAuthors): {
+ id.AuthorsZid: {
constHeader{
- api.KeyTitle: "Zettelstore Contributors",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: api.ValueSyntaxZmk,
- api.KeyLang: api.ValueLangEN,
- api.KeyReadOnly: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityPublic,
+ meta.KeyTitle: "Zettelstore Contributors",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: meta.ValueSyntaxZmk,
+ meta.KeyLang: meta.ValueLangEN,
+ meta.KeyReadOnly: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityPublic,
},
domain.NewContent(contentContributors)},
- id.MustParse(api.ZidDependencies): {
+ id.DependenciesZid: {
constHeader{
- api.KeyTitle: "Zettelstore Dependencies",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: api.ValueSyntaxZmk,
- api.KeyLang: api.ValueLangEN,
- api.KeyReadOnly: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityPublic,
+ meta.KeyTitle: "Zettelstore Dependencies",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: meta.ValueSyntaxZmk,
+ meta.KeyLang: meta.ValueLangEN,
+ meta.KeyReadOnly: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityPublic,
},
domain.NewContent(contentDependencies)},
id.BaseTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Base HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Base HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentBaseMustache)},
id.LoginTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Login Form HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Login Form HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentLoginMustache)},
id.ZettelTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Zettel HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Zettel HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentZettelMustache)},
id.InfoTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Info HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Info HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentInfoMustache)},
id.ContextTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Context HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Context HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentContextMustache)},
id.FormTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Form HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Form HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentFormMustache)},
id.RenameTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Rename Form HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Rename Form HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentRenameMustache)},
id.DeleteTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Delete HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Delete HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentDeleteMustache)},
id.ListTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore List Zettel HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore List Zettel HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentListZettelMustache)},
id.RolesTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore List Roles HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore List Roles HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentListRolesMustache)},
id.TagsTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore List Tags HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore List Tags HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentListTagsMustache)},
id.ErrorTemplateZid: {
constHeader{
- api.KeyTitle: "Zettelstore Error HTML Template",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: syntaxTemplate,
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityExpert,
+ meta.KeyTitle: "Zettelstore Error HTML Template",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: syntaxTemplate,
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityExpert,
},
domain.NewContent(contentErrorMustache)},
- id.MustParse(api.ZidBaseCSS): {
+ id.BaseCSSZid: {
constHeader{
- api.KeyTitle: "Zettelstore Base CSS",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: "css",
- api.KeyNoIndex: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityPublic,
+ meta.KeyTitle: "Zettelstore Base CSS",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: "css",
+ meta.KeyNoIndex: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityPublic,
},
domain.NewContent(contentBaseCSS)},
- id.MustParse(api.ZidUserCSS): {
+ id.UserCSSZid: {
constHeader{
- api.KeyTitle: "Zettelstore User CSS",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: "css",
- api.KeyVisibility: api.ValueVisibilityPublic,
+ meta.KeyTitle: "Zettelstore User CSS",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: "css",
+ meta.KeyVisibility: meta.ValueVisibilityPublic,
},
- domain.NewContent([]byte("/* User-defined CSS */"))},
+ domain.NewContent("/* User-defined CSS */")},
id.EmojiZid: {
constHeader{
- api.KeyTitle: "Generic Emoji",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: api.ValueSyntaxGif,
- api.KeyReadOnly: api.ValueTrue,
- api.KeyVisibility: api.ValueVisibilityPublic,
+ meta.KeyTitle: "Generic Emoji",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: meta.ValueSyntaxGif,
+ meta.KeyReadOnly: meta.ValueTrue,
+ meta.KeyVisibility: meta.ValueVisibilityPublic,
},
domain.NewContent(contentEmoji)},
id.TOCNewTemplateZid: {
constHeader{
- api.KeyTitle: "New Menu",
- api.KeyRole: api.ValueRoleConfiguration,
- api.KeySyntax: api.ValueSyntaxZmk,
- api.KeyLang: api.ValueLangEN,
- api.KeyVisibility: api.ValueVisibilityCreator,
+ meta.KeyTitle: "New Menu",
+ meta.KeyRole: meta.ValueRoleConfiguration,
+ meta.KeySyntax: meta.ValueSyntaxZmk,
+ meta.KeyLang: meta.ValueLangEN,
+ meta.KeyVisibility: meta.ValueVisibilityCreator,
},
domain.NewContent(contentNewTOCZettel)},
- 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.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.DefaultHomeZid: {
constHeader{
- api.KeyTitle: "Home",
- api.KeyRole: api.ValueRoleZettel,
- api.KeySyntax: api.ValueSyntaxZmk,
- api.KeyLang: api.ValueLangEN,
+ meta.KeyTitle: "Home",
+ meta.KeyRole: meta.ValueRoleZettel,
+ meta.KeySyntax: meta.ValueSyntaxZmk,
+ meta.KeyLang: meta.ValueLangEN,
},
domain.NewContent(contentHomeZettel)},
}
//go:embed license.txt
-var contentLicense []byte
+var contentLicense string
//go:embed contributors.zettel
-var contentContributors []byte
+var contentContributors string
//go:embed dependencies.zettel
-var contentDependencies []byte
+var contentDependencies string
//go:embed base.mustache
-var contentBaseMustache []byte
+var contentBaseMustache string
//go:embed login.mustache
-var contentLoginMustache []byte
+var contentLoginMustache string
//go:embed zettel.mustache
-var contentZettelMustache []byte
+var contentZettelMustache string
//go:embed info.mustache
-var contentInfoMustache []byte
+var contentInfoMustache string
//go:embed context.mustache
-var contentContextMustache []byte
+var contentContextMustache string
//go:embed form.mustache
-var contentFormMustache []byte
+var contentFormMustache string
//go:embed rename.mustache
-var contentRenameMustache []byte
+var contentRenameMustache string
//go:embed delete.mustache
-var contentDeleteMustache []byte
+var contentDeleteMustache string
//go:embed listzettel.mustache
-var contentListZettelMustache []byte
+var contentListZettelMustache string
//go:embed listroles.mustache
-var contentListRolesMustache []byte
+var contentListRolesMustache string
//go:embed listtags.mustache
-var contentListTagsMustache []byte
+var contentListTagsMustache string
//go:embed error.mustache
-var contentErrorMustache []byte
+var contentErrorMustache string
//go:embed base.css
-var contentBaseCSS []byte
+var contentBaseCSS string
//go:embed emoji_spin.gif
-var contentEmoji []byte
+var contentEmoji string
//go:embed newtoc.zettel
-var contentNewTOCZettel []byte
+var contentNewTOCZettel string
//go:embed home.zettel
-var contentHomeZettel []byte
+var contentHomeZettel string
Index: box/constbox/delete.mustache
==================================================================
--- box/constbox/delete.mustache
+++ box/constbox/delete.mustache
@@ -1,27 +1,10 @@
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,21 +1,10 @@
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}}