diff --git a/src/render/html/context.rs b/src/render/html/context.rs index a4642769..4e05e76a 100644 --- a/src/render/html/context.rs +++ b/src/render/html/context.rs @@ -26,6 +26,7 @@ use super::random::Random; use crate::data::PageRef; use crate::data::{Backlinks, PageInfo}; use crate::info; +use crate::layout::Layout; use crate::next_index::{NextIndex, TableOfContentsIndex}; use crate::render::Handle; use crate::settings::WikitextSettings; @@ -109,7 +110,7 @@ impl<'i, 'h, 'e, 't> HtmlContext<'i, 'h, 'e, 't> { // Build and return HtmlContext { body: String::with_capacity(capacity), - meta: Self::initial_metadata(info), + meta: Self::initial_metadata(info, settings.layout), backlinks: Backlinks::new(), info, handle, @@ -127,7 +128,7 @@ impl<'i, 'h, 'e, 't> HtmlContext<'i, 'h, 'e, 't> { } } - fn initial_metadata(info: &PageInfo<'i>) -> Vec { + fn initial_metadata(info: &PageInfo<'i>, layout: Layout) -> Vec { // Initial version, we can tune how the metadata is generated later. vec![ @@ -139,7 +140,7 @@ impl<'i, 'h, 'e, 't> HtmlContext<'i, 'h, 'e, 't> { HtmlMeta { tag_type: HtmlMetaType::Name, name: str!("generator"), - value: info::VERSION.clone(), + value: format!("{} {}", *info::VERSION, layout.description()), }, HtmlMeta { tag_type: HtmlMetaType::Name, diff --git a/src/settings/mod.rs b/src/settings/mod.rs index a03fa088..bd29dfc3 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -20,6 +20,8 @@ mod interwiki; +use crate::layout::Layout; + pub use self::interwiki::{InterwikiSettings, DEFAULT_INTERWIKI, EMPTY_INTERWIKI}; const DEFAULT_MINIFY_CSS: bool = true; @@ -31,6 +33,11 @@ pub struct WikitextSettings { /// What mode we're running in. pub mode: WikitextMode, + /// What layout we're targeting. + /// + /// For instance, generating Wikidot's legacy HTML structure. + pub layout: Layout, + /// Whether page-contextual syntax is permitted. /// /// This currently refers to: @@ -94,12 +101,13 @@ pub struct WikitextSettings { impl WikitextSettings { /// Returns the default settings for the given [`WikitextMode`]. - pub fn from_mode(mode: WikitextMode) -> Self { + pub fn from_mode(mode: WikitextMode, layout: Layout,) -> Self { let interwiki = DEFAULT_INTERWIKI.clone(); match mode { WikitextMode::Page => WikitextSettings { mode, + layout, enable_page_syntax: true, use_include_compatibility: false, use_true_ids: true, @@ -110,6 +118,7 @@ impl WikitextSettings { }, WikitextMode::Draft => WikitextSettings { mode, + layout, enable_page_syntax: true, use_include_compatibility: false, use_true_ids: false, @@ -120,6 +129,7 @@ impl WikitextSettings { }, WikitextMode::ForumPost | WikitextMode::DirectMessage => WikitextSettings { mode, + layout, enable_page_syntax: false, use_include_compatibility: false, use_true_ids: false, @@ -130,6 +140,7 @@ impl WikitextSettings { }, WikitextMode::List => WikitextSettings { mode, + layout, enable_page_syntax: true, use_include_compatibility: false, use_true_ids: false,