Sha256: 3d7c75d0c55ef3b9ebc0031331687eeac1645f2c096ab2e2dc83fc1e441989ad
Contents?: true
Size: 984 Bytes
Versions: 16
Compression:
Stored size: 984 Bytes
Contents
# frozen_string_literal: true module Kitchen module Directions # Adds learning objectives header to abstracts module BakePageAbstracts def self.v1(chapter:) chapter.abstracts.each do |abstract| abstract.prepend(child: "<h3 data-type='title'>#{I18n.t(:learning_objectives)}</h3>") end end def self.v2(chapter:) chapter.abstracts.each do |abstract| abstract.prepend(child: "<h3 data-type='title'>#{I18n.t(:learning_objectives)}</h3>") ul = abstract.first!('ul') ul.add_class('os-abstract') ul.search('li').each_with_index do |li, index| li.replace_children(with: <<~HTML <span class="os-abstract-token">#{chapter.count_in(:book)}.#{abstract.count_in(:chapter)}.#{index + 1}</span> <span class="os-abstract-content">#{li.children}</span> HTML ) end end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems