diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 5c1442fd188..26cc205280a 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -560,6 +560,14 @@ def html_body(self, classes=""): ).read_text() except IOError: return None + + # If HTML was generated by rfc2html, do not return it. Caller + # will use htmlize() to use a more current rfc2html to + # generate an HTMLized version. TODO: There should be a + # better way to determine how an HTML format was generated. + if html.startswith("
"):
+ return None
+
# get body
body = etree.HTML(html).xpath("//body")[0]
body.tag = "div"
diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py
index 2d54374ef04..5c01577dfaa 100644
--- a/ietf/doc/views_doc.py
+++ b/ietf/doc/views_doc.py
@@ -450,11 +450,12 @@ def document_main(request, name, rev=None, document_html=False):
js = None
css = None
if document_html:
- js = Path(finders.find("ietf/js/document_html.js")).read_text()
- css = Path(finders.find("ietf/css/document_html.css")).read_text()
html = doc.html_body()
- if html:
- css += Path(finders.find("ietf/css/document_html_txt.css")).read_text()
+ if request.COOKIES.get("pagedeps") == "inline":
+ js = Path(finders.find("ietf/js/document_html.js")).read_text()
+ css = Path(finders.find("ietf/css/document_html_inline.css")).read_text()
+ if html:
+ css += Path(finders.find("ietf/css/document_html_txt.css")).read_text()
return render(request, "doc/document_draft.html" if document_html is False else "doc/document_html.html",
dict(doc=doc,
document_html=document_html,
diff --git a/ietf/static/css/document_html.scss b/ietf/static/css/document_html.scss
index f87c7da6de5..13d730f19f9 100644
--- a/ietf/static/css/document_html.scss
+++ b/ietf/static/css/document_html.scss
@@ -51,11 +51,6 @@ $tooltip-margin: inherit !default;
// Utilities
@import "bootstrap/scss/utilities/api";
-// Make the bootstrap icons available.
-$bootstrap-icons-font-src: url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff2) format("woff2"),
-url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff) format("woff");
-@import "bootstrap-icons/font/bootstrap-icons";
-
:root {
--doc-ptsize-max: 16pt;
}
@@ -64,6 +59,10 @@ url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff) format("woff")
overscroll-behavior: none;
}
+.no-scrollbar {
+ scrollbar-width: none;
+}
+
.sidebar-toggle[aria-expanded="true"] {
display: none;
}
@@ -215,8 +214,14 @@ tbody.meta tr {
}
// Make revision numbers pagination items fixed-width
-.revision-list .page-item {
- width: 2.2rem;
+.revision-list {
+ .page-item {
+ width: 2.2rem;
+ }
+
+ .page-item.rfc {
+ width: 6.6rem;
+ }
}
#docinfo {
diff --git a/ietf/static/css/document_html_inline.scss b/ietf/static/css/document_html_inline.scss
new file mode 100644
index 00000000000..a7575343819
--- /dev/null
+++ b/ietf/static/css/document_html_inline.scss
@@ -0,0 +1,6 @@
+@import "document_html";
+
+// Make the bootstrap icons available via data-url.
+$bootstrap-icons-font-src: url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff2) format("woff2"),
+url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff) format("woff");
+@import "bootstrap-icons/font/bootstrap-icons";
diff --git a/ietf/static/css/document_html_referenced.scss b/ietf/static/css/document_html_referenced.scss
new file mode 100644
index 00000000000..5342989405b
--- /dev/null
+++ b/ietf/static/css/document_html_referenced.scss
@@ -0,0 +1,6 @@
+@import "document_html";
+
+// Make the bootstrap icons available.
+$bootstrap-icons-font-src: url("npm:bootstrap-icons/font/fonts/bootstrap-icons.woff2") format("woff2"),
+url("npm:bootstrap-icons/font/fonts/bootstrap-icons.woff") format("woff");
+@import "bootstrap-icons/font/bootstrap-icons";
diff --git a/ietf/static/css/ietf.scss b/ietf/static/css/ietf.scss
index 2734933fe39..9cfb610b793 100644
--- a/ietf/static/css/ietf.scss
+++ b/ietf/static/css/ietf.scss
@@ -169,7 +169,8 @@ table tbody.meta {
}
// Try and hyphenate table headings and other things
-th, .hyphenate {
+th,
+.hyphenate {
hyphens: auto;
}
@@ -209,8 +210,14 @@ th, .hyphenate {
}
// Make revision numbers pagination items fixed-width
-.revision-list .page-item {
- width: 2.2rem;
+.revision-list {
+ .page-item {
+ width: 2.2rem;
+ }
+
+ .page-item.rfc {
+ width: 6.6rem;
+ }
}
// Style the photo cards
diff --git a/ietf/static/js/document_html.js b/ietf/static/js/document_html.js
index 568f7276a12..b87a135c251 100644
--- a/ietf/static/js/document_html.js
+++ b/ietf/static/js/document_html.js
@@ -6,27 +6,11 @@ import {
Tab as Tab
} from "bootstrap";
-import debounce from "lodash/debounce";
import Cookies from "js-cookie";
import { populate_nav } from "./nav.js";
const cookies = Cookies.withAttributes({ sameSite: "strict" });
-// Chrome apparently wants this debounced to something >10ms,
-// otherwise the main view doesn't scroll?
-
-document.addEventListener("scroll", debounce(function () {
- const items = document.getElementById("toc-nav")
- .querySelectorAll(".active");
- const item = [...items].pop();
- if (item) {
- item.scrollIntoView({
- block: "center",
- behavior: "smooth"
- });
- }
-}, 100));
-
document.addEventListener("DOMContentLoaded", function (event) {
// handle point size slider
const cookie = "doc-ptsize-max";
diff --git a/ietf/static/js/ietf.js b/ietf/static/js/ietf.js
index 5257ee0cc22..17165bbfbdc 100644
--- a/ietf/static/js/ietf.js
+++ b/ietf/static/js/ietf.js
@@ -24,8 +24,6 @@ if (!process.env.BUILD_DEPLOY) {
import Cookies from "js-cookie";
-import debounce from "lodash/debounce";
-
import { populate_nav } from "./nav.js";
// setup CSRF protection using jQuery
@@ -205,18 +203,6 @@ $(function () {
extraNav.remove();
}
- $(document)
- // Chrome apparently wants this debounced to something >10ms,
- // otherwise the main view doesn't scroll?
- .on("scroll", debounce(function () {
- const item = $('#righthand-nav')
- .find(".active")
- .last();
- if (item.length) {
- item[0].scrollIntoView({ block: "center", behavior: "smooth" });
- }
- }, 100));
-
// offset the scrollspy to account for the menu bar
const contentOffset = contentElement ? contentElement.offset().top : 0;
diff --git a/ietf/static/js/nav.js b/ietf/static/js/nav.js
index 17d553e728f..06b82f80d1e 100644
--- a/ietf/static/js/nav.js
+++ b/ietf/static/js/nav.js
@@ -1,3 +1,5 @@
+import debounce from "lodash/debounce";
+
function make_nav() {
const nav = document.createElement("nav");
nav.classList.add("nav-pills", "ps-3", "flex-column");
@@ -81,4 +83,18 @@ export function populate_nav(nav, heading_selector, classes) {
for (var i = nav_stack.length - 1; i > 0; i--) {
nav_stack[i - 1].appendChild(nav_stack[i]);
}
+
+ // Chrome apparently wants this debounced to something >10ms,
+ // otherwise the main view doesn't scroll?
+ document.addEventListener("scroll", debounce(function () {
+ const items = nav.querySelectorAll(".active");
+ const item = [...items].pop();
+ console.log(item);
+ if (item) {
+ item.scrollIntoView({
+ block: "center",
+ behavior: "smooth"
+ });
+ }
+ }, 100));
}
diff --git a/ietf/templates/doc/document_html.html b/ietf/templates/doc/document_html.html
index 60fe37e0505..a16edf3d8c7 100644
--- a/ietf/templates/doc/document_html.html
+++ b/ietf/templates/doc/document_html.html
@@ -1,11 +1,13 @@
{# Copyright The IETF Trust 2016, All Rights Reserved #}
+{% load analytical %}
{% load origin %}
{% load static %}
{% load ietf_filters textfilters %}
{% origin %}
+ {% analytical_head_top %}
@@ -16,8 +18,16 @@
{% endif %}
-
-
+ {% if request.COOKIES.pagedeps == 'inline' %}
+
+
+ {% else %}
+
+ {% if html %}
+
+ {% endif %}
+
+ {% endif %}
{% include "base/icons.html" %}
{% include "doc/opengraph.html" %}
+ {% analytical_head_bottom %}
+ {% analytical_body_top %}
-
-
+