Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From v0.9.0 To trunk
2023-01-25
| ||
21:31 | Remove support for ZJSON ... (Leaf check-in: 649953e0cb user: stern tags: trunk) | |
21:00 | Add missing infos for 0.10 ... (check-in: 4281c3c9f4 user: stern tags: trunk) | |
2022-12-15
| ||
18:39 | Add constants to merge endpoint into /z ... (check-in: e93b6cc96d user: stern tags: trunk) | |
2022-12-12
| ||
12:50 | Version 0.9.0 ... (check-in: 668f89b43e user: stern tags: trunk, release, v0.9.0) | |
11:22 | Remove Deepsource integration, because it still fails on Go 1.18 elements ... (check-in: 201e5b2e91 user: stern tags: trunk) | |
Changes to LICENSE.txt.
|
| | | 1 2 3 4 5 6 7 8 | Copyright (c) 2021-2023 Detlef Stern Licensed under the EUPL Zettelstore client is licensed under the European Union Public License, version 1.2 or later (EUPL v. 1.2). The license is available in the official languages of the EU. The English version is included here. Please see https://joinup.ec.europa.eu/community/eupl/og_page/eupl for official |
︙ | ︙ |
Changes to api/api.go.
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | type ZettelJSON struct { ID ZettelID `json:"id"` Meta ZettelMeta `json:"meta"` Encoding string `json:"encoding"` Content string `json:"content"` Rights ZettelRights `json:"rights"` } // ZettelListJSON contains data for a zettel list. type ZettelListJSON struct { Query string `json:"query"` Human string `json:"human"` List []ZidMetaJSON `json:"list"` } | > > > > > > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | type ZettelJSON struct { ID ZettelID `json:"id"` Meta ZettelMeta `json:"meta"` Encoding string `json:"encoding"` Content string `json:"content"` Rights ZettelRights `json:"rights"` } // ZettelContentJSON contains all elements to transfer the content of a zettel. type ZettelContentJSON struct { Encoding string `json:"encoding"` Content string `json:"content"` } // ZettelListJSON contains data for a zettel list. type ZettelListJSON struct { Query string `json:"query"` Human string `json:"human"` List []ZidMetaJSON `json:"list"` } |
︙ | ︙ |
Changes to api/const.go.
1 | //----------------------------------------------------------------------------- | | | 1 2 3 4 5 6 7 8 9 | //----------------------------------------------------------------------------- // Copyright (c) 2021-2023 Detlef Stern // // This file is part of zettelstore-client. // // Zettelstore client 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. //----------------------------------------------------------------------------- |
︙ | ︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 108 109 | KeyForward = "forward" KeyLang = "lang" KeyLicense = "license" KeyModified = "modified" KeyPrecursor = "precursor" KeyPredecessor = "predecessor" KeyPublished = "published" KeyReadOnly = "read-only" KeySuccessors = "successors" KeySummary = "summary" KeyURL = "url" KeyUselessFiles = "useless-files" KeyUserID = "user-id" KeyUserRole = "user-role" | > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | KeyForward = "forward" KeyLang = "lang" KeyLicense = "license" KeyModified = "modified" KeyPrecursor = "precursor" KeyPredecessor = "predecessor" KeyPublished = "published" KeyQuery = "query" KeyReadOnly = "read-only" KeySuccessors = "successors" KeySummary = "summary" KeyURL = "url" KeyUselessFiles = "useless-files" KeyUserID = "user-id" KeyUserRole = "user-role" |
︙ | ︙ | |||
147 148 149 150 151 152 153 | HeaderContentType = "Content-Type" HeaderDestination = "Destination" HeaderLocation = "Location" ) // Values for HTTP query parameter. const ( | | | | | > | | | | > < > > > < > > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | HeaderContentType = "Content-Type" HeaderDestination = "Destination" HeaderLocation = "Location" ) // Values for HTTP query parameter. const ( QueryKeyCommand = "cmd" QueryKeyCost = "cost" QueryKeyDir = "dir" QueryKeyEncoding = "enc" QueryKeyParseOnly = "parseonly" QueryKeyLimit = "limit" QueryKeyPart = "part" QueryKeyPhrase = "phrase" QueryKeyQuery = "q" QueryKeySeed = "_seed" ) // Supported dir values. const ( DirBackward = "backward" DirForward = "forward" ) // Supported encoding values. const ( EncodingHTML = "html" EncodingMD = "md" EncodingSexpr = "sexpr" EncodingText = "text" EncodingZMK = "zmk" EncodingPlain = "plain" EncodingJson = "json" ) var mapEncodingEnum = map[string]EncodingEnum{ EncodingHTML: EncoderHTML, EncodingMD: EncoderMD, EncodingSexpr: EncoderSexpr, EncodingText: EncoderText, EncodingZMK: EncoderZmk, EncodingPlain: EncoderPlain, EncodingJson: EncoderJson, } var mapEnumEncoding = map[EncodingEnum]string{} func init() { for k, v := range mapEncodingEnum { mapEnumEncoding[v] = k } |
︙ | ︙ | |||
207 208 209 210 211 212 213 | // Values for EncoderEnum const ( EncoderUnknown EncodingEnum = iota EncoderHTML EncoderMD EncoderSexpr EncoderText | | > | > | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | // Values for EncoderEnum const ( EncoderUnknown EncodingEnum = iota EncoderHTML EncoderMD EncoderSexpr EncoderText EncoderZmk EncoderPlain EncoderJson ) // String representation of an encoder key. func (e EncodingEnum) String() string { if f, ok := mapEnumEncoding[e]; ok { return f } |
︙ | ︙ |
Changes to api/urlbuilder.go.
︙ | ︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 | ub.rawLocal = "" 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) } if ub.rawLocal != "" { | > > > > > > > > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | ub.rawLocal = "" ub.fragment = s return ub } // String produces a string value. func (ub *URLBuilder) String() string { return ub.asString("&") } // AttrString returns the string value of the URL suitable to be placed in a HTML attribute. func (ub *URLBuilder) AttrString() string { return ub.asString("&") } func (ub *URLBuilder) asString(qsep string) string { var sb strings.Builder sb.WriteString(ub.prefix) if ub.key != '/' { sb.WriteByte(ub.key) } if ub.rawLocal != "" { |
︙ | ︙ | |||
133 134 135 136 137 138 139 | sb.WriteByte('#') sb.WriteString(ub.fragment) } for i, q := range ub.query { if i == 0 { sb.WriteByte('?') } else { | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | sb.WriteByte('#') sb.WriteString(ub.fragment) } for i, q := range ub.query { if i == 0 { sb.WriteByte('?') } else { sb.WriteString(qsep) } sb.WriteString(q.key) if val := q.val; val != "" { sb.WriteByte('=') sb.WriteString(url.QueryEscape(val)) } } return sb.String() } |
Changes to client/client.go.
1 | //----------------------------------------------------------------------------- | | | 1 2 3 4 5 6 7 8 9 | //----------------------------------------------------------------------------- // Copyright (c) 2021-2023 Detlef Stern // // This file is part of zettelstore-client. // // Zettelstore client 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. //----------------------------------------------------------------------------- |
︙ | ︙ | |||
23 24 25 26 27 28 29 | "strconv" "strings" "time" "codeberg.org/t73fde/sxpf" "zettelstore.de/c/api" "zettelstore.de/c/sexpr" | < | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | "strconv" "strings" "time" "codeberg.org/t73fde/sxpf" "zettelstore.de/c/api" "zettelstore.de/c/sexpr" ) // Client contains all data to execute requests. type Client struct { base string username string password string |
︙ | ︙ | |||
232 233 234 235 236 237 238 | // CreateZettelJSON creates a new zettel and returns its URL. func (c *Client) CreateZettelJSON(ctx context.Context, data *api.ZettelDataJSON) (api.ZettelID, error) { var buf bytes.Buffer if err := encodeZettelData(&buf, data); err != nil { return api.InvalidZID, err } | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | // CreateZettelJSON creates a new zettel and returns its URL. func (c *Client) CreateZettelJSON(ctx context.Context, data *api.ZettelDataJSON) (api.ZettelID, error) { var buf bytes.Buffer if err := encodeZettelData(&buf, data); err != nil { return api.InvalidZID, err } ub := c.newURLBuilder('z').AppendKVQuery(api.QueryKeyEncoding, api.EncodingJson) resp, err := c.buildAndExecuteRequest(ctx, http.MethodPost, ub, &buf, nil) if err != nil { return api.InvalidZID, err } defer resp.Body.Close() if resp.StatusCode != http.StatusCreated { return api.InvalidZID, statusToError(resp) |
︙ | ︙ | |||
285 286 287 288 289 290 291 | lines = lines[:len(lines)-1] } return lines, nil } // ListZettelJSON returns a list of zettel. func (c *Client) ListZettelJSON(ctx context.Context, query string) (string, string, []api.ZidMetaJSON, error) { | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | lines = lines[:len(lines)-1] } return lines, nil } // ListZettelJSON returns a list of zettel. func (c *Client) ListZettelJSON(ctx context.Context, query string) (string, string, []api.ZidMetaJSON, error) { ub := c.newURLBuilder('z').AppendKVQuery(api.QueryKeyEncoding, api.EncodingJson).AppendQuery(query) resp, err := c.buildAndExecuteRequest(ctx, http.MethodGet, ub, nil, nil) if err != nil { return "", "", nil, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return "", "", nil, statusToError(resp) |
︙ | ︙ | |||
322 323 324 325 326 327 328 | return nil, statusToError(resp) } return io.ReadAll(resp.Body) } // GetZettelJSON returns a zettel as a JSON struct. func (c *Client) GetZettelJSON(ctx context.Context, zid api.ZettelID) (*api.ZettelDataJSON, error) { | | > > | | | | > > > | | | | | | > > > < < < < | < | < < < < | | < | < < < < < < < < < < < < < < < | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | return nil, statusToError(resp) } return io.ReadAll(resp.Body) } // GetZettelJSON returns a zettel as a JSON struct. func (c *Client) GetZettelJSON(ctx context.Context, zid api.ZettelID) (*api.ZettelDataJSON, error) { ub := c.newURLBuilder('z').SetZid(zid) ub.AppendKVQuery(api.QueryKeyEncoding, api.EncodingJson) ub.AppendKVQuery(api.QueryKeyPart, api.PartZettel) resp, err := c.buildAndExecuteRequest(ctx, http.MethodGet, ub, nil, nil) if err != nil { return nil, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return nil, statusToError(resp) } dec := json.NewDecoder(resp.Body) var out api.ZettelDataJSON err = dec.Decode(&out) if err != nil { return nil, err } return &out, nil } // GetParsedZettel return a parsed zettel in a defined encoding. func (c *Client) GetParsedZettel(ctx context.Context, zid api.ZettelID, enc api.EncodingEnum) ([]byte, error) { return c.getZettelString(ctx, zid, enc, true) } // GetEvaluatedZettel return an evaluated zettel in a defined encoding. func (c *Client) GetEvaluatedZettel(ctx context.Context, zid api.ZettelID, enc api.EncodingEnum) ([]byte, error) { return c.getZettelString(ctx, zid, enc, false) } func (c *Client) getZettelString(ctx context.Context, zid api.ZettelID, enc api.EncodingEnum, parseOnly bool) ([]byte, error) { ub := c.newURLBuilder('z').SetZid(zid) ub.AppendKVQuery(api.QueryKeyEncoding, enc.String()) ub.AppendKVQuery(api.QueryKeyPart, api.PartContent) if parseOnly { ub.AppendKVQuery(api.QueryKeyParseOnly, "") } resp, err := c.buildAndExecuteRequest(ctx, http.MethodGet, ub, nil, nil) if err != nil { return nil, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return nil, statusToError(resp) } return io.ReadAll(resp.Body) } // GetParsedSexpr returns an parsed zettel as a Sexpr-decoded data structure. func (c *Client) GetParsedSexpr(ctx context.Context, zid api.ZettelID, part string) (sxpf.Value, error) { return c.getSexpr(ctx, zid, part, true) } // GetEvaluatedSexpr returns an evaluated zettel as a Sexpr-decoded data structure. func (c *Client) GetEvaluatedSexpr(ctx context.Context, zid api.ZettelID, part string) (sxpf.Value, error) { return c.getSexpr(ctx, zid, part, false) } func (c *Client) getSexpr(ctx context.Context, zid api.ZettelID, part string, parseOnly bool) (sxpf.Value, error) { ub := c.newURLBuilder('z').SetZid(zid) ub.AppendKVQuery(api.QueryKeyEncoding, api.EncodingSexpr) if part != "" { ub.AppendKVQuery(api.QueryKeyPart, part) } if parseOnly { ub.AppendKVQuery(api.QueryKeyParseOnly, "") } resp, err := c.buildAndExecuteRequest(ctx, http.MethodGet, ub, nil, nil) if err != nil { return nil, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return nil, statusToError(resp) } return sxpf.ParseValue(sexpr.Smk, bufio.NewReaderSize(resp.Body, 8)) } // GetMeta returns the metadata of a zettel. func (c *Client) GetMeta(ctx context.Context, zid api.ZettelID) (api.ZettelMeta, error) { ub := c.newURLBuilder('z').SetZid(zid) ub.AppendKVQuery(api.QueryKeyEncoding, api.EncodingJson) ub.AppendKVQuery(api.QueryKeyPart, api.PartMeta) resp, err := c.buildAndExecuteRequest(ctx, http.MethodGet, ub, nil, nil) if err != nil { return nil, err } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return nil, statusToError(resp) |
︙ | ︙ | |||
549 550 551 552 553 554 555 | // UpdateZettelJSON updates an existing zettel. func (c *Client) UpdateZettelJSON(ctx context.Context, zid api.ZettelID, data *api.ZettelDataJSON) error { var buf bytes.Buffer if err := encodeZettelData(&buf, data); err != nil { return err } | | | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | // UpdateZettelJSON updates an existing zettel. func (c *Client) UpdateZettelJSON(ctx context.Context, zid api.ZettelID, data *api.ZettelDataJSON) error { var buf bytes.Buffer if err := encodeZettelData(&buf, data); err != nil { return err } ub := c.newURLBuilder('z').SetZid(zid).AppendKVQuery(api.QueryKeyEncoding, api.EncodingJson) resp, err := c.buildAndExecuteRequest(ctx, http.MethodPut, ub, &buf, nil) if err != nil { return err } defer resp.Body.Close() if resp.StatusCode != http.StatusNoContent { return statusToError(resp) |
︙ | ︙ | |||
626 627 628 629 630 631 632 | // QueryMapMeta returns a map of all metadata values with the given query action to the // list of zettel IDs containing this value. func (c *Client) QueryMapMeta(ctx context.Context, query string) (api.MapMeta, error) { err := c.updateToken(ctx) if err != nil { return nil, err } | | | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | // QueryMapMeta returns a map of all metadata values with the given query action to the // list of zettel IDs containing this value. func (c *Client) QueryMapMeta(ctx context.Context, query string) (api.MapMeta, error) { err := c.updateToken(ctx) if err != nil { return nil, err } req, err := c.newRequest(ctx, http.MethodGet, c.newURLBuilder('z').AppendKVQuery(api.QueryKeyEncoding, api.EncodingJson).AppendQuery(query), nil) if err != nil { return nil, err } resp, err := c.executeRequest(req) if err != nil { return nil, err } |
︙ | ︙ |
Changes to client/client_test.go.
1 | //----------------------------------------------------------------------------- | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | //----------------------------------------------------------------------------- // Copyright (c) 2022-2023 Detlef Stern // // This file is part of zettelstore-client. // // Zettelstore client 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 client_test import ( "context" "flag" "net/http" "net/url" "testing" "codeberg.org/t73fde/sxpf" "zettelstore.de/c/api" "zettelstore.de/c/client" ) func TestZettelList(t *testing.T) { c := getClient() _, err := c.ListZettel(context.Background(), "") if err != nil { t.Error(err) |
︙ | ︙ | |||
42 43 44 45 46 47 48 | } else { t.Error(err) } return } } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | } else { t.Error(err) } return } } func TestGetSexprZettel(t *testing.T) { c := getClient() value, err := c.GetEvaluatedSexpr(context.Background(), api.ZidDefaultHome, api.PartContent) if err != nil { t.Error(err) return } |
︙ | ︙ |
Changes to html/sencoder.go.
1 | //----------------------------------------------------------------------------- | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | //----------------------------------------------------------------------------- // Copyright (c) 2022-2023 Detlef Stern // // This file is part of zettelstore-client. // // Zettelstore client 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 html import ( "bytes" "fmt" "io" "net/url" "strconv" "codeberg.org/t73fde/sxpf" "zettelstore.de/c/api" "zettelstore.de/c/attrs" "zettelstore.de/c/sexpr" |
︙ | ︙ | |||
227 228 229 230 231 232 233 | ref := env.GetPair(args.GetTail()) env.WriteImageWithSource(args, env.GetString(ref.GetTail())) } func (env *EncEnvironment) WriteImageWithSource(args *sxpf.Pair, src string) { a := env.GetAttributes(args) a = a.Set("src", src) | | | > > | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | ref := env.GetPair(args.GetTail()) env.WriteImageWithSource(args, env.GetString(ref.GetTail())) } func (env *EncEnvironment) WriteImageWithSource(args *sxpf.Pair, src string) { a := env.GetAttributes(args) a = a.Set("src", src) if description := args.GetTail().GetTail().GetTail(); !description.IsNil() { a = a.Set("alt", text.EvaluateInlineString(description)) } else { a = a.Set("alt", "alternate description missing") } env.WriteStartTag("img", a) } func (env *EncEnvironment) LookupForm(sym *sxpf.Symbol) (sxpf.Form, error) { return env.Builtins.LookupForm(sym) } |
︙ | ︙ | |||
309 310 311 312 313 314 315 | var defaultEncodingFunctions = []struct { sym *sxpf.Symbol minArgs int fn encodingFunc }{ {sexpr.SymPara, 0, func(env *EncEnvironment, args *sxpf.Pair) { | > | | | > | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | var defaultEncodingFunctions = []struct { sym *sxpf.Symbol minArgs int fn encodingFunc }{ {sexpr.SymPara, 0, func(env *EncEnvironment, args *sxpf.Pair) { if !env.isCommentList(args) { env.WriteString("<p>") sxpf.EvalSequence(env, args) env.WriteString("</p>") } }}, {sexpr.SymHeading, 5, func(env *EncEnvironment, args *sxpf.Pair) { nLevel := env.GetInteger(args) if nLevel <= 0 { return } level := strconv.FormatInt(nLevel+int64(env.headingOffset), 10) |
︙ | ︙ | |||
441 442 443 444 445 446 447 | } env.writeVerbatim(args, a) env.visibleSpace = oldVisible }}, {sexpr.SymVerbatimZettel, 0, DoNothingFn}, {sexpr.SymBLOB, 3, func(env *EncEnvironment, args *sxpf.Pair) { argSyntax := args.GetTail() | | | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | } env.writeVerbatim(args, a) env.visibleSpace = oldVisible }}, {sexpr.SymVerbatimZettel, 0, DoNothingFn}, {sexpr.SymBLOB, 3, func(env *EncEnvironment, args *sxpf.Pair) { argSyntax := args.GetTail() env.writeBLOB(env.GetPair(args), env.GetString(argSyntax), env.GetString(argSyntax.GetTail())) }}, {sexpr.SymTransclude, 2, func(env *EncEnvironment, args *sxpf.Pair) { a := sexpr.GetAttributes(env.GetPair(args)) ref := env.GetPair(args.GetTail()) refKind := env.GetSymbol(ref) if refKind == nil { return |
︙ | ︙ | |||
466 467 468 469 470 471 472 | env.WriteEscaped(refValue) env.WriteString(" -->") return } if env.err == nil { _, env.err = fmt.Fprintf(env.w, "%v\n", args) } | < | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | env.WriteEscaped(refValue) env.WriteString(" -->") return } if env.err == nil { _, env.err = fmt.Fprintf(env.w, "%v\n", args) } }}, {sexpr.SymText, 0, func(env *EncEnvironment, args *sxpf.Pair) { if !sxpf.IsNil(args) { env.WriteEscaped(env.GetString(args)) } }}, {sexpr.SymSpace, 0, func(env *EncEnvironment, args *sxpf.Pair) { |
︙ | ︙ | |||
517 518 519 520 521 522 523 | } else { env.WriteImage(args) } }}, {sexpr.SymEmbedBLOB, 3, func(env *EncEnvironment, args *sxpf.Pair) { argSyntax := args.GetTail() a, syntax, data := env.GetAttributes(args), env.GetString(argSyntax), env.GetString(argSyntax.GetTail()) | | | | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | } else { env.WriteImage(args) } }}, {sexpr.SymEmbedBLOB, 3, func(env *EncEnvironment, args *sxpf.Pair) { argSyntax := args.GetTail() a, syntax, data := env.GetAttributes(args), env.GetString(argSyntax), env.GetString(argSyntax.GetTail()) summary, _ := a.Get(api.KeySummary) env.writeBLOB(sxpf.NewPair(sxpf.NewString(summary), sxpf.Nil()), syntax, data) }}, {sexpr.SymCite, 2, func(env *EncEnvironment, args *sxpf.Pair) { env.WriteStartTag("span", env.GetAttributes(args)) argKey := args.GetTail() if key := env.GetString(argKey); key != "" { env.WriteEscaped(key) if text := argKey.GetTail(); !text.IsNil() { |
︙ | ︙ | |||
597 598 599 600 601 602 603 604 605 606 607 608 609 610 | env.writeLiteral(args, a, "code") }}, {sexpr.SymLiteralZettel, 0, DoNothingFn}, } // DoNothingFn is a function that does nothing. func DoNothingFn(*EncEnvironment, *sxpf.Pair) { /* Should really do nothing */ } func makeListFn(tag string) encodingFunc { return func(env *EncEnvironment, args *sxpf.Pair) { env.WriteStartTag(tag, nil) for elem := args; !elem.IsNil(); elem = elem.GetTail() { env.WriteStartTag("li", nil) sxpf.Eval(env, elem.GetFirst()) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | env.writeLiteral(args, a, "code") }}, {sexpr.SymLiteralZettel, 0, DoNothingFn}, } // DoNothingFn is a function that does nothing. func DoNothingFn(*EncEnvironment, *sxpf.Pair) { /* Should really do nothing */ } func (env *EncEnvironment) isCommentList(seq *sxpf.Pair) bool { if seq.IsEmpty() { return false } elem := seq for { item, err := elem.GetPair() if err != nil { return false } if sym := item.GetFirst(); sym == sexpr.SymLiteralComment { args := item.GetTail() if args == nil { return true } attr := env.GetAttributes(args) if _, found := attr[attrs.DefaultAttribute]; found { return false } } else if sym != sexpr.SymSoft { return false } nVal := elem.GetSecond() if sxpf.IsNil(nVal) { return true } next, ok := nVal.(*sxpf.Pair) if !ok { return false } elem = next } } func makeListFn(tag string) encodingFunc { return func(env *EncEnvironment, args *sxpf.Pair) { env.WriteStartTag(tag, nil) for elem := args; !elem.IsNil(); elem = elem.GetTail() { env.WriteStartTag("li", nil) sxpf.Eval(env, elem.GetFirst()) |
︙ | ︙ | |||
658 659 660 661 662 663 664 | func execHTML(env *EncEnvironment, args *sxpf.Pair) { if s := env.GetString(args.GetTail()); s != "" && IsSafe(s) { env.WriteString(s) } } | | | < < | > | < | > | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | func execHTML(env *EncEnvironment, args *sxpf.Pair) { if s := env.GetString(args.GetTail()); s != "" && IsSafe(s) { env.WriteString(s) } } func (env *EncEnvironment) writeBLOB(description *sxpf.Pair, syntax, data string) { if data == "" { return } switch syntax { case "": case api.ValueSyntaxSVG: // TODO: add description env.WriteStrings("<p>", data, "</p>") default: env.WriteString(`<p><img `) if description.IsEmpty() { env.WriteOneAttribute("alt", "alternate description missing") } else { env.WriteOneAttribute("alt", text.EvaluateInlineString(description)) } env.WriteStrings(` src="data:image/`, syntax, ";base64,", data, `"></p>`) } } func PrepareLink(env *EncEnvironment, args *sxpf.Pair) (attrs.Attributes, string, bool) { if env.noLinks { WriteAsSpan(env, args) return nil, "", false |
︙ | ︙ |
Changes to www/changes.wiki.
1 2 3 4 5 6 7 8 | <title>Change Log</title> <a name="0_9"></a> <h2>Changes for Version 0.9.0 (2022-12-12)</h2> * Rename <tt>api.QueryKeyDepth</tt> to <tt>api.QueryKeyCost</tt> * Update encode / syntax names <a name="0_6"></a> | > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <title>Change Log</title> <a name="0_11"></a> <h2>Changes for Version 0.11.0 (pending)</h2> * Remove all zjson related declarations. <a name="0_10"></a> <h2>Changes for Version 0.10.0 (2023-01-24)</h2> * Add query key <tt>parseonly</tt> and two encoding names (plain, json) to allow to merge various API endpoints into <tt>/z</tt> * Client method do not use endpoints <tt>/j, /m, /q, /p, /v</tt> any more. They are merged into endpoint <tt>/z</tt>. Use this client only with Zettelstore v0.10.0 or better. (breaking) <a name="0_9"></a> <h2>Changes for Version 0.9.0 (2022-12-12)</h2> * Rename <tt>api.QueryKeyDepth</tt> to <tt>api.QueryKeyCost</tt> * Update encode / syntax names <a name="0_6"></a> |
︙ | ︙ |
Changes to www/index.wiki.
1 2 3 4 5 | <title>Home</title> This repository contains Go client software to access [https://zettelstore.de|Zettelstore] via its API. | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | <title>Home</title> This repository contains Go client software to access [https://zettelstore.de|Zettelstore] via its API. <h3>Latest Release: 0.10.0 (2023-01-24)</h3> * [./changes.wiki#0_10|Change summary] * [/timeline?p=v0.10.0&bt=v0.9.0&y=ci|Check-ins for version 0.10.0], [/vdiff?to=v0.10.0&from=v0.9.0|content diff] * [/timeline?df=v0.10.0&y=ci|Check-ins derived from the 0.10.0 release], [/vdiff?from=v0.10.0&to=trunk|content diff] * [/timeline?t=release|Timeline of all past releases] |
Deleted zjson/const.go.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted zjson/meta.go.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted zjson/zjson.go.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |