diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3afde0a54..9116bfc0d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [v2.26.1] - 2025-05-22
+
+* Revert changes to `BakeIframes`
+
## [v2.26.0] - 2025-05-20
* Add `suppress_solution_title` to `bake_numbered_exercise`
diff --git a/lib/kitchen/directions/bake_iframes/v1.rb b/lib/kitchen/directions/bake_iframes/v1.rb
index 26916165c..d24b92b08 100644
--- a/lib/kitchen/directions/bake_iframes/v1.rb
+++ b/lib/kitchen/directions/bake_iframes/v1.rb
@@ -10,8 +10,13 @@ def bake(book:)
iframes.each do |iframe|
next if iframe.has_class?('os-is-iframe') # don't double-bake
- iframe_link = '/404-this-link-should-be-replaced'
-
+ iframe_link = \
+ begin
+ iframe.rex_link
+ rescue StandardError
+ warn "Unable to find rex link for iframe #{iframe}"
+ iframe[:src]
+ end
iframe.wrap('
')
iframe.add_class('os-is-iframe')
@@ -20,7 +25,7 @@ def bake(book:)
iframe.prepend(child:
<<~HTML
- #{I18n.t(:iframe_link_text)}
+ #{I18n.t(:iframe_link_text)}
HTML
)
diff --git a/lib/kitchen/element_base.rb b/lib/kitchen/element_base.rb
index d114ba4fd..b3e7e4d0d 100644
--- a/lib/kitchen/element_base.rb
+++ b/lib/kitchen/element_base.rb
@@ -967,6 +967,39 @@ def as_enumerator
enumerator_class.new(search_query: search_query_that_found_me) { |block| block.yield(self) }
end
+ def rex_link
+ self[:'data-is-for-rex-linking'] = 'true'
+
+ element_with_ancestors = document.book.chapters.search_with(
+ Kitchen::PageElementEnumerator, Kitchen::CompositePageElementEnumerator
+ ).search('[data-is-for-rex-linking="true"]').first
+
+ remove_attribute('data-is-for-rex-linking')
+
+ unless element_with_ancestors
+ raise("Cannot create rex link to element #{self} - needs ancestors of both types chapter & page/composite_page" \
+ "#{say_source_or_nil}"
+ )
+ end
+
+ book_slug = document.slug
+ chapter_count = element_with_ancestors.ancestor(:chapter).count_in(:book)
+ page_string = ''
+ page_title = ''
+ page = element_with_ancestors.ancestor(:page) if element_with_ancestors.has_ancestor?(:page)
+ if page&.is_introduction?
+ page_title = page.first('[data-type="document-title"]').text.slugify
+ elsif page
+ page_string = "#{page.count_in(:chapter) - 1}-"
+ page_title = page.title_text.slugify
+ else
+ page = element_with_ancestors.ancestor(:composite_page)
+ page_title = page.title.text.slugify
+ end
+
+ "https://openstax.org/books/#{book_slug}/pages/#{chapter_count}-#{page_string}#{page_title}"
+ end
+
def add_platform_media(format)
valid_formats = %w[screen print screenreader]
raise "Media format invalid; valid formats are #{valid_formats}" unless valid_formats.include?(format)
diff --git a/lib/kitchen/patches/string.rb b/lib/kitchen/patches/string.rb
index b95277228..a08a878e8 100644
--- a/lib/kitchen/patches/string.rb
+++ b/lib/kitchen/patches/string.rb
@@ -10,4 +10,18 @@ class String
def uncapitalize
sub(/^[A-Z]/, &:downcase)
end
+
+ # Transform self to kebab case, returning a new string
+ # Example: "Star Wars: The Empire Strikes Back" -> "star-wars-the-empire-strikes-back"
+ #
+ # @return [String]
+ #
+ def slugify
+ I18n.transliterate(
+ strip.downcase
+ .gsub(/'/, '')
+ .gsub(/®/, ' r')
+ .gsub(/\u2014+/, '-')
+ ).gsub(/[^(\w\s)-]/, '').gsub(/[\s-]+/, '-')
+ end
end
diff --git a/spec/kitchen_spec/directions/bake_iframes/v1_spec.rb b/spec/kitchen_spec/directions/bake_iframes/v1_spec.rb
index 0ff49545c..511a3d36c 100644
--- a/spec/kitchen_spec/directions/bake_iframes/v1_spec.rb
+++ b/spec/kitchen_spec/directions/bake_iframes/v1_spec.rb
@@ -63,4 +63,48 @@
described_class.new.bake(book: book_with_baked_iframes)
expect(book_with_baked_iframes).to match_normalized_html(book_with_baked_iframes_snapshot)
end
+
+ context 'with exceptions' do
+ let(:book_with_iframe_no_slug) do
+ book_containing(html:
+ <<~HTML
+
+
+
+
The Document: Title!
+
+
+
+
+
+ HTML
+ )
+ end
+
+ let(:book_with_iframe_no_id_on_media) do
+ book_containing(html:
+ <<~HTML
+
+
+
+
+
The Document: Title!
+
+
+
+
+
+ HTML
+ )
+ end
+
+ it 'warns when rex link can\'t be made - no slug' do
+ expect(Warning).to receive(:warn).with(
+ /Unable to find rex link for iframe
+
+
+
+
+
Introduction: Fre Sha Vocado
+
+
+
+ Introduction
+
+
+
+
+
+
+
Test Page: It's, An, Avocado
+
+
+ 1.1
+
+ Test Page: It's, An, Avocado
+
+
+
+
+
+
I have hyphen — and latin letter ć
+
+
+ 1.2
+
+ I have hyphen — and latin letter ć
+
+
+
+
+
+
+
+ Summary Or Something
+
+
+
Summary
+
+
+
+
+ HTML
+ )
+ end
+
+ it 'returns rex link for element in section page' do
+ expect(book_rex_linkable.first('div#element2').rex_link).to \
+ eq('https://openstax.org/books/test-book-slug/pages/1-1-test-page-its-an-avocado')
+ end
+
+ it 'returns rex link for element in intro page' do
+ expect(book_rex_linkable.first('div#element1').rex_link).to \
+ eq('https://openstax.org/books/test-book-slug/pages/1-introduction-fre-sha-vocado')
+ end
+
+ it 'returns rex link for element in composite page' do
+ expect(book_rex_linkable.first('div#element3').rex_link).to \
+ eq('https://openstax.org/books/test-book-slug/pages/2-summary-or-something')
+ end
+
+ it 'returns rex link for element with hyphen and latin letter' do
+ expect(book_rex_linkable.first('div#element4').rex_link).to \
+ eq('https://openstax.org/books/test-book-slug/pages/1-2-i-have-hyphen-and-latin-letter-c')
+ end
+
+ it 'raises error when ancestors can\'t be found' do
+ expect { book_rex_linkable.pages('$#not-in-chapter').first.rex_link }.to \
+ raise_error(/Cannot create rex link to element[^>]+id="not-in-chapter"/)
+ end
+ end
+
describe '#add_platform_media' do
let(:no_media) do
book_containing(html:
diff --git a/spec/recipes_spec/books/algebra-1/expected_output.xhtml b/spec/recipes_spec/books/algebra-1/expected_output.xhtml
index 01323833c..46720a402 100644
--- a/spec/recipes_spec/books/algebra-1/expected_output.xhtml
+++ b/spec/recipes_spec/books/algebra-1/expected_output.xhtml
@@ -2190,7 +2190,7 @@
Do you know what a budget is? Have you ever used one? Watch the video to learn a bit about how City Manager Arthur Noriega uses linear equations to manage the budget for the city of Miami.
You will be asked to evaluate the percentage of a number mentally. Sometimes, a visual is helpful to do this. If needed, use the GeoGebra activity to help you determine the requested values. Then, look for a pattern that can be used to describe how to find the percentage of any number.
Watch the following video to learn more about describing relationships using words and equations, specifically looking at the base and height of different rectangles.
Watch the following video to learn more about how to use direct variation to solve an application problem.
- Access multimedia content
+ Access multimedia content
diff --git a/spec/recipes_spec/books/ap-history/expected_output.xhtml b/spec/recipes_spec/books/ap-history/expected_output.xhtml
index a58ec52ca..2c410cbc1 100644
--- a/spec/recipes_spec/books/ap-history/expected_output.xhtml
+++ b/spec/recipes_spec/books/ap-history/expected_output.xhtml
@@ -1206,7 +1206,7 @@ Europeans believed they discovered an entirely new place when they encountered t
Essential Knowledge 3.A.1 An observer in a particular reference frame can describe the motion of an object using such quantities as position, displacement, distance, velocity, speed, and acceleration.
- Access multimedia content
+ Access multimedia content
diff --git a/spec/recipes_spec/books/biology/expected_output.xhtml b/spec/recipes_spec/books/biology/expected_output.xhtml
index 58712660d..d402f8352 100644
--- a/spec/recipes_spec/books/biology/expected_output.xhtml
+++ b/spec/recipes_spec/books/biology/expected_output.xhtml
@@ -2700,7 +2700,7 @@ Carbon is normally present in the atmosphere in the form of gaseous compounds li
- Access multimedia content
+ Access multimedia content
@@ -7180,7 +7180,7 @@ We can conclude that the weight of the apple bag is Our formal study of physics begins with kinematics which is defined as the study of motion without considering its causes. The word “kinematics” comes from a Greek term meaning motion and is related to other English words such as “cinema” (movies) and “kinesiology” (the study of human motion). In one-dimensional kinematics and Two-Dimensional Kinematics we will study only the motion of a football, for example, without worrying about what forces cause or change its motion. Such considerations come in other chapters. In this chapter, we examine the simplest type of motion—namely, motion along a straight line, or one-dimensional motion. In Two-Dimensional Kinematics, we apply concepts developed here to study motion along curved paths (two- and three-dimensional motion); for example, that of a car rounding a curve.
Use this media interactive to practice identifying the different ways in which readers respond to texts. Then, examine the annotated professional critical response model below.
- Access multimedia content
+ Access multimedia content
diff --git a/spec/recipes_spec/books/hs-physics/expected_output.xhtml b/spec/recipes_spec/books/hs-physics/expected_output.xhtml
index 2a0a6b351..f509b6947 100644
--- a/spec/recipes_spec/books/hs-physics/expected_output.xhtml
+++ b/spec/recipes_spec/books/hs-physics/expected_output.xhtml
@@ -4627,7 +4627,7 @@ Knowing the percent uncertainty of a shingle can help a contractor determine the
In this simulation you will examine how changing the slope and y-intercept of an equation changes the appearance of a plotted line. Select slope-intercept form and drag the blue circles along the line to change the line’s characteristics. Then, play the line game and see if you can determine the slope or y-intercept of a given line.
- Access multimedia content
+ Access multimedia content
diff --git a/spec/recipes_spec/books/intellectual-property/expected_output.xhtml b/spec/recipes_spec/books/intellectual-property/expected_output.xhtml
index fded2fedd..278c7de20 100644
--- a/spec/recipes_spec/books/intellectual-property/expected_output.xhtml
+++ b/spec/recipes_spec/books/intellectual-property/expected_output.xhtml
@@ -647,7 +647,7 @@ The first U.S. Patent (credit: US Patent Office via Wikimedia Commons / Public D
Before reading this section, please watch the overview video below covering the usefulness of patents - how ironic that a system for granting exclusive rights to inventors is the greatest vehicle for knowledge-sharing and technology transfer ever devised by human beings.
Before reading this section, please watch the overview video below covering why America developed the world’s first patent system for the common man, and what we got out of it as a result (hint: the strongest economy on the face of the earth).
Before reading this section, please watch the overview video below covering what you can and cannot patent. You can’t patent an idea (like an idea for a better mousetrap), only an application of that idea in a practical invention. Novelty, utility, and non-obviousness—the holy trinity of patents.
Watch this short, humorous 4Ps video as a way to help you remember the concept. This video also includes several examples of target markets and how a marketer might respond.
Consumer behavior is an important marketing topic, and depending on the marketing program at your institution, you may have the opportunity to take a consumer behavior course and learn more about the topics covered above. Studying consumer behavior is important in marketing because it will teach you how to best know your customer, an integral aspect to marketing a product or service. You can also watch this selfLearn-en video to get a stronger grasp of consumer behavior.
Continually trying to understand environmental influences will keep you on the cutting edge and ahead of the competition. It’s a great practice to always be looking for the latest information so that you can shift your strategies as needed. Bain & Company is an example of one company that wanted to understand how the pandemic changed consumer behavior. The company ran a survey in 2021 to better understand the impact of the pandemic, and it found five trends from the data.
Cultural factors play a major role in determining how best to market to consumers. There are numerous examples of company efforts that failed because they did not reflect an understanding of the culture in a particular market. Watch this CNBC video on why Starbucks failed in Australia and read this article about how Coke and Pepsi failed when they first moved into the Chinese market.
You can also watch this Gaby Barrios TED Talk. Barrios is a marketing expert who speaks about how targeting consumers based on gender is bad for business.
This humorous video from The Checkout, a TV show about consumer affairs, discusses gender marketing packaging decisions and their impact on your wallet.
Consider this public service announcement (PSA) from the Ad Council that is dedicated to fostering a more welcoming nation where everyone can belong. How does it appeal to the human need for community and belonging?
Understanding Maslow’s hierarchy of needs will help you be an effective and impressive marketer. You’re going to see this model in many of your business courses, not just marketing, so take the time to learn about it. Check out this brief video that may help you understand how to use Maslow’s hierarchy of needs in marketing. Learn about why Maslow’s hierarchy of needs matters.
How are you going to stand out among other candidates? What can you do with your résumé? According to Jason Shen’s TED Talk, you should highlight your abilities and not your experience. He speaks to potential and how you can make yourself more attractive to potential employers by telling a story in a compelling way.
Watch this video on Abercrombie & Fitch’s brand transformation for further insight on how A&F has positioned its retail brand Hollister as a global iconic teen brand and modernized the A&F brand to focus on young millennial consumers.
Are you new to ethical shopping? Watch this video to learn the basics about shopping ethically. Also check out this article to learn specific reasons for being an ethical consumer.
Tritonia is a species of slimy mollusk that glides along the ocean floor off the west coast of the United States and Canada. The mortal enemy of a Tritonia is the Pacific sea star, a voracious predator that loves to dine on Tritonia. To avoid this fate, a Tritonia “swims” away if it feels the touch of a sea star. Well, actually the Tritonia kind of thrashes about, arching its back, then relaxing, then arching again, in a rhythmic motion that helps it move up into the ocean current. When the Tritonia stops swimming, it sinks back down to the ocean floor, hopefully far away from the hungry sea star. Check out a video of a Tritonia escaping a sea star here:
After several hours recording with the microscope (and several days processing all the data), the researchers assemble a remarkable video. Check it out here:
Film „Moneyball” opowiada o menedżerze drużyny baseballu, który kompletuje jej skład, korzystając z analizy komputerowej szczegółowych statystyk sportowców, zbieranych podczas każdego meczu. To świetny przykład wykorzystania analityki do opracowania strategii. Obejrzyj fragment filmu, w którym możesz zobaczyć zastosowanie takiej analizy.
Dowiedz się o strategii tworzenia rynku zwanej „strategią błękitnego oceanu”: czytając studium przypadku z „Harvard Business Review”, w którym opisano strategię cyrku Cirque du Soleil.
Ważnym aspektem map jest zrozumienie, jak twoje produkty i konkurencja są postrzegane przez klientów, a ten film pokazuje, jak przetwarzać i mapować te informacje.
Aby uzyskać więcej informacji na temat marketingowych wskaźników KPI, obejrzyj ten krótki film od SMA Marketing wyjaśniający, dlaczego marketingowe wskaźniki KPI są niezbędne dla firmy. Oto dodatkowe źródła, które mogą okazać się pomocne w zdobywaniu wiedzy na temat wskaźników KPI:
Obejrzyj krótki, humorystyczny film o 4P, który pomoże ci przypomnieć sobie tę koncepcję. Ten film zawiera również kilka przykładów rynków docelowych i tego, jak marketer może odpowiedzieć na różne potrzeby.
Zachowania konsumenckie to ważny temat w marketingu. Ich studiowanie jest integralnym elementem planowania działań związanych z produktem oraz dostarczaniem go do klienta. Obejrzenie tego filmu pomoże ci lepiej zrozumieć zachowania konsumentów.
Czynnikiem zewnętrznym, który znacząco wpłynął na zachowania klientów, była pandemia COVID-19. Obejrzyj poniższy film i zastanów się, w jaki sposób przedstawiono w nim trendy w zachowaniach nabywców i jaki mógł być ich wpływ na działania marketingowej przedsiębiorstw.
Czynniki kulturowe odgrywają ważną rolę w określaniu najlepszych sposobów wprowadzania produktów na rynek. Istnieje wiele przykładów działań firm, które zakończyły się niepowodzeniem, ponieważ nie uwzględniały kulturowej specyfiki danego rynku. Obejrzyj film CNBC wyjaśniający, dlaczego Starbucks poniósł porażkę w Australii, i przeczytaj artykuł o tym, jak Coca-Cola i PepsiCo doznały niepowodzenia, kiedy po raz pierwszy weszły na rynek chiński. Zobacz także film CNBC pokazujący, dlaczego 7-Eleven nie powiodło się w Indonezji.
Możesz również obejrzeć wykład Gaby Barrios TED Talk. Barrios jest ekspertką z zakresu marketingu, która z kolei mówi o tym, dlaczego targetowanie konsumentów na podstawie płci jest złe dla biznesu.
W humorystycznym filmie z „The Checkout”, programu telewizyjnego poświęconego sprawom konsumenckim, omówiono decyzje dotyczące różnicowania opakowań pod kątem płci i ich wpływu na zachowania zakupowe.
Zobacz jedną z reklam Nike z kampanii „Find Your Greatness” (pol. Odnajdź Swoją Doskonałość). W jaki sposób odwołuje się ona do ludzkiej potrzeby samorealizacji?
Zrozumienie hierarchii potrzeb Maslowa pomoże ci być skutecznym i efektywnym marketerem. Model ten spotkasz na wielu kursach biznesowych, nie tylko marketingowych, więc poświęć trochę czasu, aby się z nim zapoznać. Obejrzyj ten krótki film, który może pomóc ci zrozumieć, dlaczego hierarchia potrzeb Maslowa ma tak duże znaczenie, i jak można ją wykorzystywać w marketingu.
Obejrzyj film na temat transformacji marki Abercrombie & Fitch, aby dowiedzieć się więcej o tym, jak A&F pozycjonuje swoją markę detaliczną Hollister jako globalną i kultową markę dla nastolatków i repozycjonuje markę A&F, aby skupić się na konsumentach z pokolenia milenialsów.
Interesujesz się etycznymi zakupami? Obejrzyj ten film, aby poznać ich podstawy. Zapoznaj się również z tym artykułem, aby poznać konkretne powody, dla których warto być etycznym konsumentem.
Aby dowiedzieć się więcej o modelu biznesowym RingCentral, obejrzyj wywiad, którego Jimowi Cramerowi z programu CNBC Mad Money udzielił dyrektor generalny tej firmy.