Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From version-0.0.9 To version-0.0.10
2021-02-26
| ||
11:53 | Increase version to 0.0.11-dev to begin next development cycle ... (check-in: d69e61d8eb user: stern tags: trunk) | |
11:14 | Version 0.0.10 ... (check-in: 5d9e4fc19e user: stern tags: trunk, release, version-0.0.10) | |
10:36 | WebUI: make meta line a little bit darker for better visibility ... (check-in: 09837eae5e user: stern tags: trunk) | |
2021-01-29
| ||
18:44 | Typo ... (check-in: 84effdca96 user: stern tags: trunk) | |
18:16 | Version 0.0.9 ... (check-in: 5d25b46c82 user: stern tags: trunk, release, version-0.0.9) | |
17:34 | Prepare for release. Fix indexer bug. Add index.Store.Write. ... (check-in: 2b8648602f user: stern tags: trunk) | |
Added .deepsource.toml.
|
Changes to Makefile.
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 | - + - - + - - - - - - - - - - - + - - - - - + + - - - - + - + - - - - - + |
|
Changes to VERSION.
| 1 | - + |
|
Changes to ast/ast.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - - - - - - - + + + + + + + + | } // RefState indicates the state of the reference. type RefState int // Constants for RefState const ( |
Changes to ast/attr.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + | for k, v := range a.Attrs { attrs[k] = v } return &Attributes{attrs} } // Set changes the attribute that a given key has now a given value. |
︙ |
Changes to ast/ref.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 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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - + - + + + + + + + + + + - + - - - - + + - + + + - + - + - + - + - + + + | //----------------------------------------------------------------------------- |
Changes to ast/ref_test.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | + | {"http://zettelstore.de/z/ast", false, true, false}, {"12345678901234", true, false, false}, {"12345678901234#local", true, false, false}, {"http://12345678901234", false, true, false}, {"http://zettelstore.de/z/12345678901234", false, true, false}, {"http://zettelstore.de/12345678901234", false, true, false}, {"/12345678901234", false, false, true}, {"//12345678901234", false, false, true}, {"./12345678901234", false, false, true}, {"../12345678901234", false, false, true}, {".../12345678901234", false, true, false}, } for i, tc := range testcases { ref := ast.ParseReference(tc.link) |
︙ |
Changes to auth/cred/cred.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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - + - + - + - + | //----------------------------------------------------------------------------- |
Changes to auth/policy/anon.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 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 | - - - - - + - + - + - + - + | type anonPolicy struct { simpleMode bool expertMode func() bool getVisibility func(*meta.Meta) meta.Visibility pre Policy } |
Changes to auth/policy/default.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 30 31 32 33 34 35 36 | - + - - - - - + - - - - + - - - - + - - + - - - - + - - + - - + | //----------------------------------------------------------------------------- |
︙ |
Changes to auth/policy/owner.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 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 57 58 59 60 61 | - - - - - - - - - + - + - + - + | type ownerPolicy struct { expertMode func() bool isOwner func(id.Zid) bool getVisibility func(*meta.Meta) meta.Visibility pre Policy } |
︙ | |||
79 80 81 82 83 84 85 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - + | var noChangeUser = []string{ meta.KeyID, meta.KeyRole, meta.KeyUserID, meta.KeyUserRole, } |
︙ | |||
109 110 111 112 113 114 115 | 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 | - + - + | } if runtime.GetUserRole(user) == meta.UserRoleReader { return false } return o.userCanCreate(user, newMeta) } |
︙ |
Changes to auth/policy/place.go.
︙ | |||
53 54 55 56 57 58 59 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - - + | return pp.place.Location() } func (pp *polPlace) CanCreateZettel(ctx context.Context) bool { return pp.place.CanCreateZettel(ctx) } |
︙ | |||
86 87 88 89 90 91 92 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - + | user := session.GetUser(ctx) if pp.policy.CanRead(user, m) { return m, nil } return nil, place.NewErrNotAllowed("GetMeta", user, zid) } |
︙ | |||
161 162 163 164 165 166 167 | 160 161 162 163 164 165 166 167 168 169 | - - - - - - - | user := session.GetUser(ctx) if pp.policy.CanDelete(user, meta) { return pp.place.DeleteZettel(ctx, zid) } return place.NewErrNotAllowed("Delete", user, zid) } |
Changes to auth/policy/policy.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 30 31 32 33 34 35 36 37 38 39 40 41 | - + - - - - + - + - + - + - + | //----------------------------------------------------------------------------- |
︙ | |||
70 71 72 73 74 75 76 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - - - - - + - + - + - + - + | return &prePolicy{pol} } type prePolicy struct { post Policy } |
Changes to auth/policy/policy_test.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - | } else { expertFunc = noExpertMode } pol := newPolicy(ts.simple, authFunc, ts.readonly, expertFunc, isOwner, getVisibility) name := fmt.Sprintf("simple=%v/readonly=%v/withauth=%v/expert=%v", ts.simple, ts.readonly, ts.withAuth, ts.expert) t.Run(name, func(tt *testing.T) { |
︙ | |||
87 88 89 90 91 92 93 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - - - - - - - - - - - - - - - - - - - - - - + | case meta.ValueVisibilitySimple: return meta.VisibilitySimple } } return meta.VisibilityLogin } |
︙ | |||
151 152 153 154 155 156 157 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - + | if tc.exp != got { tt.Errorf("exp=%v, but got=%v", tc.exp, got) } }) } } |
︙ | |||
236 237 238 239 240 241 242 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - + | if tc.exp != got { tt.Errorf("exp=%v, but got=%v", tc.exp, got) } }) } } |
︙ | |||
377 378 379 380 381 382 383 | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | - + | if tc.exp != got { tt.Errorf("exp=%v, but got=%v", tc.exp, got) } }) } } |
︙ | |||
462 463 464 465 466 467 468 | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | - + | if tc.exp != got { tt.Errorf("exp=%v, but got=%v", tc.exp, got) } }) } } |
︙ |
Changes to auth/policy/readonly.go.
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + - - - - - + - - - - + - - - - + - - - - + - - - - + - - | //----------------------------------------------------------------------------- |
Changes to auth/token/token.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + | // GetToken returns a token to be used for authentification. func GetToken(ident *meta.Meta, d time.Duration, kind Kind) ([]byte, error) { if role, ok := ident.Get(meta.KeyRole); !ok || role != meta.ValueRoleUser { return nil, ErrNoUser } subject, ok := ident.Get(meta.KeyUserID) |
︙ | |||
100 101 102 103 104 105 106 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | - + | } now := time.Now().Round(time.Second) expires := claims.Expires.Time() if expires.Before(now) { return Data{}, ErrTokenExpired } ident := claims.Subject |
︙ |
Changes to cmd/cmd_run.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - + - - + - - - + + + + + + + + + + - - + + + + - - + + - - + - - - + - - - - - - - - + - | ucAuthenticate := usecase.NewAuthenticate(up) ucGetMeta := usecase.NewGetMeta(pp) ucGetZettel := usecase.NewGetZettel(pp) ucParseZettel := usecase.NewParseZettel(ucGetZettel) ucListMeta := usecase.NewListMeta(pp) ucListRoles := usecase.NewListRole(pp) ucListTags := usecase.NewListTags(pp) |
Changes to cmd/cmd_run_simple.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 30 31 32 33 34 35 | - + - - + - - - - - - - - - - - - | //----------------------------------------------------------------------------- |
︙ | |||
58 59 60 61 62 63 64 | 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | return 0, nil } // runSimple is called, when the user just starts the software via a double click // or via a simple call ``./zettelstore`` on the command line. func runSimple() { dir := "./zettel" |
Changes to cmd/main.go.
︙ | |||
120 121 122 123 124 125 126 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | - + | case "v": cfg.Set(startup.KeyVerbose, flg.Value.String()) } }) return cfg } |
︙ |
Changes to cmd/zettelstore/main.go.
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 | - + - + | package main import ( "zettelstore.de/z/cmd" ) // Version variable. Will be filled by build process. |
Changes to collect/collect.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ |
Changes to collect/collect_test.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ |
Added collect/order.go.
|
Changes to collect/split.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 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 | - + - - + - - + - - - - + + + + - - + - - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + | //----------------------------------------------------------------------------- |
Changes to config/runtime/runtime.go.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - - | // under this license. //----------------------------------------------------------------------------- // Package runtime provides functions to retrieve runtime configuration data. package runtime import ( |
︙ | |||
130 131 132 133 134 135 136 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - - + + - + - + | if name, ok := config.Get(meta.KeySiteName); ok { return name } } return "Zettelstore" } |
︙ | |||
177 178 179 180 181 182 183 | 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 201 202 203 204 205 | - + - + - - + - | // GetMarkerExternal returns the current value of the "marker-external" key. func GetMarkerExternal() string { if config := getConfigurationMeta(); config != nil { if html, ok := config.Get(meta.KeyMarkerExternal); ok { return html } } |
Changes to config/startup/startup.go.
︙ | |||
100 101 102 103 104 105 106 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - | h := fnv.New128() if secret, ok := cfg.Get("secret"); ok { io.WriteString(h, secret) } io.WriteString(h, version.Prog) io.WriteString(h, version.Build) io.WriteString(h, version.Hostname) |
︙ |
Changes to docs/manual/00000000000100.zettel.
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 | - - | id: 00000000000100 title: Zettelstore Runtime Configuration role: configuration syntax: none default-copyright: (c) 2020-2021 by Detlef Stern <ds@zettelstore.de> default-license: EUPL-1.2-or-later default-visibility: public footer-html: <hr><p><a href="/home/doc/trunk/www/impri.wiki">Imprint / Privacy</a></p> |
Deleted docs/manual/00001000000000.zettel.
| - - - - - - - - - - - - - - - - - - - - - - |
|
Changes to docs/manual/00001001000000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001001000000 title: Introduction to the Zettelstore role: manual tags: #introduction #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001002000000.zettel.
|
Changes to docs/manual/00001003000000.zettel.
|
Changes to docs/manual/00001004000000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004000000 title: Configuration of Zettelstore role: manual tags: #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001004010000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004010000 title: Zettelstore start-up configuration role: manual tags: #configuration #manual #zettelstore syntax: zmk |
︙ | |||
38 39 40 41 42 43 44 | 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 62 63 64 65 66 67 68 69 70 71 72 73 | - + - + | If ''true'', a persistent cookie is used. Its lifetime exceeds the lifetime of the authentication token (see option ''token-lifetime-html'') by 30 seconds. Default: ''false'' ; [!place-X-uri]''place-//X//-uri'', where //X// is a number greater or equal to one : Specifies a [[place|00001004011200]] where zettel are stored. |
Changes to docs/manual/00001004011200.zettel.
|
Changes to docs/manual/00001004011400.zettel.
|
Changes to docs/manual/00001004020000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004020000 title: Configure the running Zettelstore role: manual tags: #configuration #manual #zettelstore syntax: zmk |
︙ | |||
45 46 47 48 49 50 51 52 53 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + + + - + - - - | This affects most computed zettel. Default: False. ; [!footer-html]''footer-html'' : Contains some HTML code that will be included into the footer of each Zettelstore web page. It only affects the [[web user interface|00001014000000]]. Zettel content, delivered via the [[API|00001012000000]] as JSON, etc. is not affected. Default: (the empty string). ; [!home-zettel]''home-zettel'' : Specifies the identifier of the zettel, that should be presented for the default view / home view. If not given or if the identifier does not identify a zettel, the zettel with the identifier ''00010000000000'' is shown. ; [!marker-external]''marker-external'' : Some HTML code that is displayed after a reference to external material. |
︙ |
Changes to docs/manual/00001004050000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004050000 title: Command line parameters role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001004050200.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004050200 title: The ''help'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001004050400.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004050400 title: The ''version'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001004050600.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004050600 title: The ''config'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001004051000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004051000 title: The ''run'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ | |||
38 39 40 41 42 43 44 | 37 38 39 40 41 42 43 44 45 46 | - + | ; ''-r'' : Puts the Zettelstore in read-only mode. No changes are possible via the web interface / via the API. This allows to publish your content without any risks of unauthorized changes. ; ''-v'' : Be more verbose in writing logs. |
Changes to docs/manual/00001004051100.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004051100 title: The ''run-simple'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001004051200.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004051200 title: The ''file'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001004051400.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001004051400 title: The ''password'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001005000000.zettel.
1 2 3 4 5 | 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 30 31 32 33 34 35 | - - + - + | id: 00001005000000 title: Structure of Zettelstore role: manual tags: #design #manual #zettelstore syntax: zmk |
︙ | |||
49 50 51 52 53 54 55 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + | It maintains this relationship as long as theses files exists. In case of some textual zettel content you do not want to store the metadata and the zettel content in two different files. Here the ''.zettel'' extension will signal that the metadata and the zettel content will be placed in the same file, separated by an empty line or a line with three dashes (""''-\-\-''"", also known as ""YAML separator""). === Predefined zettel |
︙ |
Changes to docs/manual/00001005090000.zettel.
1 2 3 4 5 | 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 30 31 32 33 34 35 36 37 38 39 | - - - + + + - - + + + | id: 00001005090000 title: List of predefined zettel role: manual tags: #manual #reference #zettelstore syntax: zmk |
Changes to docs/manual/00001006000000.zettel.
|
Changes to docs/manual/00001006010000.zettel.
|
Changes to docs/manual/00001006020000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001006020000 title: Supported Metadata Keys role: manual tags: #manual #meta #reference #zettel #zettelstore syntax: zmk |
︙ | |||
72 73 74 75 76 77 78 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | - + | If not given, the value ''default-role'' from the [[configuration zettel|00001004020000#default-role]] will be used. ; [!syntax]''syntax'' : Specifies the syntax that should be used for interpreting the zettel. The zettel about [[other markup languages|00001008000000]] defines supported values. If not given, the value ''default-syntax'' from the [[configuration zettel|00001004020000#default-syntax]] will be used. ; [!tags]''tags'' : Contains a space separated list of tags to describe the zettel further. |
︙ | |||
97 98 99 100 101 102 103 | 96 97 98 99 100 101 102 | - - - - - - | See [[User roles|00001010070300]] for more details. ; [!visibility]''visibility'' : When you work with authentication, you can give every zettel a value to decide, who can see the zettel. Its default value can be set with [[''default-visibility''|00001004020000#default-visibility]] of the configuration zettel. See [[visibility rules for zettel|00001010070200]] for more details. |
Changes to docs/manual/00001006020100.zettel.
|
Changes to docs/manual/00001006020400.zettel.
|
Changes to docs/manual/00001006030000.zettel.
1 2 3 4 5 | 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 | - - - + + - - - + + + - - + - - + - - - - - - - + + + + + + + + + + - - - + | id: 00001006030000 title: Supported Key Types role: manual tags: #manual #meta #reference #zettel #zettelstore syntax: zmk |
Added docs/manual/00001006030500.zettel.
|
Added docs/manual/00001006031000.zettel.
|
Added docs/manual/00001006031500.zettel.
|
Added docs/manual/00001006032000.zettel.
|
Added docs/manual/00001006032500.zettel.
|
Added docs/manual/00001006033000.zettel.
|
Added docs/manual/00001006033500.zettel.
|
Added docs/manual/00001006034000.zettel.
|
Added docs/manual/00001006034500.zettel.
|
Added docs/manual/00001006035000.zettel.
|
Added docs/manual/00001006035500.zettel.
|
Added docs/manual/00001006036000.zettel.
|
Added docs/manual/00001006036500.zettel.
|
Changes to docs/manual/00001006050000.zettel.
|
Changes to docs/manual/00001007000000.zettel.
|
Changes to docs/manual/00001007010000.zettel.
|
Changes to docs/manual/00001007020000.zettel.
|
Changes to docs/manual/00001007030000.zettel.
|
Changes to docs/manual/00001007030100.zettel.
|
Changes to docs/manual/00001007030200.zettel.
|
Changes to docs/manual/00001007030300.zettel.
|
Changes to docs/manual/00001007030400.zettel.
|
Changes to docs/manual/00001007030500.zettel.
|
Changes to docs/manual/00001007030600.zettel.
|
Changes to docs/manual/00001007030700.zettel.
|
Changes to docs/manual/00001007030800.zettel.
|
Changes to docs/manual/00001007030900.zettel.
|
Changes to docs/manual/00001007031000.zettel.
|
Changes to docs/manual/00001007040000.zettel.
|
Changes to docs/manual/00001007040100.zettel.
|
Changes to docs/manual/00001007040200.zettel.
|
Changes to docs/manual/00001007040300.zettel.
|
Changes to docs/manual/00001007050000.zettel.
|
Changes to docs/manual/00001007050100.zettel.
|
Changes to docs/manual/00001007050200.zettel.
|
Changes to docs/manual/00001007060000.zettel.
|
Changes to docs/manual/00001008000000.zettel.
1 2 3 4 5 | 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 | - - + | id: 00001008000000 title: Other Markup Languages role: manual tags: #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001008010000.zettel.
|
Changes to docs/manual/00001010000000.zettel.
|
Changes to docs/manual/00001010040100.zettel.
|
Changes to docs/manual/00001010040200.zettel.
|
Changes to docs/manual/00001010040400.zettel.
|
Changes to docs/manual/00001010040700.zettel.
|
Changes to docs/manual/00001010070200.zettel.
|
Changes to docs/manual/00001010070300.zettel.
|
Changes to docs/manual/00001010070400.zettel.
|
Changes to docs/manual/00001010070600.zettel.
|
Changes to docs/manual/00001010090100.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001010090100 title: External server to encrypt message transport role: manual tags: #configuration #encryption #manual #security #zettelstore syntax: zmk |
︙ | |||
63 64 65 66 67 68 69 | 62 63 64 65 66 67 68 69 70 | - + | reverse_proxy localhost:23123 } } ``` This will forwards requests with the prefix ""/manual"" to the running Zettelstore. All other requests will be handled by Caddy itself. |
Changes to docs/manual/00001012000000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001012000000 title: API role: manual tags: #api #manual #zettelstore syntax: zmk |
︙ | |||
29 30 31 32 33 34 35 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - - + + + + | === Zettel lists * [[List metadata of all zettel|00001012051200]] * [[List all zettel, but in different encoding formats|00001012051400]] * [[List all zettel, but include different parts of a zettel|00001012051600]] * [[Shape the list of zettel metadata with filter options|00001012051800]] * [[Sort the list of zettel metadata|00001012052000]] |
Changes to docs/manual/00001012050200.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - - + | id: 00001012050200 title: API: Authenticate a client role: manual tags: #api #manual #zettelstore syntax: zmk |
︙ |
Changes to docs/manual/00001012050400.zettel.
|
Changes to docs/manual/00001012050600.zettel.
|
Changes to docs/manual/00001012051200.zettel.
|
Changes to docs/manual/00001012051400.zettel.
|
Changes to docs/manual/00001012051600.zettel.
|
Changes to docs/manual/00001012051800.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - - + | id: 00001012051800 title: API: Shape the list of zettel metadata with filter options role: manual tags: #api #manual #zettelstore syntax: zmk |
︙ | |||
38 39 40 41 42 43 44 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + | === Limit and offset By using the query parameter ""''_limit''"", which must have an integer value, you specifying an upper limit of list elements: ```sh # curl 'http://192.168.17.7:23121/z?title=API&_part=id&_sort=id&_limit=2' {"list":[{"id":"00001012000000","url":"/z/00001012000000"},{"id":"00001012050200","url":"/z/00001012050200"}]} ``` |
Changes to docs/manual/00001012052000.zettel.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 | - | id: 00001012052000 title: API: Sort the list of zettel metadata role: manual tags: #api #manual #zettelstore syntax: zmk |
︙ |
Added docs/manual/00001012052200.zettel.
|
Added docs/manual/00001012052400.zettel.
|
Changes to docs/manual/00001012053400.zettel.
|
Changes to docs/manual/00001012053600.zettel.
|
Added docs/manual/00001012053800.zettel.
|
Added docs/manual/00001012054000.zettel.
|
Changes to docs/manual/00001012920000.zettel.
|
Changes to docs/manual/00001012920500.zettel.
|
Changes to docs/manual/00001012920501.zettel.
|
Changes to docs/manual/00001012920503.zettel.
|
Changes to docs/manual/00001012920510.zettel.
|
Changes to docs/manual/00001012920513.zettel.
|
Changes to docs/manual/00001012920516.zettel.
|
Changes to docs/manual/00001012920519.zettel.
|
Changes to docs/manual/00001012920522.zettel.
|
Changes to docs/manual/00001012920800.zettel.
|
Changes to docs/manual/00001012921000.zettel.
|
Changes to docs/manual/00001014000000.zettel.
|
Added docs/manual/00010000000000.zettel.
|
Changes to domain/id/id.go.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 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 57 58 59 60 61 62 63 64 | - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + - + | //----------------------------------------------------------------------------- // Package id provides domain specific types, constants, and functions about // zettel identifier. package id import ( |
︙ | |||
98 99 100 101 102 103 104 | 108 109 110 111 112 113 114 | - - - - - - - - - - - | } res, err := Parse(s) if err != nil { panic(err) } return res } |
Changes to domain/id/id_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 | - + - - - | //----------------------------------------------------------------------------- |
︙ |
Added domain/id/set.go.
|
Added domain/id/slice.go.
|
Added domain/id/slice_test.go.
|
Changes to domain/meta/meta.go.
︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | + + + + + + + + | // IsComputed returns true, if key denotes a computed metadata key. func IsComputed(name string) bool { if kd, ok := registeredKeys[name]; ok { return kd.IsComputed() } return false } // Inverse returns the name of the inverse key. func Inverse(name string) string { if kd, ok := registeredKeys[name]; ok { return kd.Inverse } return "" } // GetDescription returns the key description object of the given key name. func GetDescription(name string) DescriptionKey { if d, ok := registeredKeys[name]; ok { return *d } return DescriptionKey{Type: TypeUnknown} |
︙ | |||
118 119 120 121 122 123 124 125 126 127 | 126 127 128 129 130 131 132 133 134 135 136 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 | + - - - | KeyDefaultTitle = registerKey("default-title", TypeZettelmarkup, usageUser, "") KeyDefaultVisibility = registerKey("default-visibility", TypeWord, usageUser, "") KeyDuplicates = registerKey("duplicates", TypeBool, usageUser, "") KeyExpertMode = registerKey("expert-mode", TypeBool, usageUser, "") KeyFolge = registerKey("folge", TypeIDSet, usageProperty, "") KeyFooterHTML = registerKey("footer-html", TypeString, usageUser, "") KeyForward = registerKey("forward", TypeIDSet, usageProperty, "") KeyHomeZettel = registerKey("home-zettel", TypeID, usageUser, "") KeyLang = registerKey("lang", TypeWord, usageUser, "") KeyLicense = registerKey("license", TypeEmpty, usageUser, "") KeyListPageSize = registerKey("list-page-size", TypeNumber, usageUser, "") |
︙ | |||
233 234 235 236 237 238 239 | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | - + - + | } value, ok := m.pairs[key] return value, ok } // GetDefault retrieves the string value of the given key. If no value was // stored, the given default value is returned. |
︙ |
Changes to domain/meta/parse.go.
︙ | |||
177 178 179 180 181 182 183 | 177 178 179 180 181 182 183 184 185 186 187 | - - | _, err := id.Parse(s) return err == nil }) case TypeTimestamp: if _, ok := TimeValue(v); ok { m.Set(key, v) } |
Changes to domain/meta/type.go.
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | + | // under this license. //----------------------------------------------------------------------------- // Package meta provides the domain specific type 'meta'. package meta import ( "strconv" "strings" "time" ) // DescriptionType is a description of a specific key type. type DescriptionType struct { Name string |
︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + + + + + + + + | if key != KeyID { for i, val := range values { values[i] = trimValue(val) } m.pairs[key] = strings.Join(values, " ") } } // CleanTag removes the number charachter ('#') from a tag value. func CleanTag(tag string) string { if len(tag) > 1 && tag[0] == '#' { return tag[1:] } return tag } // SetNow stores the current timestamp under the given key. func (m *Meta) SetNow(key string) { m.Set(key, time.Now().Format("20060102150405")) } // BoolValue returns the value interpreted as a bool. |
︙ | |||
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | 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 172 173 174 175 176 | + + + + + + + + + + + + + + + + + + + + + + + | func (m *Meta) GetList(key string) ([]string, bool) { value, ok := m.Get(key) if !ok { return nil, false } return ListFromValue(value), true } // GetTags returns the list of tags as a string list. Each tag does not begin // with the '#' character, in contrast to `GetList`. func (m *Meta) GetTags(key string) ([]string, bool) { tags, ok := m.GetList(key) if !ok { return nil, false } for i, tag := range tags { tags[i] = CleanTag(tag) } return tags, len(tags) > 0 } // GetListOrNil retrieves the string list value of a given key. If there was // nothing stores, a nil list is returned. func (m *Meta) GetListOrNil(key string) []string { if value, ok := m.GetList(key); ok { return value } return nil } // GetNumber retrieves the numeric value of a given key. func (m *Meta) GetNumber(key string) (int, bool) { if value, ok := m.Get(key); ok { if num, err := strconv.Atoi(value); err == nil { return num, true } } return 0, false } |
Changes to encoder/encoder.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
31 32 33 34 35 36 37 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - - - - - + + + + + | WriteContent(io.Writer, *ast.ZettelNode) (int, error) WriteBlocks(io.Writer, ast.BlockSlice) (int, error) WriteInlines(io.Writer, ast.InlineSlice) (int, error) } // Some errors to signal when encoder methods are not implemented. var ( |
︙ |
Changes to encoder/htmlenc/block.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | "zettelstore.de/z/ast" ) // VisitPara emits HTML code for a paragraph: <p>...</p> func (v *visitor) VisitPara(pn *ast.ParaNode) { v.b.WriteString("<p>") v.acceptInlineSlice(pn.Inlines) |
︙ | |||
192 193 194 195 196 197 198 | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | - + - + | } else { v.b.WriteString("<p>") inPara = true } v.acceptInlineSlice(pn.Inlines) } else { if inPara { |
︙ | |||
333 334 335 336 337 338 339 | 333 334 335 336 337 338 339 340 341 342 343 | + + + + | v.b.WriteString("\" title=\"") v.writeQuotedEscaped(bn.Title) v.b.WriteString("\">\n") default: v.b.WriteStrings("<p class=\"error\">Unable to display BLOB with syntax '", bn.Syntax, "'.</p>\n") } } func (v *visitor) writeEndPara() { v.b.WriteString("</p>\n") } |
Changes to encoder/htmlenc/htmlenc.go.
︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - - + | switch opt.Key { case "newwindow": he.newWindow = opt.Value case "xhtml": he.xhtml = opt.Value } case *encoder.StringsOption: |
︙ |
Changes to encoder/htmlenc/inline.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + | func (v *visitor) VisitText(tn *ast.TextNode) { v.writeHTMLEscaped(tn.Text) } // VisitTag writes tag content. func (v *visitor) VisitTag(tn *ast.TagNode) { // TODO: erst mal als span. Link wäre gut, muss man vermutlich via Callback lösen. |
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | - + - + | return } } v.lang.push(ln.Attrs) defer v.lang.pop() switch ln.Ref.State { |
︙ |
Changes to encoder/htmlenc/visitor.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
45 46 47 48 49 50 51 52 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | + + + - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - | var mapMetaKey = map[string]string{ meta.KeyCopyright: "copyright", meta.KeyLicense: "license", } func (v *visitor) acceptMeta(m *meta.Meta, withTitle bool) { for i, pair := range m.Pairs(true) { if v.enc.ignoreMeta[pair.Key] { continue } if i == 0 { // "title" is number 0... |
︙ |
Changes to encoder/jsonenc/djsonenc.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
320 321 322 323 324 325 326 | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | - - - - - - - + + + + + + + + | } else { v.writeNodeStart("Soft") } v.b.WriteByte('}') } var mapRefState = map[ast.RefState]string{ |
︙ | |||
577 578 579 580 581 582 583 | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | - - + - - - - - - - - + + + + + + + + + + + + + | first = false } else { v.b.WriteString(",\"") } v.b.Write(Escape(p.Key)) v.b.WriteString("\":") if m.Type(p.Key).IsSet { |
Changes to encoder/jsonenc/jsonenc.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | }) } // jsonEncoder is just a stub. It is not implemented. The real implementation // is in file web/adapter/json.go type jsonEncoder struct{} |
︙ |
Changes to encoder/nativeenc/nativeenc.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
131 132 133 134 135 136 137 | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - + - + | first = false } v.level-- v.b.WriteByte(']') } } |
︙ | |||
378 379 380 381 382 383 384 | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | - - - - - - - + + + + + + + + | v.b.WriteString("Break") } else { v.b.WriteString("Space") } } var mapRefState = map[ast.RefState]string{ |
︙ |
Changes to encoder/rawenc/rawenc.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + | encoder.Register("raw", encoder.Info{ Create: func() encoder.Encoder { return &rawEncoder{} }, }) } type rawEncoder struct{} |
︙ |
Changes to encoder/textenc/textenc.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + | encoder.Register("text", encoder.Info{ Create: func() encoder.Encoder { return &textEncoder{} }, }) } type textEncoder struct{} |
︙ |
Changes to encoder/zmkenc/zmkenc.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | - + | encoder.Register("zmk", encoder.Info{ Create: func() encoder.Encoder { return &zmkEncoder{} }, }) } type zmkEncoder struct{} |
︙ |
Changes to go.mod.
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 | - + | module zettelstore.de/z go 1.15 require ( github.com/fsnotify/fsnotify v1.4.9 github.com/pascaldekloe/jwt v1.10.0 |
Changes to go.sum.
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | - - + + | github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/pascaldekloe/jwt v1.10.0 h1:ktcIUV4TPvh404R5dIBEnPCsSwj0sqi3/0+XafE5gJs= github.com/pascaldekloe/jwt v1.10.0/go.mod h1:TKhllgThT7TOP5rGr2zMLKEDZRAgJfBbtKyVeRsNB9A= |
︙ |
Changes to index/index.go.
︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | - + | _, ok := ctx.Value(ctxNoEnrichKey).(*ctxNoEnrichType) return ok } // Port contains all the used functions to access zettel to be indexed. type Port interface { RegisterObserver(func(place.ChangeInfo)) |
︙ | |||
87 88 89 90 91 92 93 | 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 | + - + + - + - + | // Store all relevant zettel data. There may be multiple implementations, i.e. // memory-based, file-based, based on SQLite, ... type Store interface { Enricher // UpdateReferences for a specific zettel. // Returns set of zettel identifier that must also be checked for changes. |
Changes to index/indexer/anteroom.go.
︙ | |||
12 13 14 15 16 17 18 19 20 21 | 12 13 14 15 16 17 18 19 20 21 22 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 127 128 129 130 131 132 133 134 135 136 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 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | + + + + + + + + + - + - - + + - + - - - - - + + + + + + + + + + + - + - + - - - - + + + + - - + + - + - + - + - - - - - - + - - - - - - + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + | package indexer import ( "sync" "zettelstore.de/z/domain/id" ) type arAction int const ( arNothing arAction = iota arReload arUpdate arDelete ) type anteroom struct { next *anteroom |
Changes to index/indexer/anteroom_test.go.
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 | - - - - + + + + - - + + - - + + - + - - - + + + - + - - - + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - + - - - + + + | "testing" "zettelstore.de/z/domain/id" ) func TestSimple(t *testing.T) { ar := newAnterooms(2) |
Changes to index/indexer/indexer.go.
︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - + - + | } func (idx *indexer) observer(ci place.ChangeInfo) { switch ci.Reason { case place.OnReload: idx.ar.Reset() case place.OnUpdate: |
︙ | |||
107 108 109 110 111 112 113 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 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 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 201 202 203 204 205 206 | - + + - - - + - - - - - + + + - - - - - + + + + - - - - - + - - - + + - - + + + + + - + + + + + + + + + + - - + + + + - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + | st.DurLastIndex = idx.durLastIndex idx.mx.RUnlock() idx.store.ReadStats(&st.Store) } type indexerPort interface { getMetaPort |
︙ | |||
211 212 213 214 215 216 217 | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | - + + - - + - - + - + - - + - + + + + + + + + | } } } zn := parser.ParseZettel(zettel, "") refs := collect.References(zn) updateReferences(ctx, refs.Links, p, zi) updateReferences(ctx, refs.Images, p, zi) |
Changes to index/memstore/memstore.go.
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 127 128 129 130 131 132 133 134 135 136 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 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 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 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 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 | - - + + - - - + + + - + - - + + + - + + - - + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + + + + - - - - - - + - + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + - + - - - + - - + - + - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + - + - + - - - - + + + + + + + + + + + + | "zettelstore.de/z/domain/id" "zettelstore.de/z/domain/meta" "zettelstore.de/z/index" ) type metaRefs struct { |
Changes to index/memstore/refs.go.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - - - - - - - - - - - - - - + | // under this license. //----------------------------------------------------------------------------- // Package memstore stored the index in main memory. package memstore import ( |
︙ | |||
50 51 52 53 54 55 56 | 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 62 63 64 65 66 67 68 69 70 | - + - + - + - + | } if opos < len(refsO) { remRefs = append(remRefs, refsO[opos:]...) } return newRefs, remRefs } |
︙ | |||
91 92 93 94 95 96 97 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + - - - - - - - + + + + + + - | } if rpos < len(refs) { result = append(result, refs[rpos:]...) } return result } |
Changes to index/memstore/refs_test.go.
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 127 128 129 130 131 132 133 134 | - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - + + - - - - - - + + + + + + - + - + - + - - - - - - + + + + + + - + - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - + + + + + + + - + | import ( "testing" "zettelstore.de/z/domain/id" ) |
Changes to index/zettel.go.
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | - - - - + + + + - - - + + + - + - - + + - - + + - + - + - + - - - - - - - - - - - - | import ( "zettelstore.de/z/domain/id" ) // ZettelIndex contains all index data of a zettel. type ZettelIndex struct { |
Changes to input/input.go.
︙ | |||
85 86 87 88 89 90 91 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | - | inp.Next() } inp.Ch = '\n' inp.Next() case '\n': inp.Next() } |
︙ |
Changes to parser/cleanup.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - + | if mn == nil { return } if !cv.doMark { cv.hasMark = true return } |
︙ |
Changes to parser/markdown/markdown.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
280 281 282 283 284 285 286 | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - + | result = append(result, &ast.BreakNode{Hard: false}) } return result } // splitText transform the text into a sequence of TextNode and SpaceNode func splitText(text string) ast.InlineSlice { |
︙ | |||
315 316 317 318 319 320 321 | 315 316 317 318 319 320 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 | - + - - - - - - - - - - - - - - + - + - - + + + + + + + + + + + | panic(fmt.Sprintf("Unexpected state %v", state)) } return result } // cleanText removes backslashes from TextNodes and expands entities func cleanText(text string, cleanBS bool) string { |
︙ | |||
368 369 370 371 372 373 374 | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | - + - - + | Attrs: nil, //TODO Text: cleanCodeSpan(string(node.Text(p.source))), }, } } func cleanCodeSpan(text string) string { |
︙ |
Changes to parser/parser.go.
︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - + | return ParseInlines(input.NewInput(title), meta.ValueSyntaxZmk) } // ParseZettel parses the zettel based on the syntax. func ParseZettel(zettel domain.Zettel, syntax string) *ast.ZettelNode { m := zettel.Meta inhMeta := runtime.AddDefaultValues(zettel.Meta) |
︙ |
Changes to parser/plain/plain.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
55 56 57 58 59 60 61 | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + - | } } func readLines(inp *input.Input) (lines []string) { for { inp.EatEOL() posL := inp.Pos |
︙ |
Changes to parser/zettelmark/block.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
367 368 369 370 371 372 373 | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | - + - - | if parentPos < 0 { return cp.lists[0], true } if prevItems := cp.lists[parentPos].Items; len(prevItems) > 0 { lastItem := len(prevItems) - 1 prevItems[lastItem] = append(prevItems[lastItem], cp.lists[childPos]) } else { |
︙ | |||
452 453 454 455 456 457 458 | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 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 515 516 517 518 519 520 521 522 523 | - - - - - - - + - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - | inp.Next() if inp.Ch != ' ' { break } cnt++ } if cp.lists != nil { |
︙ |
Changes to parser/zettelmark/inline.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | - + - | case '^': in, success = cp.parseFootnote() case '!': in, success = cp.parseMark() } case '{': inp.Next() |
︙ |
Changes to parser/zettelmark/node.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 30 31 32 33 34 35 | - + - + - - - - - - | //----------------------------------------------------------------------------- |
Changes to parser/zettelmark/post-processor.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
37 38 39 40 41 42 43 | 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 62 63 64 65 66 67 68 69 70 | - + - + | // VisitPara post-processes a paragraph. func (pp *postProcessor) VisitPara(pn *ast.ParaNode) { if pn != nil { pn.Inlines = pp.processInlineSlice(pn.Inlines) } } |
︙ | |||
89 90 91 92 93 94 95 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + - - | } if len(tn.Rows) > 0 && isHeaderRow(tn.Rows[0]) { tn.Header = tn.Rows[0] tn.Rows = tn.Rows[1:] for pos, cell := range tn.Header { if inlines := cell.Inlines; len(inlines) > 0 { if textNode, ok := inlines[0].(*ast.TextNode); ok { |
︙ | |||
437 438 439 440 441 442 443 | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | - - + | ins[toPos] = nil // Kill node to enable garbage collection } return toPos } func (pp *postProcessor) processInlineSliceInplace(ins ast.InlineSlice) { for _, in := range ins { |
Changes to parser/zettelmark/zettelmark.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
135 136 137 138 139 140 141 | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | - + | updateAttrs(attrs, key, inp.Src[posV:inp.Pos]) return true } inp.Next() } } |
︙ |
Changes to parser/zettelmark/zettelmark_test.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
874 875 876 877 878 879 880 | 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | - + | for _, k := range keys { tv.b.WriteByte(' ') tv.b.WriteString(k) v := a.Attrs[k] if len(v) > 0 { tv.b.WriteByte('=') |
Changes to place/constplace/constdata.go.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 127 128 129 130 131 132 133 134 135 136 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 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - - + - + - - + - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + - - - + - - + - + - - + - - + + + + - + - + + - + - - + - - + - + - - + + - - + | // under this license. //----------------------------------------------------------------------------- // Package constplace stores zettel inside the executable. package constplace import ( |
︙ | |||
244 245 246 247 248 249 250 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - - + + + + + + + + + + + + + + + + + + + + + + + + + - + | {{#Matrix}} <tr> {{#Elements}}{{#HasURL}}<td><a href="{{{URL}}}">{{Text}}</td>{{/HasURL}}{{^HasURL}}<th>{{Text}}</th>{{/HasURL}} {{/Elements}} </tr> {{/Matrix}} </table> |
︙ | |||
286 287 288 289 290 291 292 | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - + - - - + | <div> <label for="syntax">Syntax</label> <input class="zs-input" type="text" id="syntax" name="syntax" placeholder="syntax.." value="{{MetaSyntax}}"> </div> <div> {{#IsTextContent}} <label for="content">Content</label> |
︙ | |||
324 325 326 327 328 329 330 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + | {{#MetaPairs}} <dt>{{Key}}:</dt><dd>{{Value}}</dd> {{/MetaPairs}} </dl> </article>`, }, |
︙ | |||
348 349 350 351 352 353 354 | 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 | - + + + - + + - - + + - + + + - + + - - + + - + | <form method="POST"> <input class="zs-button" type="submit" value="Delete"> </form> </article> {{end}}`, }, |
︙ | |||
633 634 635 636 637 638 639 | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | - + - + | border: 1px solid hsl(210, 5%, 70%); border-radius: .25rem; padding: .1rem .2rem; font-size: 75%; } .zs-meta { font-size:.75rem; |
︙ | |||
662 663 664 665 666 667 668 | 682 683 684 685 686 687 688 689 690 691 692 693 694 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 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | + - + - - + + + + + + + + + + - + - + - - - + + - + - - + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | @media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }`}, |
Changes to place/constplace/constplace.go.
︙ | |||
73 74 75 76 77 78 79 | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - - + + | func (cp *constPlace) GetMeta(ctx context.Context, zid id.Zid) (*meta.Meta, error) { if z, ok := cp.zettel[zid]; ok { return makeMeta(zid, z.header), nil } return nil, place.ErrNotFound } |
︙ | |||
122 123 124 125 126 127 128 | 122 123 124 125 126 127 128 129 130 131 132 | - - | func (cp *constPlace) DeleteZettel(ctx context.Context, zid id.Zid) error { if _, ok := cp.zettel[zid]; ok { return place.ErrReadOnly } return place.ErrNotFound } |
Changes to place/dirplace/directory/service.go.
︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + | func updateEntry(de *Entry, ev *fileEvent) { if ev.ext == "meta" { de.MetaSpec = MetaSpecFile de.MetaPath = ev.path return } |
︙ | |||
111 112 113 114 115 116 117 | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | - + - - - - - - + - - - - - + + + + + + + + + + + + + + + + + + | close(ready) ready = nil } srv.notifyChange(place.OnReload, id.Invalid) case fileStatusError: log.Println("DIRPLACE", "ERROR", ev.err) case fileStatusUpdate: |
︙ |
Changes to place/dirplace/directory/watch.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | - + | "time" "github.com/fsnotify/fsnotify" "zettelstore.de/z/domain/id" ) |
︙ | |||
188 189 190 191 192 193 194 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | - - - - - - - - - - + | } case _, ok := <-tick: return ok } } } |
︙ | |||
228 229 230 231 232 233 234 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + | func addEvent(events []*fileEvent, ev *fileEvent) []*fileEvent { switch ev.status { case fileStatusNone: return events case fileStatusReloadStart: events = events[0:0] case fileStatusUpdate, fileStatusDelete: |
︙ |
Changes to place/dirplace/dirplace.go.
︙ | |||
177 178 179 180 181 182 183 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | - + - + - + + | if err != nil { return nil, err } dp.cleanupMeta(ctx, m) return m, nil } |
︙ | |||
309 310 311 312 313 314 315 | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - + - - - | oldMeta.Zid = newZid newZettel := domain.Zettel{Meta: oldMeta, Content: domain.NewContent(oldContent)} if err := setZettel(dp, &newEntry, newZettel); err != nil { // "Rollback" rename. No error checking... dp.dirSrv.RenameEntry(&newEntry, &curEntry) return err } |
︙ | |||
334 335 336 337 338 339 340 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - - - - - - - - - - | entry := dp.dirSrv.GetEntry(zid) if !entry.IsValid() { return nil } dp.dirSrv.DeleteEntry(zid) err := deleteZettel(dp, &entry, zid) |
︙ |
Changes to place/dirplace/service.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - - + + | } // COMMAND: getMeta ---------------------------------------- // // Retrieves the meta data from a zettel. func getMeta(dp *dirPlace, entry *directory.Entry, zid id.Zid) (*meta.Meta, error) { |
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | + - + + | var m *meta.Meta var content string var err error switch cmd.entry.MetaSpec { case directory.MetaSpecFile: m, err = parseMetaFile(cmd.entry.Zid, cmd.entry.MetaPath) if err == nil { |
︙ | |||
129 130 131 132 133 134 135 | 131 132 133 134 135 136 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 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | entry *directory.Entry zettel domain.Zettel rc chan<- resSetZettel } type resSetZettel = error func (cmd *fileSetZettel) run() { |
︙ | |||
248 249 250 251 252 253 254 | 253 254 255 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 | - - + - + | } func cleanupMeta(m *meta.Meta, entry *directory.Entry) { if title, ok := m.Get(meta.KeyTitle); !ok || title == "" { m.Set(meta.KeyTitle, entry.Zid.String()) } |
︙ |
Changes to place/filter.go.
︙ | |||
29 30 31 32 33 34 35 | 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 | - - + - + - - - - - - - - - - - - - - - | // FilterFunc is a predicate to check if given meta must be selected. type FilterFunc func(*meta.Meta) bool func selectAll(m *meta.Meta) bool { return true } type matchFunc func(value string) bool |
︙ | |||
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 127 128 129 130 131 132 133 134 135 136 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 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | if searchAll == nil { return addSelectFunc(filter, searchMeta) } return addSelectFunc(filter, func(meta *meta.Meta) bool { return searchAll(meta) || searchMeta(meta) }) } func createFilterSpecs(filter *Filter) ([]matchSpec, FilterFunc) { specs := make([]matchSpec, 0, len(filter.Expr)) var searchAll FilterFunc for key, values := range filter.Expr { if key == "" { // Special handling if searching all keys... searchAll = createSearchAllFunc(values, filter.Negate) continue } if meta.KeyIsValid(key) { match := createMatchFunc(key, values) if match != nil { specs = append(specs, matchSpec{key, match}) } } } return specs, searchAll } func addSelectFunc(filter *Filter, f FilterFunc) FilterFunc { if filter == nil { return f } if sel := filter.Select; sel != nil { return func(meta *meta.Meta) bool { return sel(meta) && f(meta) } } return f } func createMatchFunc(key string, values []string) matchFunc { switch meta.Type(key) { case meta.TypeBool: |
︙ | |||
234 235 236 237 238 239 240 | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | - - - - - - - - - | result := make([]string, 0, len(sl)) for _, s := range sl { result = append(result, strings.ToLower(s)) } return result } |
︙ |
Changes to place/manager/manager.go.
︙ | |||
87 88 89 90 91 92 93 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - | return result } // Manager is a coordinating place. type Manager struct { mx sync.RWMutex started bool |
︙ | |||
189 190 191 192 193 194 195 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | - - - - - - - - - + + + + + + + + + + + + + + + - - | func (mgr *Manager) Start(ctx context.Context) error { mgr.mx.Lock() if mgr.started { mgr.mx.Unlock() return place.ErrStarted } for i := len(mgr.subplaces) - 1; i >= 0; i-- { |
︙ | |||
280 281 282 283 284 285 286 | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | - + | return m, err } } return nil, place.ErrNotFound } // FetchZids returns the set of all zettel identifer managed by the place. |
︙ | |||
415 416 417 418 419 420 421 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | - - - - - - - - - - - - - - - - - - | if err := p.DeleteZettel(ctx, zid); err != place.ErrNotFound && err != place.ErrReadOnly { return err } } return place.ErrNotFound } |
︙ |
Changes to place/memplace/memplace.go.
︙ | |||
107 108 109 110 111 112 113 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - + - + | mp.mx.RUnlock() if !ok { return nil, place.ErrNotFound } return zettel.Meta.Clone(), nil } |
︙ | |||
195 196 197 198 199 200 201 | 195 196 197 198 199 200 201 202 203 204 205 206 207 | - - | } delete(mp.zettel, zid) mp.mx.Unlock() mp.notifyChanged(place.OnDelete, zid) return nil } |
Changes to place/place.go.
︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - + | // GetZettel retrieves a specific zettel. GetZettel(ctx context.Context, zid id.Zid) (domain.Zettel, error) // GetMeta retrieves just the meta data of a specific zettel. GetMeta(ctx context.Context, zid id.Zid) (*meta.Meta, error) // FetchZids returns the set of all zettel identifer managed by the place. |
︙ | |||
61 62 63 64 65 66 67 | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | - - - - | // CanDeleteZettel returns true, if place could possibly delete the given zettel. CanDeleteZettel(ctx context.Context, zid id.Zid) bool // DeleteZettel removes the zettel from the place. DeleteZettel(ctx context.Context, zid id.Zid) error |
︙ | |||
138 139 140 141 142 143 144 | 134 135 136 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 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | - + - + - + - + - + - + - + - + - + | } } func (err *ErrNotAllowed) Error() string { if err.User == nil { if err.Zid.IsValid() { return fmt.Sprintf( |
︙ |
Changes to place/progplace/progplace.go.
︙ | |||
118 119 120 121 122 123 124 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | - - + + | return m, nil } } } return nil, place.ErrNotFound } |
︙ | |||
176 177 178 179 180 181 182 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | - - | func (pp *progPlace) DeleteZettel(ctx context.Context, zid id.Zid) error { if _, ok := pp.zettel[zid]; ok { return place.ErrReadOnly } return place.ErrNotFound } |
Changes to place/sorter.go.
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 127 128 129 130 | - + - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | func(i, j int) bool { return metaList[i].Zid > metaList[j].Zid }) return metaList } if s.Order == "" { |
︙ |
Added strfun/strfun.go.
|
Added strfun/strfun_test.go.
|
Changes to template/mustache.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | + + + + - + - - - + | }, nil } type tagReadingResult struct { tag string standalone bool } var skipWhitespaceTagTypes = map[byte]bool{ '#': true, '^': true, '/': true, '<': true, '>': true, '=': true, '!': true, } func (tmpl *Template) readTag(mayStandalone bool) (*tagReadingResult, error) { var text string var err error if tmpl.p < len(tmpl.data) && tmpl.data[tmpl.p] == '{' { text, err = tmpl.readString("}" + tmpl.ctag) } else { text, err = tmpl.readString(tmpl.ctag) } if err == io.EOF { //put the remaining text in a block return nil, parseError{tmpl.curline, "unmatched open tag"} } text = text[:len(text)-len(tmpl.ctag)] //trim the close tag off the text tag := strings.TrimSpace(text) |
︙ | |||
323 324 325 326 327 328 329 | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - | section.nodes = append(section.nodes, &textNode{[]byte(padding)}) } tag := tagResult.tag switch tag[0] { case '!': //ignore comment |
︙ | |||
399 400 401 402 403 404 405 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | - | tmpl.nodes = append(tmpl.nodes, &textNode{[]byte(padding)}) } tag := tagResult.tag switch tag[0] { case '!': //ignore comment |
︙ | |||
495 496 497 498 499 500 501 | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | - + - + | continue Outer default: continue Outer } } } if errMissing { |
︙ |
Changes to template/mustache_test.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
271 272 273 274 275 276 277 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | - + | } // Now set "error on missing varaible" and confirm we get errors. for _, test := range missing { output, err := renderString(test.tmpl, true, test.context) if err == nil { t.Errorf("%q expected missing variable error but got %q", test.tmpl, output) |
︙ | |||
463 464 465 466 467 468 469 | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | - - - | t.Errorf("expected %d tags, got 0", len(expected[i].Tags)) return } case template.Section, template.InvertedSection: compareTags(t, tag.Tags(), expected[i].Tags) case template.Partial: compareTags(t, tag.Tags(), expected[i].Tags) |
︙ |
Changes to template/spec_test.go.
1 | 1 2 3 4 5 6 7 8 9 | - + | //----------------------------------------------------------------------------- |
︙ | |||
28 29 30 31 32 33 34 | 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - + - + - + | "sort" "testing" "zettelstore.de/z/template" ) var enabledTests = map[string]map[string]bool{ |
︙ | |||
89 90 91 92 93 94 95 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + | "Interpolation - Standalone": true, "Triple Mustache - Standalone": true, "Ampersand - Standalone": true, "Interpolation With Padding": true, "Triple Mustache With Padding": true, "Ampersand With Padding": true, }, |
︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | - + - + | "Padding": true, "Dotted Names - Broken Chains": true, "Surrounding Whitespace": true, "Standalone Line Endings": true, "Standalone Without Previous Line": true, "Standalone Without Newline": true, }, |
︙ |
Changes to testdata/content/link/20200215204700.zettel.
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 | + + + | title: Simple Test [[Home|https://zettelstore.de/z]] [[https://zettelstore.de]] [[Config|00000000000100]] [[00000000000100]] [[Frag|#frag]] [[#frag]] [[H|/hosted]] [[B|//based]] [[R|../rel]] |
Changes to tests/markdown_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 | - + + | //----------------------------------------------------------------------------- |
︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 127 128 129 130 131 132 133 134 135 136 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 172 173 | + + + + + + + + + + + + + + - - - - - - - - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - + + + + - - - - - - + + + + + - - - - - + + + + + | "<http://foo.bar.`baz>`\n", // 346 "[foo<http://example.com/?search=](uri)>\n", // 522 "[foo<http://example.com/?search=][ref]>\n\n[ref]: /uri\n", // 534 "<http://foo.bar.baz/test?q=hello&id=22&boolean>\n", // 591 } var reHeadingID = regexp.MustCompile(` id="[^"]*"`) func TestEncoderAvailability(t *testing.T) { encoderMissing := false for _, format := range formats { enc := encoder.Create(format) if enc == nil { t.Errorf("No encoder for %q found", format) encoderMissing = true } } if encoderMissing { panic("At least one encoder is missing. See test log") } } func TestMarkdownSpec(t *testing.T) { content, err := ioutil.ReadFile("../testdata/markdown/spec.json") if err != nil { panic(err) } var testcases []markdownTestCase if err = json.Unmarshal(content, &testcases); err != nil { panic(err) } |
Changes to tests/regression_test.go.
︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + | } defer f.Close() src, err := ioutil.ReadAll(f) return string(src), err } func checkFileContent(t *testing.T, filename string, gotContent string) { t.Helper() wantContent, err := resultFile(filename) if err != nil { t.Error(err) return } gotContent = trimLastEOL(gotContent) wantContent = trimLastEOL(wantContent) |
︙ | |||
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 124 125 126 127 128 129 130 131 132 133 134 135 136 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 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + - - - + + - - - - - | gotSecond := sb.String() sb.Reset() if gotFirst != gotSecond { t.Errorf("\n1st: %q\n2nd: %q", gotFirst, gotSecond) } } func getPlaceName(p place.Place, root string) string { return p.Location()[len("dir://")+len(root):] } func checkContentPlace(t *testing.T, p place.Place, wd, placeName string) { ss := p.(place.StartStopper) if err := ss.Start(context.Background()); err != nil { panic(err) } metaList, err := p.SelectMeta(context.Background(), nil, nil) if err != nil { panic(err) } for _, meta := range metaList { zettel, err := p.GetZettel(context.Background(), meta.Zid) if err != nil { panic(err) } z := parser.ParseZettel(zettel, "") for _, format := range formats { t.Run(fmt.Sprintf("%s::%d(%s)", p.Location(), meta.Zid, format), func(st *testing.T) { resultName := filepath.Join(wd, "result", "content", placeName, z.Zid.String()+"."+format) checkBlocksFile(st, resultName, z, format) }) } t.Run(fmt.Sprintf("%s::%d", p.Location(), meta.Zid), func(st *testing.T) { checkZmkEncoder(st, z) }) } if err := ss.Stop(context.Background()); err != nil { panic(err) } } func TestContentRegression(t *testing.T) { wd, err := os.Getwd() if err != nil { panic(err) } root, places := getFilePlaces(wd, "content") for _, p := range places { |
Changes to tests/result/content/link/20200215204700.djson.
| 1 | - + |
|
Changes to tests/result/content/link/20200215204700.html.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 | - + + + + | <p><a href="https://zettelstore.de/z" class="zs-external">Home</a> <a href="https://zettelstore.de" class="zs-external">https://zettelstore.de</a> <a href="00000000000100">Config</a> <a href="00000000000100">00000000000100</a> <a href="#frag">Frag</a> |
Changes to tests/result/content/link/20200215204700.native.
| 1 | - + |
|
Changes to tests/result/content/link/20200215204700.text.
| 1 | - + |
|
Added tools/build.go.