Remove datatracker menu, simplify the base, and focus primarily on styling for just this page. Add the colorbar and tooltips.

- Legacy-Id: 18861
This commit is contained in:
Robert Sparks 2021-02-23 23:16:07 +00:00
parent 156cbf680e
commit fc6579c712
4 changed files with 299 additions and 39 deletions

View file

@ -889,27 +889,38 @@ def build_file_urls(doc):
return file_urls, found_types
def build_doc_supermeta_block(doc):
# TODO: rework all of these using f-strings
items = []
#items.append = '[Docs]'
items.append(f'<a href="{ settings.IDTRACKER_BASE_URL }" title="Document search and retrieval page">[Search]</a>')
file_urls, found_types = build_file_urls(doc)
file_urls = [('txt',url) if label=='plain text' else (label,url) for label,url in file_urls]
if file_urls:
items.append('[' + '|'.join([f'<a href="{url}">{label}</a>' for label,url in file_urls if 'htmlized' not in label]) + ']')
file_labels = {
'txt' : 'Plaintext version of this document',
'xml' : 'XML source for this document',
'pdf' : 'PDF version of this document',
'html' : 'HTML version of this document, from XML2RFC',
'bibtex' : 'BibTex entry for this document',
}
parts=[]
for label,url in file_urls:
if 'htmlized' not in label:
file_label=file_labels.get(label,'')
title_attribute = f' title="{file_label}"' if file_label else ''
partstring = f'<a href="{url}"{title_attribute}>{label}</a>'
parts.append(partstring)
items.append('[' + '|'.join(parts) + ']')
items.append('[<a href="' + urlreverse('ietf.doc.views_doc.document_main',kwargs=dict(name=doc.name)) + '">Tracker</a>]')
items.append(f'[<a href="{ urlreverse("ietf.doc.views_doc.document_main",kwargs=dict(name=doc.canonical_name())) }" title="Datatracker information for this document">Tracker</a>]')
if doc.group.acronym != 'none':
items.append('[<a href="' + urlreverse('ietf.group.views.group_home',kwargs=dict(acronym=doc.group.acronym)) + '">WG</a>]')
items.append('[<a href="mailto:' + doc.name + '@ietf.org?subject=' + doc.name + '">Email</a>]')
items.append(f'[<a href="{urlreverse("ietf.group.views.group_home",kwargs=dict(acronym=doc.group.acronym))}" title="The working group handling this document">WG</a>]')
items.append(f'[<a href="mailto:{doc.name}@ietf.org?subject={doc.name}" title="Send email to the document authors">Email</a>]')
if doc.rev != "00":
items.append('[<a href="' + settings.RFCDIFF_BASE_URL + '?difftype=--hwdiff&url2=' + doc.name + '-' + doc.rev + '.txt" title="Inline diff (wdiff)">Diff1</a>]')
items.append('[<a href="' + settings.RFCDIFF_BASE_URL + '?url2=' + doc.name + '-' + doc.rev + '.txt" title="Side-by-side diff">Diff2</a>]')
items.append('[<a href="' + settings.IDNITS_BASE_URL + '?url=' + settings.IETF_ID_ARCHIVE_URL + doc.name + '-' + doc.rev + '.txt" title="Run an idnits check of this document">Nits</a>]')
items.append(f'[<a href="{settings.RFCDIFF_BASE_URL}?difftype=--hwdiff&url2={doc.name}-{doc.rev}.txt" title="Inline diff (wdiff)">Diff1</a>]')
items.append(f'[<a href="{settings.RFCDIFF_BASE_URL}?url2={doc.name}-{doc.rev}.txt" title="Side-by-side diff">Diff2</a>]')
items.append(f'[<a href="{settings.IDNITS_BASE_URL}?url={settings.IETF_ID_ARCHIVE_URL}{doc.name}-{doc.rev}.txt" title="Run an idnits check of this document">Nits</a>]')
#[Docs] [formats] [<a href="{% url 'ietf.doc.views_doc.document_main' name=doc.name %}">Tracker</a>]{% if doc.group.acronym != 'none' %} [<a href="{% url 'ietf.group.views.group_home' acronym=doc.group.acronym %}">WG</a>]{% endif%} [<a href="mailto:{{doc.name}}@ietf.org?subject={{doc.name}} ">Email</a>] [<a href="{{settings.RFCDIFF_BASE_URL}}?difftype=--hwdiff&url2={{doc.name}}-{{doc.rev}}.txt" title="Inline diff (wdiff)">Diff1</a>]{% if doc.rev != "00" %} [<a href="{{settings.RFCDIFF_BASE_URL}}?url2={{doc.name}}-{{doc.rev}}.txt" title="Side-by-side diff">Diff2</a>]{% endif %} [<a href="{{settings.IDNITS_BASE_URL}}?url={{settings.IETF_ID_ARCHIVE_URL}}{{doc.name}}-{{doc.rev}}.txt" title="Run an idnits check of this document">Nits</a>]
return ' '.join(items)
def build_doc_meta_block(doc, path):

