feat(config): on-save autoregen family — links/tags/diary-index (P2)
Added per-wiki auto_generate_links, auto_generate_tags, auto_diary_index (default false, like upstream), wired into the did_save hook mirroring auto_toc: - auto_generate_links / auto_generate_tags rebuild the Generated Links / Generated Tags section ONLY when it already exists (new links_rebuild_edit / tag_links_rebuild_edit, like toc_rebuild_edit) — never inserts one into a page that lacks it. - auto_diary_index regenerates the diary index page when a dated diary entry (not the index itself) is saved, via diary_generate_index_edit (handles the index file open / on-disk / absent). auto_tags is recorded as an intentional divergence: nuwiki re-indexes tags on every change, so the tag metadata is always fresh (no on-disk file to update). Tests: links_rebuild_edit_only_acts_when_section_present, tag_links_rebuild_edit_only_acts_when_index_present, config round-trip + defaults. README/doc/lua comment updated. fmt/clippy clean; 0 Rust failures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -98,9 +98,18 @@ fix site.
|
||||
auto_toc save hook) and `find_section_range` matches the configured text so
|
||||
regen stays idempotent. Tests: `captions_honour_custom_header_and_level`
|
||||
(`link_health.rs`) + config round-trip in `index_and_config.rs`.
|
||||
- [ ] **On-save autoregen family** — `auto_diary_index`, `auto_generate_links`,
|
||||
`auto_generate_tags`, `auto_tags` (only `auto_toc` / `auto_export` exist).
|
||||
_Fix:_ `config.rs` `RawWiki`/`WikiConfig` + the `didSave` path.
|
||||
- [x] **On-save autoregen family** — added per-wiki `auto_generate_links`,
|
||||
`auto_generate_tags`, `auto_diary_index` (all default `false`, like upstream),
|
||||
wired into the `did_save` hook (`crates/nuwiki-lsp/src/lib.rs`) mirroring
|
||||
`auto_toc`: regen runs only when the section already exists
|
||||
(`links_rebuild_edit` / `tag_links_rebuild_edit`), and `auto_diary_index`
|
||||
regenerates the diary index when a dated diary *entry* is saved
|
||||
(`diary_generate_index_edit`, which handles an open/closed/absent index file).
|
||||
`auto_tags` is an **intentional divergence** (see below): nuwiki re-indexes on
|
||||
every change, so tag metadata is always fresh — there's no on-disk metadata
|
||||
file to update on save. Tests: `links_rebuild_edit_only_acts_when_section_present`
|
||||
(`link_health.rs`), `tag_links_rebuild_edit_only_acts_when_index_present`
|
||||
(`commands_tags.rs`), config round-trip + defaults (`index_and_config.rs`).
|
||||
- [x] **`listsym_rejected`** — the rejected glyph was a hardcoded `const '-'`.
|
||||
_Fix:_ `ListSyms` gained a `rejected` field + `new_with_rejected()`
|
||||
(`crates/nuwiki-core/src/listsyms.rs`); per-wiki `listsym_rejected` key (default
|
||||
@@ -276,6 +285,11 @@ audits don't re-flag them.
|
||||
- `key_mappings` (dict) — replaced by Lua `mappings.<group>` + the
|
||||
`g:nuwiki_no_<group>_mappings` globals.
|
||||
- `use_calendar` — no calendar.vim integration.
|
||||
- `auto_tags` (upstream `0`) — upstream auto-updates an on-disk tag *metadata*
|
||||
file on save. nuwiki has no such file: the LSP re-indexes tags on every
|
||||
`didChange`, so tag search/jump/completion are always fresh. The setting's
|
||||
intent is therefore always satisfied (the `auto_generate_tags` regen of the
|
||||
in-buffer links section is the configurable on-save piece).
|
||||
- Mouse maps (`<2-LeftMouse>`, `<MiddleMouse>`, …) — upstream binds them
|
||||
unconditionally; nuwiki ships them **opt-in** (`mappings.mouse` /
|
||||
`g:nuwiki_mouse_mappings`). Deliberate, so they're not always-on.
|
||||
|
||||
Reference in New Issue
Block a user