This commit is contained in:
Stan Lo 2024-08-03 11:29:40 +01:00 коммит произвёл Hiroshi SHIBATA
Родитель 7d5cb4573d
Коммит cbc40bb130
15 изменённых файлов: 115 добавлений и 36 удалений

Просмотреть файл

@ -1,4 +1,5 @@
<meta charset="<%= @options.charset %>">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><%= h @title %></title>

Просмотреть файл

@ -0,0 +1,3 @@
<button id="navigation-toggle" class="navigation-toggle" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
<span aria-hidden>☰</span>
</button>

Просмотреть файл

@ -1,5 +1,7 @@
<body id="top" role="document" class="<%= klass.type %>">
<nav role="navigation">
<%= render '_sidebar_toggle.rhtml' %>
<nav id="navigation" role="navigation">
<div id="project-navigation">
<%= render '_sidebar_navigation.rhtml' %>
<%= render '_sidebar_search.rhtml' %>

Просмотреть файл

@ -19,12 +19,12 @@ body {
font-weight: 300;
/* Layout */
display: grid;
grid-template-columns: auto 1fr;
display: flex;
flex-wrap: wrap;
}
body > :last-child {
grid-column: 1 / 3;
width: 100%;
}
h1 span,
@ -203,24 +203,38 @@ nav {
font-family: Helvetica, sans-serif;
font-size: 14px;
border-right: 1px solid #ccc;
position: sticky;
position: fixed;
top: 0;
overflow: auto;
z-index: 10;
/* Layout */
width: 260px; /* fallback */
width: max(50px, 20vw);
min-width: 50px;
max-width: 80vw;
height: calc(100vh - 100px); /* reduce the footer height */
resize: horizontal;
width: 300px;
min-height: 100vh;
background: white;
}
@media (min-width: 1024px) {
nav {
min-height: unset;
height: calc(100vh - 100px); /* reduce the footer height */
}
}
main {
display: block;
margin: 1em;
margin: 3em 1em 1em;
min-width: 340px;
font-size: 16px;
width: 100%;
max-width: 64em;
}
@media (min-width: 1024px) {
main {
margin-left: auto;
margin-right: auto;
}
}
main h1,
@ -232,8 +246,10 @@ main h6 {
font-family: Helvetica, sans-serif;
}
.table-of-contents main {
margin-left: 2em;
@media (min-width: 1024px) {
.table-of-contents main {
margin-left: 20em;
}
}
#validator-badges {
@ -280,6 +296,38 @@ nav p {
list-style: none;
}
.navigation-toggle {
position: fixed;
left: 4px;
z-index: 100;
background: transparent;
border: none;
cursor: pointer;
padding: 4px;
font-size: 24px;
}
.navigation-toggle[aria-expanded="true"] {
left: 260px;
}
/* Adds a suble gradient to help the toggle stand out from the background */
.navigation-toggle::before {
content: "";
background: linear-gradient(180deg, rgba(250,250,250,1) 40%, rgba(250,250,250,0.8) 70%, rgba(250,250,250,0) 100%);
display: block;
z-index: -1;
pointer-events: none;
position: fixed;
top: 0;
height: 50px;
width: 100vw;
}
.navigation-toggle[aria-expanded="true"]::before {
height: 0;
}
#project-navigation .nav-section {
margin: 0;
border-top: 0;
@ -684,4 +732,3 @@ pre {
}
/* @end */

Просмотреть файл

@ -1,5 +1,7 @@
<body id="top" role="document" class="file">
<nav role="navigation">
<%= render '_sidebar_toggle.rhtml' %>
<nav id="navigation" role="navigation">
<div id="project-navigation">
<%= render '_sidebar_navigation.rhtml' %>

Просмотреть файл

@ -90,8 +90,25 @@ function hookFocus() {
});
}
function hookSidebar() {
var navigation = document.querySelector('#navigation');
var navigationToggle = document.querySelector('#navigation-toggle');
navigationToggle.addEventListener('click', function() {
navigation.hidden = !navigation.hidden;
navigationToggle.ariaExpanded = navigationToggle.ariaExpanded !== 'true';
});
var isSmallViewport = window.matchMedia("(max-width: 1024px)").matches;
if (isSmallViewport) {
navigation.hidden = true;
navigationToggle.ariaExpanded = false;
}
}
document.addEventListener('DOMContentLoaded', function() {
hookSourceViews();
hookSearch();
hookFocus();
hookSidebar();
});

