Skip to content

Commit 12c6bd2

Browse files
Lint
1 parent 4e55caa commit 12c6bd2

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lib/kitchen/directions/bake_toc.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ def self.v1(book:, options: { cases: false })
99
numbering_options: { mode: :chapter_page, separator: '.' },
1010
controller: {
1111
get_chapter_toc_title: nil,
12-
get_unit_toc_title: nil,
12+
get_unit_toc_title: nil
1313
}
1414
)
1515
controller = options[:controller]
16-
@toc_title_for_unit =
16+
@toc_title_for_unit =
1717
if controller[:get_unit_toc_title].nil?
1818
lambda do |unit|
1919
number = unit.os_number(options[:numbering_options])
@@ -26,8 +26,8 @@ def self.v1(book:, options: { cases: false })
2626
else
2727
controller[:get_unit_toc_title]
2828
end
29-
30-
@toc_title_for_chapter =
29+
30+
@toc_title_for_chapter =
3131
if controller[:get_chapter_toc_title].nil?
3232
lambda do |chapter|
3333
number = chapter.os_number(options[:numbering_options])
@@ -107,7 +107,7 @@ def self.li_for_chapter(chapter)
107107
li_for_composite_chapter(child)
108108
end
109109
end.join("\n")
110-
110+
111111
<<~HTML
112112
<li class="os-toc-chapter" cnx-archive-shortid="" cnx-archive-uri="" data-toc-type="chapter">
113113
<a href="##{chapter.title.id}">

lib/kitchen/element_base.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ def number_parts(mode, unit_offset:, chapter_offset:, page_offset:)
402402
else
403403
unit = ancestor(:unit)
404404
chapter = ancestor(:chapter)
405-
[unit.count_in(:book) + unit_offset, chapter.count_in(:unit) + chapter_offset, count_in(:chapter) + page_offset]
405+
[unit.count_in(:book) + unit_offset,
406+
chapter.count_in(:unit) + chapter_offset,
407+
count_in(:chapter) + page_offset]
406408
end
407409
else
408410
# Further levels of nesting are not currently supported because of how
@@ -424,13 +426,13 @@ def os_number(options={})
424426
separator: '.',
425427
unit_offset: 0,
426428
chapter_offset: 0,
427-
page_offset: 0,
429+
page_offset: 0
428430
)
429431
parts = number_parts(
430432
options[:mode],
431433
unit_offset: options[:unit_offset],
432434
chapter_offset: options[:chapter_offset],
433-
page_offset: options[:page_offset],
435+
page_offset: options[:page_offset]
434436
)
435437
parts.join(options[:separator])
436438
end

lib/recipes/algebra-1/recipe.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
unit.chapters.each_with_index do |ch, ch_idx|
2323
title = ch.title.to_s
2424
is_unnumbered_chapter = (
25-
ch_idx == 0 or
25+
ch_idx.zero? or
2626
title.include?('Overview and Readiness') or
2727
title.include?('Project'))
28-
if is_unnumbered_chapter
29-
ch[unnumbered_chapter_marker] = 'true'
30-
end
28+
ch[unnumbered_chapter_marker] = 'true' if is_unnumbered_chapter
3129
end
3230
end
3331
end
@@ -67,7 +65,7 @@
6765
numbered: { mode: :unit_chapter_page, page_offset: -1 }
6866
}
6967
chapters_by_type = {
70-
unnumbered: lambda { book.chapters("$[#{unnumbered_chapter_marker}]") },
68+
unnumbered: -> { book.chapters("$[#{unnumbered_chapter_marker}]") },
7169
numbered: lambda {
7270
book
7371
.units("$:not([#{unnumbered_unit_marker}])")
@@ -188,7 +186,7 @@
188186
book.pages('$.unit-closer').to_a
189187
).each do |element|
190188
element.title.replace_children(
191-
with: %%<span data-type="" itemprop="" class="os-text">#{element.title_text}</span>%
189+
with: %(<span data-type="" itemprop="" class="os-text">#{element.title_text}</span>)
192190
)
193191
end
194192

@@ -199,7 +197,7 @@
199197
controller: {
200198
get_unit_toc_title: lambda do |unit|
201199
if unit[unnumbered_unit_marker]
202-
(%%<span data-type="" itemprop="" class="os-text">#{unit.title_text}</span>%)
200+
%(<span data-type="" itemprop="" class="os-text">#{unit.title_text}</span>)
203201
else
204202
number = unit.os_number({ mode: :unit_chapter_page,
205203
unit_offset: -skipped_units })

0 commit comments

Comments
 (0)