Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From v0.6.0 To v0.5
2022-08-12
| ||
11:25 | Remove constants to work with URL query parameter based search; update API to use search expressions ... (check-in: 0e4cf52fe7 user: stern tags: trunk) | |
2022-08-11
| ||
16:58 | Version 0.6.0 ... (check-in: 7ef11c70e3 user: stern tags: release, trunk, v0.6.0) | |
08:53 | Typo ... (check-in: 6f9ea3ec0b user: stern tags: trunk) | |
2022-07-29
| ||
13:59 | Add missing changelog ... (check-in: 4550111b76 user: stern tags: trunk) | |
13:59 | Version 0.5 ... (check-in: 7877ee63ca user: stern tags: release, trunk, v0.5) | |
2022-07-19
| ||
17:50 | Remove code to encode HTML or Text via ZJSON ... (check-in: 3613da8bc5 user: stern tags: trunk) | |
Changes to api/api.go.
︙ | ︙ | |||
95 96 97 98 99 100 101 | Content string `json:"content"` Rights ZettelRights `json:"rights"` } // ZettelListJSON contains data for a zettel list. type ZettelListJSON struct { Query string `json:"query"` | < | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | Content string `json:"content"` Rights ZettelRights `json:"rights"` } // ZettelListJSON contains data for a zettel list. type ZettelListJSON struct { Query string `json:"query"` List []ZidMetaJSON `json:"list"` } // MapMeta maps metadata keys to list of metadata. type MapMeta map[string][]ZettelID // MapListJSON specifies the map of metadata key to list of metadata that contains the key. |
︙ | ︙ |
Changes to api/urlbuilder.go.
︙ | ︙ | |||
85 86 87 88 89 90 91 | // AppendQuery adds a new query parameter func (ub *URLBuilder) AppendQuery(key, value string) *URLBuilder { ub.rawLocal = "" ub.query = append(ub.query, urlQuery{key, value}) return ub } | < < < < < < < | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | // AppendQuery adds a new query parameter func (ub *URLBuilder) AppendQuery(key, value string) *URLBuilder { ub.rawLocal = "" ub.query = append(ub.query, urlQuery{key, value}) return ub } // ClearQuery removes all query parameters. func (ub *URLBuilder) ClearQuery() *URLBuilder { ub.rawLocal = "" ub.query = nil ub.fragment = "" return ub } |
︙ | ︙ |
Changes to client/client.go.
︙ | ︙ | |||
284 285 286 287 288 289 290 | if len(lines[len(lines)-1]) == 0 { lines = lines[:len(lines)-1] } return lines, nil } // ListZettelJSON returns a list of zettel. | | | | | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | if len(lines[len(lines)-1]) == 0 { lines = lines[:len(lines)-1] } return lines, nil } // ListZettelJSON returns a list of zettel. func (c *Client) ListZettelJSON(ctx context.Context, query url.Values) (string, []api.ZidMetaJSON, error) { ub := c.newQueryURLBuilder('j', 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) } dec := json.NewDecoder(resp.Body) var zl api.ZettelListJSON err = dec.Decode(&zl) if err != nil { return "", nil, err } return zl.Query, zl.List, nil } // GetZettel returns a zettel as a string. func (c *Client) GetZettel(ctx context.Context, zid api.ZettelID, part string) ([]byte, error) { ub := c.newURLBuilder('z').SetZid(zid) if part != "" && part != api.PartContent { ub.AppendQuery(api.QueryKeyPart, part) |
︙ | ︙ |
Changes to go.mod.
1 2 | module zettelstore.de/c | | | 1 2 3 4 5 | module zettelstore.de/c go 1.18 require codeberg.org/t73fde/sxpf v0.0.0-20220719090054-749a39d0a7a0 |
Changes to html/html.go.
︙ | ︙ | |||
29 30 31 32 33 34 35 | var ( htmlEscapes = []string{`&`, htmlAmp, `<`, htmlLt, `>`, htmlGt, `"`, htmlQuot, "\000", htmlNull, } | | > > | > > > > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | var ( htmlEscapes = []string{`&`, htmlAmp, `<`, htmlLt, `>`, htmlGt, `"`, htmlQuot, "\000", htmlNull, } htmlEscaper = strings.NewReplacer(htmlEscapes...) htmlLitEscapes = append(append([]string{}, htmlEscapes...), " ", htmlLitSpace, ) htmlLitEscaper = strings.NewReplacer(htmlLitEscapes...) htmlVisEscapes = append(append([]string{}, htmlEscapes...), " ", htmlVisSpace, htmlLitSpace, htmlVisSpace, ) htmlVisEscaper = strings.NewReplacer(htmlVisEscapes...) ) // Escape writes to w the escaped HTML equivalent of the given string. func Escape(w io.Writer, s string) (int, error) { return htmlEscaper.WriteString(w, s) } // EscapeLiteral writes the escaped HTML equivaltent of the given string. // Each space character is written as U+00A0. func EscapeLiteral(w io.Writer, s string) (int, error) { return htmlLitEscaper.WriteString(w, s) } // EscapeVisible writes to w the escaped HTML equivalent of the given string. // Each space is written as U-2423. func EscapeVisible(w io.Writer, s string) (int, error) { return htmlVisEscaper.WriteString(w, s) } var ( escQuot = []byte(htmlQuot) // longer than """, but often requested in standards escAmp = []byte(htmlAmp) |
︙ | ︙ |
Changes to html/html_test.go.
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | }{ {"", ""}, {"<", "<"}, } for _, tc := range testcases { var buf bytes.Buffer _, err := html.Escape(&buf, tc.in) if err != nil { t.Errorf("Escape(%q) got error: %v", tc.in, err) } if got := buf.String(); tc.exp != got { t.Errorf("Escape(%q) == %q, but got %q", tc.in, tc.exp, got) } } | > > > > > > > > > > > > > > > > > > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | }{ {"", ""}, {"<", "<"}, } for _, tc := range testcases { var buf bytes.Buffer _, err := html.Escape(&buf, tc.in) if err != nil { t.Errorf("Escape(%q) got error: %v", tc.in, err) } if got := buf.String(); tc.exp != got { t.Errorf("Escape(%q) == %q, but got %q", tc.in, tc.exp, got) } } } func TestEscapeLiteral(t *testing.T) { testcases := []struct { in, exp string }{ {"", ""}, {"<", "<"}, {" a b ", "\u00a0a\u00a0\u00a0b\u00a0"}, } for _, tc := range testcases { var buf bytes.Buffer _, err := html.EscapeLiteral(&buf, tc.in) if err != nil { t.Errorf("Escape(%q) got error: %v", tc.in, err) } if got := buf.String(); tc.exp != got { t.Errorf("Escape(%q) == %q, but got %q", tc.in, tc.exp, got) } } |
︙ | ︙ |
Changes to html/sencoder.go.
︙ | ︙ | |||
11 12 13 14 15 16 17 | package html import ( "bytes" "fmt" "io" "log" | < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | package html import ( "bytes" "fmt" "io" "log" "strconv" "codeberg.org/t73fde/sxpf" "zettelstore.de/c/api" "zettelstore.de/c/attrs" "zettelstore.de/c/sexpr" "zettelstore.de/c/text" |
︙ | ︙ | |||
132 133 134 135 136 137 138 | // WriteEscape encodes a string so that it cannot interfere with other HTML code. func (env *EncEnvironment) WriteEscaped(s string) { if env.err == nil { _, env.err = Escape(env.w, s) } } | | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | // WriteEscape encodes a string so that it cannot interfere with other HTML code. func (env *EncEnvironment) WriteEscaped(s string) { if env.err == nil { _, env.err = Escape(env.w, s) } } func (env *EncEnvironment) WriteEscapedLiteral(s string) { if env.err == nil { if env.visibleSpace { _, env.err = EscapeVisible(env.w, s) } else { _, env.err = EscapeLiteral(env.w, s) } } } func (env *EncEnvironment) GetSymbol(p *sxpf.Pair) (res *sxpf.Symbol) { if env.err != nil { return nil |
︙ | ︙ | |||
497 498 499 500 501 502 503 | {sexpr.SymLinkBroken, 2, func(env *EncEnvironment, args *sxpf.Pair) { if a, refValue, ok := PrepareLink(env, args); ok { WriteLink(env, args, a.AddClass("broken"), refValue, "") } }}, {sexpr.SymLinkHosted, 2, func(env *EncEnvironment, args *sxpf.Pair) { WriteHRefLink(env, args) }}, {sexpr.SymLinkBased, 2, func(env *EncEnvironment, args *sxpf.Pair) { WriteHRefLink(env, args) }}, | < < < < < < | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | {sexpr.SymLinkBroken, 2, func(env *EncEnvironment, args *sxpf.Pair) { if a, refValue, ok := PrepareLink(env, args); ok { WriteLink(env, args, a.AddClass("broken"), refValue, "") } }}, {sexpr.SymLinkHosted, 2, func(env *EncEnvironment, args *sxpf.Pair) { WriteHRefLink(env, args) }}, {sexpr.SymLinkBased, 2, func(env *EncEnvironment, args *sxpf.Pair) { WriteHRefLink(env, args) }}, {sexpr.SymLinkExternal, 2, func(env *EncEnvironment, args *sxpf.Pair) { if a, refValue, ok := PrepareLink(env, args); ok { WriteLink(env, args, a.Set("href", refValue).AddClass("external"), refValue, "") } }}, {sexpr.SymEmbed, 3, func(env *EncEnvironment, args *sxpf.Pair) { argRef := args.GetTail() |
︙ | ︙ | |||
567 568 569 570 571 572 573 | `<sup id="fnref:`, un, `"><a class="zs-noteref" href="#fn:`, un, `" role="doc-noteref">`, n, `</a></sup>`) } }}, {sexpr.SymFormatDelete, 1, makeFormatFn("del")}, {sexpr.SymFormatEmph, 1, makeFormatFn("em")}, {sexpr.SymFormatInsert, 1, makeFormatFn("ins")}, | | | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | `<sup id="fnref:`, un, `"><a class="zs-noteref" href="#fn:`, un, `" role="doc-noteref">`, n, `</a></sup>`) } }}, {sexpr.SymFormatDelete, 1, makeFormatFn("del")}, {sexpr.SymFormatEmph, 1, makeFormatFn("em")}, {sexpr.SymFormatInsert, 1, makeFormatFn("ins")}, {sexpr.SymFormatQuote, 1, makeFormatFn("q")}, {sexpr.SymFormatSpan, 1, makeFormatFn("span")}, {sexpr.SymFormatStrong, 1, makeFormatFn("strong")}, {sexpr.SymFormatSub, 1, makeFormatFn("sub")}, {sexpr.SymFormatSuper, 1, makeFormatFn("sup")}, {sexpr.SymLiteralComment, 1, func(env *EncEnvironment, args *sxpf.Pair) { if env.GetAttributes(args).HasDefault() { if s := env.GetString(args.GetTail()); s != "" { |
︙ | ︙ | |||
652 653 654 655 656 657 658 | } env.WriteEndTag(tag) } func (env *EncEnvironment) writeVerbatim(args *sxpf.Pair, a attrs.Attributes) { env.WriteString("<pre>") env.WriteStartTag("code", a) | | | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | } env.WriteEndTag(tag) } func (env *EncEnvironment) writeVerbatim(args *sxpf.Pair, a attrs.Attributes) { env.WriteString("<pre>") env.WriteStartTag("code", a) env.WriteEscapedLiteral(env.GetString(args.GetTail())) env.WriteString("</code></pre>") } func execHTML(env *EncEnvironment, args *sxpf.Pair) { if s := env.GetString(args.GetTail()); s != "" && IsSafe(s) { env.WriteString(s) } |
︙ | ︙ | |||
728 729 730 731 732 733 734 | } env.WriteStartTag(tag, a) sxpf.EvalSequence(env, args.GetTail()) env.WriteEndTag(tag) } } | < < < < < < < < < < < < < < < < | | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | } env.WriteStartTag(tag, a) sxpf.EvalSequence(env, args.GetTail()) env.WriteEndTag(tag) } } func (env *EncEnvironment) writeLiteral(args *sxpf.Pair, a attrs.Attributes, tag string) { if a == nil { a = env.GetAttributes(args) } oldVisible := env.visibleSpace if a.HasDefault() { env.visibleSpace = true a = a.RemoveDefault() } env.WriteStartTag(tag, a) env.WriteEscapedLiteral(env.GetString(args.GetTail())) env.visibleSpace = oldVisible env.WriteEndTag(tag) } func setProgLang(a attrs.Attributes) attrs.Attributes { if val, found := a.Get(""); found { a = a.AddClass("language-" + val).Remove("") } return a } |
Changes to sexpr/const.go.
︙ | ︙ | |||
40 41 42 43 44 45 46 | SymLinkInvalid = Smk.MakeSymbol("LINK-INVALID") SymLinkZettel = Smk.MakeSymbol("LINK-ZETTEL") SymLinkSelf = Smk.MakeSymbol("LINK-SELF") SymLinkFound = Smk.MakeSymbol("LINK-FOUND") SymLinkBroken = Smk.MakeSymbol("LINK-BROKEN") SymLinkHosted = Smk.MakeSymbol("LINK-HOSTED") SymLinkBased = Smk.MakeSymbol("LINK-BASED") | < | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | SymLinkInvalid = Smk.MakeSymbol("LINK-INVALID") SymLinkZettel = Smk.MakeSymbol("LINK-ZETTEL") SymLinkSelf = Smk.MakeSymbol("LINK-SELF") SymLinkFound = Smk.MakeSymbol("LINK-FOUND") SymLinkBroken = Smk.MakeSymbol("LINK-BROKEN") SymLinkHosted = Smk.MakeSymbol("LINK-HOSTED") SymLinkBased = Smk.MakeSymbol("LINK-BASED") SymLinkExternal = Smk.MakeSymbol("LINK-EXTERNAL") SymListOrdered = Smk.MakeSymbol("ORDERED") SymListUnordered = Smk.MakeSymbol("UNORDERED") SymListQuote = Smk.MakeSymbol("QUOTATION") SymLiteralProg = Smk.MakeSymbol("LITERAL-CODE") SymLiteralComment = Smk.MakeSymbol("LITERAL-COMMENT") SymLiteralHTML = Smk.MakeSymbol("LITERAL-HTML") |
︙ | ︙ | |||
82 83 84 85 86 87 88 | SymRefStateInvalid = Smk.MakeSymbol("INVALID") SymRefStateZettel = Smk.MakeSymbol("ZETTEL") SymRefStateSelf = Smk.MakeSymbol("SELF") SymRefStateFound = Smk.MakeSymbol("FOUND") SymRefStateBroken = Smk.MakeSymbol("BROKEN") SymRefStateHosted = Smk.MakeSymbol("HOSTED") SymRefStateBased = Smk.MakeSymbol("BASED") | < | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | SymRefStateInvalid = Smk.MakeSymbol("INVALID") SymRefStateZettel = Smk.MakeSymbol("ZETTEL") SymRefStateSelf = Smk.MakeSymbol("SELF") SymRefStateFound = Smk.MakeSymbol("FOUND") SymRefStateBroken = Smk.MakeSymbol("BROKEN") SymRefStateHosted = Smk.MakeSymbol("HOSTED") SymRefStateBased = Smk.MakeSymbol("BASED") SymRefStateExternal = Smk.MakeSymbol("EXTERNAL") ) // Symbols for metadata types var ( SymTypeCredential = Smk.MakeSymbol("CREDENTIAL") SymTypeEmpty = Smk.MakeSymbol("EMPTY-STRING") |
︙ | ︙ |
Deleted www/changes.wiki.
|
| < < < < < < < < < < < < < < < |
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.5 (2022-07-29)</h3> * [./changes.wiki#0_5|Change summary] * [/timeline?p=v0.5&bt=v0.4&y=ci|Check-ins for version 0.5], [/vdiff?to=v0.5&from=v0.4|content diff] * [/timeline?df=v0.5&y=ci|Check-ins derived from the 0.5 release], [/vdiff?from=v0.5&to=trunk|content diff] * [/timeline?t=release|Timeline of all past releases] |
Changes to zjson/const.go.
︙ | ︙ | |||
82 83 84 85 86 87 88 | const ( RefStateBased = "based" RefStateBroken = "broken" RefStateExternal = "external" RefStateFound = "found" RefStateHosted = "local" RefStateInvalid = "invalid" | < | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | const ( RefStateBased = "based" RefStateBroken = "broken" RefStateExternal = "external" RefStateFound = "found" RefStateHosted = "local" RefStateInvalid = "invalid" RefStateSelf = "self" RefStateZettel = "zettel" ) // Values for table cell alignment const ( AlignDefault = "" |
︙ | ︙ |