Просмотреть файл

@ -1,5 +1,7 @@
<body id="top" role="document" class="file">
<nav role="navigation">
<%= render '_sidebar_toggle.rhtml' %>
<nav id="navigation" role="navigation">
<div id="project-navigation">
<%= render '_sidebar_navigation.rhtml' %>
<%= render '_sidebar_search.rhtml' %>
@ -15,4 +17,3 @@
<main role="main" aria-label="Page <%=h file.full_name%>">
<%= file.description %>
</main>

Просмотреть файл

@ -1,5 +1,7 @@
<body role="document">
<nav role="navigation">
<%= render '_sidebar_toggle.rhtml' %>
<nav id="navigation" role="navigation">
<%= render '_sidebar_navigation.rhtml' %>
<%= render '_sidebar_search.rhtml' %>
@ -15,4 +17,3 @@
<p><%= message %>
</main>

Просмотреть файл

@ -1,5 +1,7 @@
<body role="document">
<nav role="navigation">
<%= render '_sidebar_toggle.rhtml' %>
<nav id="navigation" role="navigation">
<div id="project-navigation">
<div id="home-section" class="nav-section">
<h2>

Просмотреть файл

@ -1,4 +1,13 @@
<body id="top" class="table-of-contents">
<%= render '_sidebar_toggle.rhtml' %>
<nav id="navigation" role="navigation">
<div id="project-navigation">
<%= render '_sidebar_navigation.rhtml' %>
<%= render '_sidebar_search.rhtml' %>
</div>
</nav>
<main role="main">
<h1 class="class"><%= h @title %></h1>

Просмотреть файл

@ -11,6 +11,9 @@
if ENV['RDOC_USE_PRISM_PARSER']
require 'rdoc/parser/prism_ruby'
RDoc::Parser.const_set(:Ruby, RDoc::Parser::PrismRuby)
puts "========================================================================="
puts "RDoc is using the experimental Prism parser to generate the documentation"
puts "========================================================================="
return
end

Просмотреть файл

@ -1,7 +1,7 @@
# frozen_string_literal: true
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.7.3
# This file is automatically generated by Racc 1.8.0
# from Racc grammar file "block_parser.ry".
#
@ -23,7 +23,7 @@ unless $".find {|p| p.end_with?('/racc/info.rb')}
$".push "#{__dir__}/racc/info.rb"
module Racc
VERSION = '1.7.3'
VERSION = '1.8.0'
Version = VERSION
Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
end
@ -31,10 +31,6 @@ end
end
unless defined?(NotImplementedError)
NotImplementedError = NotImplementError # :nodoc:
end
module Racc
class ParseError < StandardError; end
end

Просмотреть файл

@ -1,7 +1,7 @@
# frozen_string_literal: true
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.7.3
# This file is automatically generated by Racc 1.8.0
# from Racc grammar file "inline_parser.ry".
#
@ -23,7 +23,7 @@ unless $".find {|p| p.end_with?('/racc/info.rb')}
$".push "#{__dir__}/racc/info.rb"
module Racc
VERSION = '1.7.3'
VERSION = '1.8.0'
Version = VERSION
Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
end
@ -31,10 +31,6 @@ end
end
unless defined?(NotImplementedError)
NotImplementedError = NotImplementError # :nodoc:
end
module Racc
class ParseError < StandardError; end
end

Просмотреть файл

@ -230,9 +230,8 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
s.rdoc_options = ["--main", "README.rdoc"]
s.extra_rdoc_files += s.files.grep(%r[\A[^\/]+\.(?:rdoc|md)\z])
s.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
s.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
s.required_rubygems_version = Gem::Requirement.new(">= 2.2")
s.add_dependency 'prism', '>= 0.30.0'
s.add_dependency 'psych', '>= 4.0.0'
end

Просмотреть файл

@ -194,7 +194,7 @@ class TestRDocRDoc < RDoc::TestCase
File.write('.document', "a.rb\n""b.rb\n")
expected_files << a
@rdoc.options.exclude = Regexp.new(['b.rb'].join('|'))
@rdoc.options.exclude = /b\.rb$/
@rdoc.normalized_file_list [File.realpath(dir)]
end