Module:T-Campaign: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Line 330: Line 330:
     end
     end
      
      
     -- FRAGILE: Mode determination logic - affects instruction display and field rendering
     -- Determine template mode based on parameter completeness
     local isPureDocumentation = not hasCustomParameters
     local templateMode
     local isPartialMode = hasCustomParameters and not hasAllParameters
    if not hasCustomParameters then
     local isCompleteMode = hasCustomParameters and hasAllParameters
        templateMode = "documentation"
     local showInstructions = isPureDocumentation or isPartialMode
     elseif hasAllParameters then
        templateMode = "complete"
     else
        templateMode = "partial"
     end
      
      
     -- Store mode flags for use in rendering
     -- Store mode state for rendering
     args._documentation_mode = isPureDocumentation
     args._template_mode = templateMode
     args._partial_mode = isPartialMode
     args._show_instructions = (templateMode ~= "complete")
    args._complete_mode = isCompleteMode
     args._campaign_data = campaignData
    args._show_instructions = showInstructions
     args._campaign_data = campaignData -- Store for usage instruction generation
      
      
     -- Defaults are only used for parameter documentation, not content rendering
     -- Defaults are only used for parameter documentation, not content rendering
Line 358: Line 360:
      
      
     -- Add usage instructions in documentation and partial modes
     -- Add usage instructions in documentation and partial modes
     if isPureDocumentation or isPartialMode then
     if templateMode ~= "complete" then
         table.insert(fields, {
         table.insert(fields, {
             key = "usageInstructions",
             key = "usageInstructions",
Line 364: Line 366:
             type = "text"
             type = "text"
         })
         })
        -- Set a dummy value so the field gets processed
         args.usageInstructions = "documentation"
         args.usageInstructions = "documentation"
     end
     end