Sha256: 74be37e8edfb115ccf658290dce7a74ce934a2025b91f03f9ab0cab047f4ede3
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true module Kitchen module Directions # Bake directions for eoc summary # module BakeChapterSummary def self.v1(chapter:, metadata_source:, klass: 'summary', uuid_prefix: '.') V1.new.bake( chapter: chapter, metadata_source: metadata_source, uuid_prefix: uuid_prefix, klass: klass ) end class V1 def bake(chapter:, metadata_source:, uuid_prefix: '.', klass: 'summary') summaries = Clipboard.new chapter.non_introduction_pages.each do |page| summary = page.summary next if summary.nil? summary.first("[data-type='title']")&.trash # get rid of old title if exists title = EocSectionTitleLinkSnippet.v1(page: page) summary.prepend(child: title) summary.first('h3')[:itemprop] = 'name' summary.cut(to: summaries) end return if summaries.none? EocCompositePageContainer.v1( container_key: klass, uuid_key: "#{uuid_prefix}#{klass}", metadata_source: metadata_source, content: summaries.paste, append_to: chapter ) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems