feat(config): custom_wiki2html external converter + base_url for RSS (P2)
Add three per-wiki HtmlConfig keys mirroring vimwiki globals: - custom_wiki2html / custom_wiki2html_args: when set, export shells out to the external converter via `sh -c` with vimwiki's exact arg order (<cmd> <force> <syntax> <ext> <out_dir> <in_file> <css> <tpl_path> <tpl_default> <tpl_ext> <root_path> <args>, `-` for empty optionals) instead of the built-in renderer. - base_url: when set, diary RSS item + channel links become <base_url><diary_rel_path>/<date>.html instead of file:// URIs. write_page() gains a `force` flag threaded through export_current (false), export_all (its own flag) and the did_save auto-export path (false). Tests: write_page_invokes_custom_wiki2html_converter, write_rss_uses_base_url_for_public_links (html_export.rs), config round-trip + defaults (index_and_config.rs). Docs: README, doc/nuwiki.txt, lua config comment, vimwiki-gap.md item ticked. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -284,6 +284,10 @@ fn defaults_carry_vimwiki_per_wiki_keys() {
|
||||
assert_eq!(cfg.links_header, "Generated Links");
|
||||
assert_eq!(cfg.tags_header, "Generated Tags");
|
||||
assert_eq!(cfg.listsym_rejected, "-");
|
||||
// No external converter / public base URL by default.
|
||||
assert_eq!(cfg.html.custom_wiki2html, "");
|
||||
assert_eq!(cfg.html.custom_wiki2html_args, "");
|
||||
assert_eq!(cfg.html.base_url, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -312,6 +316,9 @@ fn raw_wiki_parses_every_new_key() {
|
||||
"links_header": "All Pages",
|
||||
"tags_header": "Tag Index",
|
||||
"tags_header_level": 3,
|
||||
"custom_wiki2html": "~/bin/my_wiki2html.sh",
|
||||
"custom_wiki2html_args": "--flag",
|
||||
"base_url": "https://example.com/wiki/",
|
||||
}],
|
||||
}));
|
||||
let w = &cfg.wikis[0];
|
||||
@@ -338,6 +345,11 @@ fn raw_wiki_parses_every_new_key() {
|
||||
assert_eq!(w.links_header_level, 1); // unspecified → default
|
||||
assert_eq!(w.tags_header, "Tag Index");
|
||||
assert_eq!(w.tags_header_level, 3);
|
||||
// custom_wiki2html keeps the literal command string (tilde-expansion is
|
||||
// the converter's job, not ours); args + base_url round-trip verbatim.
|
||||
assert_eq!(w.html.custom_wiki2html, "~/bin/my_wiki2html.sh");
|
||||
assert_eq!(w.html.custom_wiki2html_args, "--flag");
|
||||
assert_eq!(w.html.base_url, "https://example.com/wiki/");
|
||||
|
||||
// The parsed keys drive a date-mode, Sunday-start diary calendar:
|
||||
// a weekly note is the week-start date (YYYY-MM-DD), stepping ±7 days.
|
||||
|
||||
Reference in New Issue
Block a user