Class: Kitchen::Directions::BakeAutotitledExercise::V2
- Defined in:
- lib/kitchen/directions/bake_autotitled_exercise/v2.rb
Overview
Differences from V1:
-
Title is an <h3><span>, not <h4>, & above the problem instead of within it
-
Title is generated in the recipe and passed to the method
Instance Method Summary collapse
Instance Method Details
#bake(exercise:, title:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/kitchen/directions/bake_autotitled_exercise/v2.rb', line 8 def bake(exercise:, title:) exercise.add_class('unnumbered') exercise.titles.first&.trash # bake problem exercise.prepend(child: " <h3 class=\"os-title\" data-type=\"title\">\n <span class=\"os-title-label\">\#{title}</span>\n </h3>\n HTML\n )\n exercise.problem.wrap_children(class: 'os-problem-container')\n return unless exercise.solution\n\n exercise.solution.wrap_children(class: 'os-solution-container')\n exercise.solution.prepend(child:\n <<~HTML\n <h4 class=\"solution-title\" data-type=\"title\">\n <span class=\"os-text\">\#{I18n.t(:solution)}</span>\n </h4>\n HTML\n )\nend\n" |