View file

@ -660,7 +660,6 @@ def document_html(request, name, rev=None):
if not os.path.exists(doc.get_file_name()):
raise Http404("File not found: %s" % doc.get_file_name())
top = render_document_top(request, doc, "status", name)
if not rev and not name.startswith('rfc'):
rev = doc.rev
if rev:
@ -673,8 +672,26 @@ def document_html(request, name, rev=None):
doc.supermeta = build_doc_supermeta_block(doc)
doc.meta = build_doc_meta_block(doc, settings.HTMLIZER_URL_PREFIX)
# TODO: not using top - clean put building and passing it
return render(request, "doc/document_html.html", {"doc":doc, "top":top, "navbar_mode":"navbar-static-top", })
doccolor = 'bgwhite' # Unknown
if doc.type_id=='draft':
if doc.is_rfc():
if doc.related_that('obs'):
doccolor = 'bgbrown'
else:
doccolor = {
'ps' : 'bgblue',
'exp' : 'bgyellow',
'inf' : 'bgorange',
'ds' : 'bgcyan',
'hist' : 'bggrey',
'std' : 'bggreen',
'bcp' : 'bgmagenta',
'unkn' : 'bgwhite',
}.get(doc.std_level_id, 'bgwhite')
else:
doccolor = 'bgred' # Draft
return render(request, "doc/document_html.html", {"doc":doc, "doccolor":doccolor })
def check_doc_email_aliases():
pattern = re.compile(r'^expand-(.*?)(\..*?)?@.*? +(.*)$')

