Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From v0.18.0 To trunk
2024-08-26
| ||
12:46 | Fix generating external links in shtml; some refactorings ... (Leaf check-in: 97640fce44 user: stern tags: trunk) | |
2024-08-19
| ||
09:25 | SHTML: generate (th... for table cell in header ... (check-in: 6ca051ffec user: stern tags: trunk) | |
2024-07-11
| ||
16:29 | Remove "rename" operation and associated constants ... (check-in: a203b14b7e user: stern tags: trunk) | |
14:40 | Version 0.18.0 ... (check-in: b141c81ad9 user: stern tags: release, trunk, v0.18.0) | |
2024-07-10
| ||
15:15 | Reserve ZID for computed zettel about zettel ... (check-in: ea5260d4a2 user: stern tags: trunk) | |
Changes to api/api.go.
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + | // Values for ZettelRights, can be or-ed const ( ZettelCanNone ZettelRights = 1 << iota ZettelCanCreate // Current user is allowed to create a new zettel ZettelCanRead // Requesting user is allowed to read the zettel ZettelCanWrite // Requesting user is allowed to update the zettel |
︙ |
Changes to api/const.go.
︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - | // WebUI HTML templates are in the range 10000..19999 ZidBaseTemplate = ZettelID("00000000010100") // -> 000s ZidLoginTemplate = ZettelID("00000000010200") // -> 000t ZidListTemplate = ZettelID("00000000010300") // -> 000u ZidZettelTemplate = ZettelID("00000000010401") // -> 000v ZidInfoTemplate = ZettelID("00000000010402") // -> 000w ZidFormTemplate = ZettelID("00000000010403") // -> 000x |
︙ | |||
173 174 175 176 177 178 179 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | - - | ValueVisibilityLogin = "login" ValueVisibilityOwner = "owner" ValueVisibilityPublic = "public" ) // Additional HTTP constants. const ( |
︙ |
Changes to attrs/attrs.go.
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | + | // SPDX-FileCopyrightText: 2020-present Detlef Stern //----------------------------------------------------------------------------- // Package attrs stores attributes of zettel parts. package attrs import ( "slices" "strings" "t73f.de/r/zsc/maps" ) // Attributes store additional information about some node types. type Attributes map[string]string |
︙ | |||
83 84 85 86 87 88 89 | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - - + + - + - - - - - - + + + + + + + + - - - - - + + + + + + + - - - - - + + - - - - - + + + + - - + + - - - - + + - - - - + + + - + | func (a Attributes) Remove(key string) Attributes { if a != nil { delete(a, key) } return a } |
Changes to attrs/attrs_test.go.
︙ | |||
53 54 55 56 57 58 59 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - + | func TestHasClass(t *testing.T) { t.Parallel() testcases := []struct { classes string class string exp bool }{ |
︙ |
Changes to client/client.go.
︙ | |||
137 138 139 140 141 142 143 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | - + - + + + + + - - - | func (c *Client) executeRequest(req *http.Request) (*http.Response, error) { if c.token != "" { req.Header.Add("Authorization", c.tokenType+" "+c.token) } resp, err := c.client.Do(req) if err != nil { if resp != nil && resp.Body != nil { |
︙ | |||
230 231 232 233 234 235 236 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | - + | } return c.executeAuthRequest(req) } // CreateZettel creates a new zettel and returns its URL. func (c *Client) CreateZettel(ctx context.Context, data []byte) (api.ZettelID, error) { ub := c.NewURLBuilder('z') |
︙ | |||
255 256 257 258 259 260 261 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | - + - + | // CreateZettelData creates a new zettel and returns its URL. func (c *Client) CreateZettelData(ctx context.Context, data api.ZettelData) (api.ZettelID, error) { var buf bytes.Buffer if _, err := sx.Print(&buf, sexp.EncodeZettel(data)); err != nil { return api.InvalidZID, err } ub := c.NewURLBuilder('z').AppendKVQuery(api.QueryKeyEncoding, api.EncodingData) |
︙ | |||
302 303 304 305 306 307 308 | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | - + | } return lines, nil } // QueryZettelData returns a list of zettel metadata. func (c *Client) QueryZettelData(ctx context.Context, query string) (string, string, []api.ZidMetaRights, error) { ub := c.NewURLBuilder('z').AppendKVQuery(api.QueryKeyEncoding, api.EncodingData).AppendQuery(query) |
︙ | |||
448 449 450 451 452 453 454 | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | - + | } func (c *Client) fetchTagOrRoleZettel(ctx context.Context, key, val string) (api.ZettelID, error) { if c.client.CheckRedirect == nil { panic("client does not allow to track redirect") } ub := c.NewURLBuilder('z').AppendKVQuery(key, val) |
︙ | |||
478 479 480 481 482 483 484 | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | - + - + | // 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.AppendKVQuery(api.QueryKeyPart, part) } |
︙ | |||
531 532 533 534 535 536 537 | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | - + | 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, "") } |
︙ | |||
564 565 566 567 568 569 570 | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | - + - + | ub.AppendKVQuery(api.QueryKeyEncoding, api.EncodingSz) if part != "" { ub.AppendKVQuery(api.QueryKeyPart, part) } if parseOnly { ub.AppendKVQuery(api.QueryKeyParseOnly, "") } |
︙ | |||
620 621 622 623 624 625 626 | 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 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | - + - + - - - - - - - - - - - - - - - - - - - - + - + - + | Rights: rights, }, nil } // UpdateZettel updates an existing zettel. func (c *Client) UpdateZettel(ctx context.Context, zid api.ZettelID, data []byte) error { ub := c.NewURLBuilder('z').SetZid(zid) |
︙ | |||
751 752 753 754 755 756 757 | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | - + | return zid, nil } return api.InvalidZID, fmt.Errorf("invalid identifier for application %v: %v", appname, val) } // Get executes a GET request to the given URL and returns the read data. func (c *Client) Get(ctx context.Context, ub *api.URLBuilder) ([]byte, error) { |
︙ |
Changes to go.mod.
1 2 | 1 2 3 4 5 6 7 8 9 | - + - - - + + + | module t73f.de/r/zsc |
Changes to go.sum.
| 1 2 3 4 5 6 | - - - - - - + + + + + + |
|
Changes to input/input.go.
︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + - - - - - - | inp.Next() return true } return false } // IsEOLEOS returns true if char is either EOS or EOL. |
︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 134 135 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | + + + + + + + | // SetPos allows to reset the read position. func (inp *Input) SetPos(pos int) { if inp.Pos != pos { inp.readPos = pos inp.Next() } } // SkipSpace reads while the current character is not a space character. func (inp *Input) SkipSpace() { for ch := inp.Ch; IsSpace(ch); { ch = inp.Next() } } // SkipToEOL reads until the next end-of-line. func (inp *Input) SkipToEOL() { for { switch inp.Ch { case EOS, '\n', '\r': return |
︙ |
Changes to input/runes.go.
︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 | + + + | case ' ', '\t': return true case '\n', '\r', EOS: return false } return unicode.IsSpace(ch) } // IsSpace returns true if current character is a whitespace. func (inp *Input) IsSpace() bool { return IsSpace(inp.Ch) } |
Changes to shtml/const.go.
︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + | SymSTRONG = sx.MakeSymbol("strong") symSUB = sx.MakeSymbol("sub") symSUP = sx.MakeSymbol("sup") symTABLE = sx.MakeSymbol("table") symTBODY = sx.MakeSymbol("tbody") symTHEAD = sx.MakeSymbol("thead") symTD = sx.MakeSymbol("td") symTH = sx.MakeSymbol("th") symTR = sx.MakeSymbol("tr") SymUL = sx.MakeSymbol("ul") ) // Symbols for HTML attribute keys var ( symAttrAlt = sx.MakeSymbol("alt") |
︙ |
Added shtml/lang.go.