On Sun, Sep 04, 2016 at 09:28:08PM +0300, Alexander Gromnitsky wrote:
> On Sun, Sep 04, 2016 at 08:31:33AM -0400, Aaron Schrab wrote:
>> On my browser this is leaving a large blank area to the left of the TOC.  
>> The narrowness of the space allocated for the TOC leaves a lot of items 
>> being wrapped.  Also, since that space to the left isn't considered to 
>> be part of the TOC using my scroll wheel in there causes the main body 
>> to scroll, when visually I'd expect it to scroll the TOC.

> Those are valid points, thank you.

> The TOC now tries to make more use of the left area. That also fixes
> the scrolling issue, although the result isn't perfectly centred now.

Another version of the patch. This one uses a slightly better
positioning at the expense of requiring at least IE11. It also fixes
an unrelated Firefox issue w/ the annoying horizontal stretching
because of a non-wrapping <code> block.

diff -r 2b9689daf902 doc/mutt.css
--- a/doc/mutt.css      Mon Sep 05 12:44:15 2016 -0700
+++ b/doc/mutt.css      Tue Sep 06 01:13:58 2016 +0300
@@ -1,4 +1,64 @@
-body { margin-left:2%; margin-right:2%; font-family:serif; }
+@media (min-width: 780px) {
+  body {
+    width: 780px;
+    margin: 0 auto;
+  }
+}
+
+@media (min-width: 1200px) {
+  body {
+    width: 100%;
+    margin: 0;
+  }
+
+  .book {
+    /* border: 1px solid black; */
+    width: 780px;
+
+    /* 420 is a min usefull TOC width */
+    margin-left: calc(100%/2 - 1200px/2 + 420px);
+  }
+
+  .book > .toc {
+    /* border: 1px solid red; */
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: calc(100%/2 - 1200px/2 + 420px - 1em);
+
+    overflow: auto;
+    height: 100%;
+
+    display: flex;
+    justify-content: flex-end;
+  }
+
+  .book > .toc > p {
+    background-color: blue;
+    display: none;
+  }
+
+  .book > .toc > .toc {
+    /* background-color: yellow; */
+    padding: 0 1em;
+    max-width: 480px;
+  }
+
+  .book > .toc > .toc::before {
+    content: "Table of Contents";
+    display: block;
+    font-size: large;
+    font-weight: bold;
+    margin-bottom: 1em;
+  }
+}
+
+/* firefox 48 */
+code {
+  word-wrap: break-word;
+}
+
+body { font-family:serif; }
 .toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
 h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
 p { text-align:justify; }
diff -r 2b9689daf902 doc/mutt.xsl
--- a/doc/mutt.xsl      Mon Sep 05 12:44:15 2016 -0700
+++ b/doc/mutt.xsl      Tue Sep 06 01:13:58 2016 +0300
@@ -7,7 +7,9 @@
   <xsl:template name="user.head.content">
     <xsl:element name="style">
       <xsl:attribute name="type">text/css</xsl:attribute>
-      &css;
+      <xsl:text disable-output-escaping="yes">
+       &css;
+      </xsl:text>
     </xsl:element>
   </xsl:template>
   <xsl:param name="admon.style"/>

Reply via email to