View file

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "doc/htmlized_base.html" %}
{# Copyright The IETF Trust 2016, All Rights Reserved #}
{% load origin %}
{% load static %}
@ -12,15 +12,28 @@
{% endblock %}
{% block morecss %}
.inline { display: inline; }
.rfcmarkup pre {
font-size: 10pt;
font-family: courier;
overflow: visible;
}
.rfcmarkup pre.meta-info {
width: 100ex;
.bgwhite { background-color: white; }
.bgred { background-color: #F44; }
.bggrey { background-color: #666; }
.bgbrown { background-color: #840; }
.bgorange { background-color: #FA0; }
.bgyellow { background-color: #EE0; }
.bgmagenta{ background-color: #F4F; }
.bgblue { background-color: #66F; }
.bgcyan { background-color: #4DD; }
.bggreen { background-color: #4F4; }
.colorbar {
height: 6px;
position: absolute;
width: 100%;
margin-left:-0.5em;
margin-bottom:0;
}
.draftcontent { margin-top:0px !important;}
{% endblock %}
{% block title %}
@ -36,34 +49,76 @@
{% block content %}
{% origin %}
<div class="col-md-8 rfcmarkup">
<div class="col-md-6 rfcmarkup">
<div class="row" style="height: 0px; margin-top:0;">
<div onmouseover="this.style.cursor='pointer';"
onclick="showElem('legend');"
onmouseout="hideElem('legend')"
style="height: 6px; position: absolute; margin-top:0; "
class="colorbar {{doccolor}}"
title="Click for colour legend." ></div>
<div id="legend"
class="docinfo noprint pre legend"
style="position:absolute; top: 4px; left: 4ex; visibility:hidden; background-color: white; padding: 4px 9px 5px 7px; border: solid #345 1px; "
onmouseover="showElem('legend');"
onmouseout="hideElem('legend');">
</div>
</div>
{% if doc.meta %}
<div class="hidden-print">
<div class="row hidden-print" style="margin-top:6px;">
<pre class="meta-info">{{ doc.supermeta|safe }}
{{ doc.meta|safe }}</pre>
</div>
{% endif %}
{% comment %}
{% if doc.is_dochistory %}
{% if doc.rev != doc.doc.rev %}
<pre class="meta-info alert-warning text-center">A newer version of the document below exists</pre>
{% elif doc.doc.is_rfc %}
<pre class="meta-info alert-info text-center">The draft below has been published as <a href="{% url 'ietf.doc.views_doc.document_html' name=doc.doc.canonical_name %}">RFC {{doc.doc.rfc_number}}</a></pre>
{% endif %}
{% endif %}
{% endcomment %}
<div>
<div class="row draftcontent">
{{ doc.htmlized|default:"Generation of htmlized text failed"|safe }}
</div>
</div>
<div class="col-md-4"></div>
<div class="col-md-6"></div>
{% endblock %}
{% block footer %}
<div></div>
{% block js %}
<script type="text/javascript"><!--
function addHeaderTags() {
var spans = document.getElementsByTagName("span");
for (var i=0; i < spans.length; i++) {
var elem = spans[i];
if (elem) {
var level = elem.getAttribute("class");
if (level == "h1" || level == "h2" || level == "h3" || level == "h4" || level == "h5" || level == "h6") {
elem.innerHTML = "<"+level+">"+elem.innerHTML+"</"+level+">";
}
}
}
}
var legend_html = "Colour legend:<br /> \
<table> \
<tr><td>Unknown:</td> <td><span class='cplate bgwhite'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Draft:</td> <td><span class='cplate bgred'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Informational:</td> <td><span class='cplate bgorange'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Experimental:</td> <td><span class='cplate bgyellow'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Best Common Practice:</td> <td><span class='cplate bgmagenta'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Proposed Standard:</td> <td><span class='cplate bgblue'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Draft Standard (old designation):</td> <td><span class='cplate bgcyan'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Internet Standard:</td> <td><span class='cplate bggreen'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Historic:</td> <td><span class='cplate bggrey'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
<tr><td>Obsolete:</td> <td><span class='cplate bgbrown'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr> \
</table>";
function showElem(id) {
var elem = document.getElementById(id);
elem.innerHTML = eval(id+"_html");
elem.style.visibility='visible';
}
function hideElem(id) {
var elem = document.getElementById(id);
elem.style.visibility='hidden';
elem.innerHTML = "";
}
// -->
</script>
{% endblock %}

View file

@ -0,0 +1,177 @@
<!DOCTYPE html> {% load ietf_filters static %}
{# Copyright The IETF Trust 2021, All Rights Reserved #}
{% load origin %}{% origin %}
{% load bootstrap3 %}
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% block title %}No title{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{% static 'ptmono/stylesheet.css' %}" rel='stylesheet' type='text/css'>
<link href="{% static 'ptsans/stylesheet.css' %}" rel='stylesheet' type='text/css'>
<link href="{% static 'ptserif/stylesheet.css' %}" rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{% static 'font-awesome/css/font-awesome.min.css' %}">
<link rel="stylesheet" href="{% static 'ietf/font-datatracker/css/font-datatracker.css' %}">
<link rel="stylesheet" href="{% static 'ietf/bootstrap/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'ietf/bootstrap/css/bootstrap-theme.min.css' %}">
<!-- <link rel="stylesheet" href="{% static 'ietf/css/ietf.css' %}"> -->
{% if debug %}
<link rel="stylesheet" href="{% static 'jquery.tablesorter/css/theme.bootstrap.min.css' %}">
{% endif %}
<style>
.rfcmarkup div {
margin-top: 1em;
}
.rfcmarkup pre {
font-size: 10pt;
border: 0;
margin: 0;
padding: 0;
padding-bottom: 1em;
background-color: white;
line-height: 1.12;
font-family: monospace;
overflow: visible;
}
.rfcmarkup pre span.h1,
.rfcmarkup pre span.h2,
.rfcmarkup pre span.h3,
.rfcmarkup pre span.h4,
.rfcmarkup pre span.h5,
.rfcmarkup pre span.h6 {
font-weight: bold;
line-height: 0pt;
display: inline;
white-space: pre;
font-family: monospace;
font-size: 1em;
font-weight: bold;
}
.rfcmarkup pre span.invisible {
text-decoration: none;
color: white;
}
.rfcmarkup pre a { text-decoration: underline; }
.rfcmarkup pre .grey,
.rfcmarkup pre .grey a:link,
.rfcmarkup pre .grey a:visited {
color: #777;
}
.rfcmarkup pre.meta-info {
padding: 0.5em;
margin-left: -0.5em;
background-color: #f8f8f8;
border: 1px solid #e0e0e0;
width: 100%;
padding-top: 0;
}
.rfcmarkup hr {
margin: 0;
width: 80ex;
}
.rfcmarkup .text-warning,
.rfcmarkup a.text-warning,
.rfcmarkup a.text-warning:focus,
.rfcmarkup a.text-warning:active,
.rfcmarkup a.text-warning:visited,
.rfcmarkup a.text-warning:hover
{
color: #d9534f; /* brand-danger colour */
}
@media screen {
body { margin-left:3em; }
}
@media print {
body { margin-top:5em; }
.rfcmarkup .noprint { display: none; }
.rfcmarkup a,
.rfcmarkup a:visited,
.rfcmarkup pre a,
.rfcmarkup pre a:visited {
text-decoration: none;
}
.rfcmarkup a[href]:after {
content: "";
}
.rfcmarkup abbr[title]:after {
content: "";
}
.rfcmarkup pre {
font-size: 10.5pt;
margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
}
.rfcmarkup .newpage {
page-break-before: always;
}
}
{% block morecss %}{% endblock %}
</style>
<!--[if lt IE 9]>
<script src="{% static 'html5shiv/html5shiv.min.js' %}"></script>
<script src="{% static 'respond/dest/respond.min.js' %}"></script>
<![endif]-->
{% block pagehead %}{% endblock %}
{% if server_mode and server_mode == "production" %}
<link rel="shortcut icon" href="{% static 'ietf/images/ietf-icon-blue3.png' %}">
{% else %}
<link rel="shortcut icon" href="{% static 'ietf/images/ietf-icon-red3.png' %}">
{% endif %}
<link rel="apple-touch-icon" href="{% static 'ietf/images/apple-touch-icon.png' %}">
</head>
<body {% block bodyAttrs %}{%endblock%}>
<div class="container-fluid-narrow">
{% comment %} {% bootstrap_messages %} {% endcomment %}
{% for message in messages %}
<div class="alert{% if message.level_tag %} alert-{% if message.level_tag == 'error' %}danger{% else %}{{ message.level_tag }}{% endif %}{% endif %}{% if message.extra_tags %} {{message.extra_tags}}{% endif %} alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&#215;</button>{{ message }}</div>
{% endfor %}
<div class="col-md-12 col-sm-12" id="content">
{% block content %}{{ content|safe }}{% endblock %}
{% block content_end %}{% endblock %}
</div>
{% block footer %}
{% endblock %}
</div>
{% include "debug.html" %}
<script src="{% static 'jquery/jquery.min.js' %}"></script>
{% comment %}
<!-- Remove the *-nojs attributes if we are running js. This depends on jQuery's removeClass(): -->
<!-- Do this as early as possible (after loading the page and jQuery) to avoid rendering changes -->
{% endcomment %}
<script>$(".visible-nojs").removeClass("visible-nojs");</script>
<script>$(".hidden-nojs").removeClass("hidden-nojs");</script>
<script src="{% static 'js-cookie/src/js.cookie.js' %}"></script>
<script src="{% static 'ietf/bootstrap/js/bootstrap.min.js' %}"></script>
{% block js %}{% endblock %}
{% if debug %}
<script src="{% static 'jquery.tablesorter/js/jquery.tablesorter.combined.min.js' %}"></script>
{% endif %}
</body>
</html>