Don't move node off center if no TOC is shown.

This commit is contained in:
Sergio Martínez Portela 2023-05-14 21:06:08 +02:00
parent 210a508a90
commit ce2ca99ebc
2 changed files with 5 additions and 3 deletions

View File

@ -772,8 +772,10 @@ def render(headline, doc, graph, headlineLevel):
def as_document(html, title, global_toc): def as_document(html, title, global_toc):
body_classes = []
if global_toc is None: if global_toc is None:
toc_section = "" toc_section = ""
body_classes.append('no-toc')
else: else:
toc_section = f""" toc_section = f"""
<div class="global-table-of-contents"> <div class="global-table-of-contents">
@ -793,7 +795,7 @@ def as_document(html, title, global_toc):
<meta name="MobileOptimized" content="320"> <meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
<body> <body class="{' '.join(body_classes)}">
<nav> <nav>
<h1><a href="./index.html">Código para llevar [Notes]</a></h1> <h1><a href="./index.html">Código para llevar [Notes]</a></h1>
<input type="text" id="searchbox" disabled="true" placeholder="Search (requires JS)" /> <input type="text" id="searchbox" disabled="true" placeholder="Search (requires JS)" />

View File

@ -482,10 +482,10 @@ tr.__table-separator {
/* Side-to-side */ /* Side-to-side */
@media (min-width: 120ex) { @media (min-width: 120ex) {
body { body:not(.no-toc) {
margin: 0; margin: 0;
} }
.global-table-of-contents { body:not(.no-toc) .global-table-of-contents {
position: fixed; position: fixed;
right: 1ex; right: 1ex;
max-width: calc(100vw - 85ex); max-width: calc(100vw - 85ex);