<commit_before>@import "./utils";

/// Creates a title for a set of composite pages at the end of a chapter
/// @arg {Map} $compositePages - each element in this must contain a `name` and `source`
/// @group compose
@mixin compose_titleEOCComposites($compositePages) {
  @each $page in $compositePages {
    $name: map-get($page, name);
    $className: map-get($page, className);

    // Validate
   // @include validate_type($name, string);
    @include validate_type($className, string);

    [data-type="composite-page"].os-eoc.os-#{$className}-container {
      $titleContent: (
        os-text: $name
        );
      @include utils_title($titleContent, null, h2, "document-title");
    }
  }
}

/// Creates a title for a set of composite pages at the end of the book
/// @arg {list} $compositePages - each element in this must contain a `name` and `source`
/// @group compose
@mixin compose_titleEOBComposites($compositePages) {
  @each $page in $compositePages {
    $name: map-get($page, name);
    $className: map-get($page, className);

    // Validate
   // @include validate_type($name, string);
    @include validate_type($className, string);

    [data-type="composite-page"].os-eob.os-#{$className}-container {
      $titleContent: (
        os-text: $name
        );
      @include utils_title($titleContent, null, h1, "document-title");
    }
  }
}


/// Creates a title for a set of composite pages at the end of the book
/// @arg {list} $compositePages - each element in this must contain a `name` and `source`
/// @arg {string} $sectionHeaderNode - a String whose value is "sectionHeaderNode" (yep, odd). Currently Unused (because of typo)
/// @group compose
@mixin compose_createChapterComposites($compositePages, $sectionHeaderNode) {
  // Validate
  @include validate_type($compositePages, list);

  @each $page in $compositePages {
    @include _createChapterComposite($page, $sectionHeaderNode);
  }
}

