-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged branch 'jetty-10.0.x-more_docs' into 'jetty-10.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
- Loading branch information
Showing
7 changed files
with
157 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
:revdate: {localdate} | ||
|
||
:toc: left | ||
:toclevels: 4 | ||
:toclevels: 5 | ||
|
||
:idseparator: - | ||
:sectlinks: | ||
|
2 changes: 2 additions & 0 deletions
2
documentation/jetty-documentation/src/main/asciidoc/operations-guide/index-docinfo.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<link rel="stylesheet" href="../toc.css"> | ||
<script src="../toc.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
documentation/jetty-documentation/src/main/asciidoc/toc.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* ======================================================================== | ||
* Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* ======================================================================== | ||
*/ | ||
|
||
.hidden { | ||
display: none; | ||
} | ||
.toc-current { | ||
font-weight: bold; | ||
} | ||
.toc-item { | ||
padding-right: 0.4em; | ||
} | ||
.toc-toggle { | ||
padding-right: 0.4em; | ||
cursor: pointer; | ||
} |
121 changes: 121 additions & 0 deletions
121
documentation/jetty-documentation/src/main/asciidoc/toc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
document.addEventListener('DOMContentLoaded', () => dynamicTOC()); | ||
|
||
function dynamicTOC() { | ||
// Bind a click listener to all section titles. | ||
const content = document.getElementById('content'); | ||
const sectionTitles = content.querySelectorAll('a.link'); | ||
for (const sectionTitle of sectionTitles) { | ||
sectionTitle.addEventListener('click', event => collapseThenExpand(event.target.hash)); | ||
} | ||
|
||
// Bind a click listener to all TOC titles. | ||
const toc = document.getElementById('toc'); | ||
const tocTitles = toc.querySelectorAll('a'); | ||
for (const tocTitle of tocTitles) { | ||
tocTitle.addEventListener('click', event => collapseThenExpand(event.target.hash)); | ||
} | ||
|
||
// Add the icons to TOC nodes. | ||
const nodes = toc.querySelectorAll('li'); | ||
for (const node of nodes) { | ||
const span = document.createElement('span'); | ||
const css = span.classList; | ||
if (node.querySelector(':scope > ul')) { | ||
css.add('toc-toggle'); | ||
// Font-Awesome classes. | ||
css.add('fa'); | ||
css.add('fa-caret-right'); | ||
span.addEventListener('click', event => toggle(event.target)); | ||
} else { | ||
css.add('toc-item'); | ||
// The "icon" is the • HTML entity. | ||
span.appendChild(document.createTextNode('•')); | ||
} | ||
node.prepend(span); | ||
} | ||
|
||
collapseThenExpand(document.location.hash); | ||
} | ||
|
||
function collapseThenExpand(hash) { | ||
const toc = document.getElementById('toc'); | ||
if (hash) { | ||
const current = toc.querySelector('a.toc-current'); | ||
if (current) { | ||
current.classList.remove('toc-current'); | ||
} | ||
const anchor = toc.querySelector('a[href="' + hash + '"'); | ||
if (anchor) { | ||
anchor.classList.add('toc-current'); | ||
collapse(toc); | ||
expand(anchor.parentNode); | ||
} | ||
} else { | ||
collapse(toc); | ||
} | ||
} | ||
|
||
function collapse(node) { | ||
const sections = node.querySelectorAll('ul'); | ||
for (const section of sections) { | ||
const css = section.classList; | ||
// Always show first levels TOC titles. | ||
const alwaysShow = css.contains('sectlevel1') || css.contains('sectlevel2'); | ||
if (!alwaysShow) { | ||
css.add('hidden'); | ||
} | ||
} | ||
// Show the collapsed icon. | ||
const spans = node.querySelectorAll('span.toc-toggle'); | ||
for (const span of spans) { | ||
const css = span.classList; | ||
css.remove('fa-caret-down'); | ||
css.add('fa-caret-right'); | ||
} | ||
} | ||
|
||
function expand(node) { | ||
const root = document.getElementById('toc').querySelector('ul'); | ||
// Show the current node and its ancestors. | ||
let parent = node; | ||
while (parent !== root) { | ||
// Show the node. | ||
parent.classList.remove('hidden'); | ||
// Show the expanded icon. | ||
const span = parent.querySelector(':scope > span.toc-toggle'); | ||
if (span) { | ||
const css = span.classList; | ||
css.remove('fa-caret-right'); | ||
css.add('fa-caret-down'); | ||
} | ||
parent = parent.parentNode; | ||
} | ||
// Show the children. | ||
const children = node.querySelector(':scope > ul'); | ||
if (children) { | ||
children.classList.remove('hidden'); | ||
} | ||
} | ||
|
||
function toggle(span) { | ||
const css = span.classList; | ||
const expanded = css.contains('fa-caret-down'); | ||
if (expanded) { | ||
collapse(span.parentNode); | ||
} else { | ||
expand(span.parentNode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters