Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ietf/static/css/document_html.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff) format("woff")
@import "bootstrap-icons/font/bootstrap-icons";


.overscroll-none {
overscroll-behavior: none;
}

@media screen {
@include media-breakpoint-down(md) {
body {
Expand Down Expand Up @@ -96,7 +100,7 @@ url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff) format("woff")

@media screen {
@include media-breakpoint-only(xs) {
font-size: 7.5pt;
font-size: 7pt;
}

@include media-breakpoint-up(sm) {
Expand All @@ -111,6 +115,14 @@ url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff) format("woff")
font-size: 11pt;
}

@include media-breakpoint-up(xl) {
font-size: 13pt;
}

@include media-breakpoint-up(xxl) {
font-size: 16pt;
}

.grey,
hr {
opacity: $hr-opacity;
Expand Down
5 changes: 4 additions & 1 deletion ietf/static/js/document_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ document.addEventListener("DOMContentLoaded", function (event) {

// Set up a nav pane
const toc_pane = document.querySelector("#toc-nav");
populate_nav(toc_pane, "#content h2, #content h3, #content h4, #content h5, #content h6", 2, ["py-0"]);
populate_nav(toc_pane,
`#content h2, #content h3, #content h4, #content h5, #content h6
#content .h1, #content .h2, #content .h3, #content .h4, #content .h5, #content .h6`,
["py-0"]);

// activate pref buttons selected by pref cookies
document.querySelectorAll(".btn-check")
Expand Down
2 changes: 1 addition & 1 deletion ietf/static/js/ietf.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ $(function () {
.children()
.last();

populate_nav(nav[0], heading_selector, 2);
populate_nav(nav[0], heading_selector);

if (haveExtraNav) {
$('#righthand-panel').append('<div id="righthand-extra" class="w-100 py-3"></div>');
Expand Down
25 changes: 21 additions & 4 deletions ietf/static/js/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,33 @@ function make_nav() {
return nav;
}

export function populate_nav(nav, heading_selector, start_level, classes) {
function get_level(el) {
let h;
if (el.tagName.match(/^h\d/i)) {
h = el.tagName
} else {
el.classList.forEach(cl => {
if (cl.match(/^h\d/i)) {
h = cl;
return;
}
});
}
return h.charAt(h.length - 1);
}

export function populate_nav(nav, heading_selector, classes) {
// Extract section headings from document
const headings = document.querySelectorAll(heading_selector);
const min_level = Math.min(...Array.from(headings)
.map(get_level));

let nav_stack = [nav];
let cur_level = 0;
let n = 0;

headings.forEach(el => {
let level = el.tagName.charAt(el.tagName.length - 1) -
start_level;
const level = get_level(el) - min_level;

if (level < cur_level) {
while (level < cur_level) {
Expand All @@ -30,7 +46,8 @@ export function populate_nav(nav, heading_selector, start_level, classes) {
}

const link = document.createElement("a");
link.classList.add("nav-link", "ps-1", "d-flex", "hyphenate", classes);
link.classList.add("nav-link", "ps-1", "d-flex", "hyphenate",
classes);

if (!el.id) {
el.id = `autoid-${++n}`;
Expand Down
3 changes: 3 additions & 0 deletions ietf/templates/doc/document_format_buttons.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% if file_urls %}
<div class="buttonlist">
{% for label, url in file_urls %}
{% if label != skip_format %}
<a class="btn btn-primary btn-sm"
{% if label == 'pdf' or label == 'pdfized' %}
download="{% if not snapshot and doc.get_state_slug == 'rfc' %}rfc{{ doc.rfc_number }}{% else %}{{ doc.name }}-{{ doc.rev }}{% endif %}.pdf"
Expand All @@ -10,6 +11,7 @@
download="{% if not snapshot and doc.get_state_slug == 'rfc' %}rfc{{ doc.rfc_number }}{% else %}{{ doc.name }}-{{ doc.rev }}{% endif %}.bib"
{% endcomment %}
{% endif %}
target="_blank"
href="{{ url }}">
{% if label == 'pdf' or label == 'pdfized' %}
<i class="bi bi-file-pdf"></i> pdf
Expand All @@ -25,6 +27,7 @@
<i class="bi bi-file-diff"></i> w/errata
{% endif %}
</a>
{% endif %}
{% endfor %}
</div>
{% else %}
Expand Down
Loading