Module:ElementNavigation: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
--[[ | --[[ | ||
* Name: ElementNavigation | |||
* Author: Mark W. Datysgeld | |||
* Description: Element module that provides navigation detection and rendering for sequential content in Blueprint templates | |||
* Notes: Automatic detection of previous/next pages based on naming patterns; supports series+number and series+year patterns; configurable field names and styling; designed as Blueprint template system block | |||
]] | ]] | ||
| Line 75: | Line 66: | ||
-- ========== Blueprint Integration ========== | -- ========== Blueprint Integration ========== | ||
-- Helper function to merge two tables. The custom table's values override the base table's. | |||
local function mergeConfigs(base, custom) | |||
local merged = {} | |||
for k, v in pairs(base) do | |||
merged[k] = v | |||
end | |||
for k, v in pairs(custom) do | |||
merged[k] = v | |||
end | |||
return merged | |||
end | |||
-- Create a navigation block for Blueprint | -- Create a navigation block for Blueprint | ||
| Line 100: | Line 103: | ||
return execute(function() | return execute(function() | ||
-- Merge default and template-specific configurations | -- Merge default and template-specific configurations | ||
local config = | local config = mergeConfigs(p.defaultConfig, template.config.navigation or {}) | ||
-- Automatic navigation detection | -- Automatic navigation detection | ||