Moved all extension methods into extension blocks (#1155)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-04 10:46:18 +01:00
1 parent acc7d09fa2
commit c0a75f39ac
138 files changed
+5884 -4954

No files matched your search

@@ -16,66 +16,63 @@ internal static partial class LayoutPurposeExtensions
/// </summary>
public static string NoPreference => TB("No preference (the LLM decides)");
/// <summary>
/// The area the forms list a kind of slide in.
/// </summary>
/// <param name="purpose">The kind of slide.</param>
public static LayoutPurposeArea Area(this LayoutPurpose purpose) => Describe(purpose).Area;
/// <summary>
/// The short name of the choice, e.g., "Layout for chapters".
/// </summary>
/// <param name="purpose">The kind of slide.</param>
public static string Label(this LayoutPurpose purpose) => Describe(purpose).Label;
/// <summary>
/// The question the choice answers, which says which slides it applies to.
/// </summary>
/// <param name="purpose">The kind of slide.</param>
public static string Question(this LayoutPurpose purpose) => Describe(purpose).Question;
/// <summary>
/// Describes the slides of this kind for the model, so that it knows which of its slides a choice applies to.
/// </summary>
/// <param name="purpose">The kind of slide.</param>
/// <returns>The description, e.g., "timelines, e.g., the course of a project".</returns>
public static string PromptDescription(this LayoutPurpose purpose) => Describe(purpose).PromptDescription;
/// <summary>
/// Whether choosing a layout for this kind of slide also puts such a slide into the presentation.
/// </summary>
/// <remarks>
/// For most kinds, a choice says only which layout such a slide uses, and whether the
/// presentation has one follows from its content. The slides which frame a presentation are
/// different: whoever chooses a layout for the table of contents or the imprint expects them.
/// </remarks>
/// <param name="purpose">The kind of slide.</param>
public static bool ChoiceAddsSlide(this LayoutPurpose purpose) => purpose.PromptPlacement() is not null;
/// <summary>
/// Where a slide goes which a choice puts into the presentation, and what it holds, for the model.
/// </summary>
/// <param name="purpose">The kind of slide.</param>
/// <returns>The rule, or null when a choice adds no slide of this kind.</returns>
public static string? PromptPlacement(this LayoutPurpose purpose) => purpose switch
extension(LayoutPurpose purpose)
{
LayoutPurpose.TABLE_OF_CONTENTS => "right after the title slide",
LayoutPurpose.Q_AND_A => "near the end, before the closing slide; where the occasion suits it, e.g., in a lecture or a workshop, also at the end of chapters, then naming the topic of the chapter",
LayoutPurpose.ACKNOWLEDGEMENTS => "near the end; where thanks concern a single chapter, also at the end of that chapter",
LayoutPurpose.REFERENCES => "near the end; it lists only the sources the content names, or else the attached documents, and never a source of your own",
LayoutPurpose.CLOSING => "at the end, before an appendix and the imprint",
LayoutPurpose.IMPRINT => "as the very last slide; it holds only what the request, the content, or the profile state, e.g., the title, the authors, the organization, and today's date, and it leaves a slot empty rather than inventing anything",
/// <summary>
/// The area the forms list a kind of slide in.
/// </summary>
public LayoutPurposeArea Area() => Describe(purpose).Area;
_ => null,
};
/// <summary>
/// The short name of the choice, e.g., "Layout for chapters".
/// </summary>
public string Label() => Describe(purpose).Label;
/// <summary>
/// The help below the choice: its question, and whether a choice adds such a slide.
/// </summary>
/// <param name="purpose">The kind of slide.</param>
public static string Help(this LayoutPurpose purpose) => purpose.ChoiceAddsSlide()
? $"{purpose.Question()} {TB("Choosing a layout also adds such a slide to the presentation.")}"
: purpose.Question();
/// <summary>
/// The question the choice answers, which says which slides it applies to.
/// </summary>
public string Question() => Describe(purpose).Question;
/// <summary>
/// Describes the slides of this kind for the model, so that it knows which of its slides a choice applies to.
/// </summary>
/// <returns>The description, e.g., "timelines, e.g., the course of a project".</returns>
public string PromptDescription() => Describe(purpose).PromptDescription;
/// <summary>
/// Whether choosing a layout for this kind of slide also puts such a slide into the presentation.
/// </summary>
/// <remarks>
/// For most kinds, a choice says only which layout such a slide uses, and whether the
/// presentation has one follows from its content. The slides which frame a presentation are
/// different: whoever chooses a layout for the table of contents or the imprint expects them.
/// </remarks>
public bool ChoiceAddsSlide() => purpose.PromptPlacement() is not null;
/// <summary>
/// Where a slide goes which a choice puts into the presentation, and what it holds, for the model.
/// </summary>
/// <returns>The rule, or null when a choice adds no slide of this kind.</returns>
public string? PromptPlacement() => purpose switch
{
LayoutPurpose.TABLE_OF_CONTENTS => "right after the title slide",
LayoutPurpose.Q_AND_A => "near the end, before the closing slide; where the occasion suits it, e.g., in a lecture or a workshop, also at the end of chapters, then naming the topic of the chapter",
LayoutPurpose.ACKNOWLEDGEMENTS => "near the end; where thanks concern a single chapter, also at the end of that chapter",
LayoutPurpose.REFERENCES => "near the end; it lists only the sources the content names, or else the attached documents, and never a source of your own",
LayoutPurpose.CLOSING => "at the end, before an appendix and the imprint",
LayoutPurpose.IMPRINT => "as the very last slide; it holds only what the request, the content, or the profile state, e.g., the title, the authors, the organization, and today's date, and it leaves a slot empty rather than inventing anything",
_ => null,
};
/// <summary>
/// The help below the choice: its question, and whether a choice adds such a slide.
/// </summary>
public string Help() => purpose.ChoiceAddsSlide()
? $"{purpose.Question()} {TB("Choosing a layout also adds such a slide to the presentation.")}"
: purpose.Question();
}
private static LayoutPurposeInfo Describe(LayoutPurpose purpose) =>
DescribeFraming(purpose)