// Hook: AfterPowerPoint // Remove draft slides and any slide marked Hidden in the source deck. // // A draft slide is identified by its first shape having a name that starts // with "_DRAFT" - a convention authors use to leave reviewer notes or // internal-only content in the source. Hidden slides are also removed. If // removing them would leave an empty deck, the job halts with an error. if (Presentation == null) { AddError($"No presentation available for '{OutputName}'."); return; } var removed = new List(); for (int i = Presentation.Slides.Count - 1; i >= 0; i--) { var slide = Presentation.Slides[i]; bool isDraft = slide.Shapes.Count > 0 && (slide.Shapes[0].Name?.StartsWith("_DRAFT", StringComparison.OrdinalIgnoreCase) ?? false); bool isHidden = slide.Hidden; if (isDraft || isHidden) { Presentation.Slides.RemoveAt(i); removed.Add(i + 1); } } if (Presentation.Slides.Count == 0) { AddError($"All slides in '{OutputName}' were removed as drafts/hidden; refusing to ship an empty deck."); } if (removed.Count > 0) { AddWarning($"Removed {removed.Count} draft/hidden slide(s) from '{OutputName}' (positions: {string.Join(", ", removed)})."); } else { Logger.LogInformation($"No draft or hidden slides found in '{OutputName}'."); }