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:
@@ -130,6 +130,13 @@ pub struct HtmlConfig {
|
||||
/// renderer falls back to `class="color-<name>"` when a name
|
||||
/// isn't in the dict.
|
||||
pub color_dic: std::collections::HashMap<String, String>,
|
||||
/// External wiki→HTML converter (vimwiki's `custom_wiki2html`). When
|
||||
/// non-empty, export shells out to it instead of the built-in renderer.
|
||||
pub custom_wiki2html: String,
|
||||
/// Extra args appended to the `custom_wiki2html` invocation.
|
||||
pub custom_wiki2html_args: String,
|
||||
/// URL prefix prepended to RSS feed / diary item links (`base_url`).
|
||||
pub base_url: String,
|
||||
}
|
||||
|
||||
impl Default for HtmlConfig {
|
||||
@@ -145,6 +152,9 @@ impl Default for HtmlConfig {
|
||||
html_filename_parameterization: false,
|
||||
exclude_files: Vec::new(),
|
||||
color_dic: std::collections::HashMap::new(),
|
||||
custom_wiki2html: String::new(),
|
||||
custom_wiki2html_args: String::new(),
|
||||
base_url: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -634,6 +644,12 @@ struct RawWiki {
|
||||
exclude_files: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
color_dic: Option<std::collections::HashMap<String, String>>,
|
||||
#[serde(default)]
|
||||
custom_wiki2html: Option<String>,
|
||||
#[serde(default)]
|
||||
custom_wiki2html_args: Option<String>,
|
||||
#[serde(default)]
|
||||
base_url: Option<String>,
|
||||
// per-wiki keys mirroring vimwiki globals. All optional so
|
||||
// existing single-wiki configs migrate without touching anything.
|
||||
#[serde(default)]
|
||||
@@ -720,6 +736,15 @@ impl From<RawWiki> for WikiConfig {
|
||||
if let Some(v) = r.color_dic {
|
||||
html.color_dic = v;
|
||||
}
|
||||
if let Some(s) = r.custom_wiki2html {
|
||||
html.custom_wiki2html = s;
|
||||
}
|
||||
if let Some(s) = r.custom_wiki2html_args {
|
||||
html.custom_wiki2html_args = s;
|
||||
}
|
||||
if let Some(s) = r.base_url {
|
||||
html.base_url = s;
|
||||
}
|
||||
let d = wiki_defaults();
|
||||
WikiConfig {
|
||||
name: r.name.unwrap_or(derived_name),
|
||||
|
||||
Reference in New Issue
Block a user