Skip to content

Commit

Permalink
Merge branch 'master' into rorvswild_theme
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinem committed Oct 7, 2024
2 parents 2e4f920 + b53f0cb commit 2fb97c3
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 15 deletions.
14 changes: 7 additions & 7 deletions lib/rdoc/generator/template/darkfish/css/rdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

--color-primary: oklch(0.5 0.18 29);
--color-primary-hover: oklch(0.4 0.18 29);
--color-strong-background: oklch(0.97 0.05 89);
--color-strong-background: oklch(0.97 0.03 59);
--color-topbar: var(--color-primary);
--color-topbar-text: var(--color-background);
--color-text: oklch(0.36 0.03 269);
--color-text-light: oklch(0.46 0.03 269);
--color-title: oklch(0.26 0.03 269);
--color-text: oklch(0.4 0.03 269);
--color-text-light: oklch(0.5 0.03 269);
--color-title: oklch(0.27 0.03 269);
--color-background: oklch(0.99 0.001 269);
--color-code-background: oklch(0.97 0.002 269);
--color-th-background: oklch(0.95 0.002 269);
Expand Down Expand Up @@ -202,7 +202,7 @@ details > summary::after {
flex-shrink: 0;
cursor: pointer;
position: relative;
top: 1px;
top: 2px;
margin-left: auto;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ main h2 {
font-size: 1.44rem;
line-height: 3rem;
color: var(--color-title);
box-shadow: 0 2px 0 0 var(--color-text);
box-shadow: 0 1px 0 0 var(--color-text-light);
}

main h3 {
Expand Down Expand Up @@ -811,7 +811,7 @@ pre + .toggle-source { margin-top: 0.5rem; }
--color-primary: oklch(0.85 0.09 29);
--color-primary-hover: oklch(87.78296875% 0.07 29);

--color-strong-background: oklch(0.28 0.06 89);
--color-strong-background: oklch(0.27 0.04 59);

--color-topbar: oklch(0.5 0.18 29);
--color-topbar-text: oklch(0.99 0.001 269);
Expand Down
8 changes: 4 additions & 4 deletions lib/rdoc/markup/to_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def accept_verbatim verbatim
# Adds +table+ to the output

def accept_table header, body, aligns
widths = header.zip(body) do |h, b|
[h.size, b.size].max
widths = header.zip(*body).map do |cols|
cols.map(&:size).max
end
aligns = aligns.map do |a|
case a
Expand All @@ -262,12 +262,12 @@ def accept_table header, body, aligns
:rjust
end
end
@res << header.zip(widths, aligns) do |h, w, a|
@res << header.zip(widths, aligns).map do |h, w, a|
h.__send__(a, w)
end.join("|").rstrip << "\n"
@res << widths.map {|w| "-" * w }.join("|") << "\n"
body.each do |row|
@res << row.zip(widths, aligns) do |t, w, a|
@res << row.zip(widths, aligns).map do |t, w, a|
t.__send__(a, w)
end.join("|").rstrip << "\n"
end
Expand Down
17 changes: 17 additions & 0 deletions test/rdoc/support/text_formatter_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ def test_accept_paragraph_wrap
accept_paragraph_wrap
end

##
# Test case that calls <tt>@to.accept_table</tt>

def test_accept_table_align
header = ['AA', 'BB', 'CCCCC']
body = [
['', 'bbb', 'c'],
['aaaa', 'b', ''],
['a', '', 'cc']
]
aligns = [nil, :left, :right]
@to.start_accepting
@to.accept_table header, body, aligns

accept_table_align
end

##
# Test case that calls <tt>@to.attributes</tt> with an escaped
# cross-reference. If this test doesn't pass something may be very
Expand Down
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_markup_to_ansi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@ def list_verbatim
assert_equal expected, @to.end_accepting
end

def accept_table_align
expected = "\e[0m" + <<-EXPECTED
AA |BB |CCCCC
----|---|-----
|bbb| c
aaaa|b |
a | | cc
EXPECTED
assert_equal expected, @to.end_accepting
end

# functional test
def test_convert_list_note
note_list = <<-NOTE_LIST
Expand Down
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_markup_to_bs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,15 @@ def list_verbatim
assert_equal expected, @to.end_accepting
end

def accept_table_align
expected = <<-EXPECTED
AA |BB |CCCCC
----|---|-----
|bbb| c
aaaa|b |
a | | cc
EXPECTED
assert_equal expected, @to.end_accepting
end

end
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_markup_to_markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,17 @@ def list_verbatim
assert_equal expected, @to.end_accepting
end

def accept_table_align
expected = <<-EXPECTED
AA |BB |CCCCC
----|---|-----
|bbb| c
aaaa|b |
a | | cc
EXPECTED
assert_equal expected, @to.end_accepting
end

def test_convert_RDOCLINK
result = @to.convert 'rdoc-garbage:C'

Expand Down
11 changes: 11 additions & 0 deletions test/rdoc/test_rdoc_markup_to_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,17 @@ def list_verbatim
assert_equal expected, @to.end_accepting
end

def accept_table_align
expected = <<-EXPECTED
AA |BB |CCCCC
----|---|-----
|bbb| c
aaaa|b |
a | | cc
EXPECTED
assert_equal expected, @to.end_accepting
end

# functional test
def test_convert_list_note
note_list = <<-NOTE_LIST
Expand Down
8 changes: 4 additions & 4 deletions test/rdoc/test_rdoc_ri_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def test_self_dump
RDoc::RI::Driver.dump @store1.cache_path
end

assert_match %r%:class_methods%, out
assert_match %r%:modules%, out
assert_match %r%:instance_methods%, out
assert_match %r%:ancestors%, out
assert_match %r%:class_methods|class_methods:%, out
assert_match %r%:modules|modules:%, out
assert_match %r%:instance_methods|instance_methods:%, out
assert_match %r%:ancestors|ancestors:%, out
end

def test_add_also_in_empty
Expand Down

0 comments on commit 2fb97c3

Please sign in to comment.