/// Collects elements defined by `$page.source` (a selector-ish thing) and
/// collates them at the end of a chapter.
/// @arg {Map} $page - contains `name`, `source`, and optionally `sortBy` and `compoundComposite` and `specialPageType`
/// @arg {string} $sectionHeaderNode - Curently Unused (because of typo)
/// @group compose
@mixin _createChapterComposite($page, $sectionHeaderNode) {
  $name: map-get($page, name);
  $className: map-get($page, className);
  $sortBy: map-get($page, sortBy);
  $compoundComposite: map-get($page, compoundComposite);
  $specialPageType: map-get($page, specialPageType);

  // Validate
  //@include validate_type($name, string);
  @include validate_type($className, string);
  @include validate_typeOptional($sortBy, string);
  @include validate_typeOptional($compoundComposite, bool);
  @include validate_type($sectionHeaderNode, string);
  @include validate_enumOptional($specialPageType, $PAGE__PREFIX__);

  div[data-type="chapter"] {
    @if (not $compoundComposite) {
      $clusterBy: map-get($page, clusterBy);
      @include validate_enum($clusterBy, $CLUSTER__PREFIX__);

      $keyName: if($specialPageType == $PAGE_GLOSSARY, '<glossary>', '.#{$className}');
      $sourceSelector: if($specialPageType == $PAGE_GLOSSARY, 'div[data-type="#{$className}"] dl', 'section.#{$className}');
      @if ($specialPageType == $PAGE_GLOSSARY) {
        div[data-type="#{$className}"] {
          /* Discard this Page-specific glossary because it is collated later and the title is added when this is collated */
          move-to: trash;
        }
      }
      #{$sourceSelector} {
        > [data-type="title"] {
          /* Discard this Page-specific title because a chapter title is added when collated */
          move-to: trash;
        }
        @if ($clusterBy == $CLUSTER_SECTION) {
          /* TODO: Is this used? because it looks like there is a typo here. `sectionHeaderNode` is not defined */
          content: nodes(sectionHeaderNode) content();
        }
        move-to: #{$className}-TOCOMPOSITE;
      }
      &::after {<commit_msg>Add validation changes from review<commit_after>@import "./utils";

/// Creates a title for a set of composite pages at the end of a chapter
/// @arg {Map} $compositePages - each element in this must contain a `name` and `source`
/// @group compose
@mixin compose_titleEOCComposites($compositePages) {
  @each $page in $compositePages {
    $name: map-get($page, name);
    $className: map-get($page, className);

    // Validate
    @include validate_type($name, string);
    @include validate_type($className, string);

    [data-type="composite-page"].os-eoc.os-#{$className}-container {
      $titleContent: (
        os-text: $name
        );
      @include utils_title($titleContent, null, h2, "document-title");
    }
  }
}

/// Creates a title for a set of composite pages at the end of the book
/// @arg {list} $compositePages - each element in this must contain a `name` and `source`
/// @group compose
@mixin compose_titleEOBComposites($compositePages) {
  @each $page in $compositePages {
    $name: map-get($page, name);
    $className: map-get($page, className);

    // Validate
   // @include validate_type($name, string);
    @include validate_type($className, string);

    [data-type="composite-page"].os-eob.os-#{$className}-container {
      $titleContent: (
        os-text: $name
        );
      @include utils_title($titleContent, null, h1, "document-title");
    }
  }
}


/// Creates a title for a set of composite pages at the end of the book
/// @arg {list} $compositePages - each element in this must contain a `name` and `source`
/// @arg {string} $sectionHeaderNode - a String whose value is "sectionHeaderNode" (yep, odd). Currently Unused (because of typo)
/// @group compose
@mixin compose_createChapterComposites($compositePages, $sectionHeaderNode) {
  // Validate
  @include validate_type($compositePages, list);

  @each $page in $compositePages {
    @include _createChapterComposite($page, $sectionHeaderNode);
  }
}

/// Collects elements defined by `$page.source` (a selector-ish thing) and
/// collates them at the end of a chapter.
/// @arg {Map} $page - contains `name`, `source`, and optionally `sortBy` and `compoundComposite` and `specialPageType`
/// @arg {string} $sectionHeaderNode - Curently Unused (because of typo)
/// @group compose
@mixin _createChapterComposite($page, $sectionHeaderNode) {
  $className: map-get($page, className);
  $sortBy: map-get($page, sortBy);
  $compoundComposite: map-get($page, compoundComposite);
  $specialPageType: map-get($page, specialPageType);

  // Validate
  @include validate_type($className, string);
  @include validate_typeOptional($sortBy, string);
  @include validate_typeOptional($compoundComposite, bool);
  @include validate_type($sectionHeaderNode, string);
  @include validate_enumOptional($specialPageType, $PAGE__PREFIX__);

  div[data-type="chapter"] {
    @if (not $compoundComposite) {
      $clusterBy: map-get($page, clusterBy);
      @include validate_enum($clusterBy, $CLUSTER__PREFIX__);

      $keyName: if($specialPageType == $PAGE_GLOSSARY, '<glossary>', '.#{$className}');
      $sourceSelector: if($specialPageType == $PAGE_GLOSSARY, 'div[data-type="#{$className}"] dl', 'section.#{$className}');
      @if ($specialPageType == $PAGE_GLOSSARY) {
        div[data-type="#{$className}"] {
          /* Discard this Page-specific glossary because it is collated later and the title is added when this is collated */
          move-to: trash;
        }
      }
      #{$sourceSelector} {
        > [data-type="title"] {
          /* Discard this Page-specific title because a chapter title is added when collated */
          move-to: trash;
        }
        @if ($clusterBy == $CLUSTER_SECTION) {
          /* TODO: Is this used? because it looks like there is a typo here. `sectionHeaderNode` is not defined */
          content: nodes(sectionHeaderNode) content();
        }
        move-to: #{$className}-TOCOMPOSITE;
      }
      &::after {
{'fraction_non_alphanumeric': 0.14137109913522997, 'fraction_numerical': 0.0005013159543802481, 'mean_word_length': 3.5914844649021864, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3601843', 'n_tokens_mistral': 2430, 'n_tokens_neox': 2391, 'n_words': 682}