guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: doc: Make the HTML language menu disappear on nar


From: guix-commits
Subject: branch master updated: doc: Make the HTML language menu disappear on narrow screens.
Date: Wed, 19 Jan 2022 09:45:20 -0500

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new fa580bf3b4 doc: Make the HTML language menu disappear on narrow 
screens.
fa580bf3b4 is described below

commit fa580bf3b456273ebbbba20b3f4de1afdac3d031
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Jan 19 15:41:59 2022 +0100

    doc: Make the HTML language menu disappear on narrow screens.
    
    * doc/build.scm (stylized-html)[build](navigation-bar): New procedure.
    (stylized-html): Use it.
---
 doc/build.scm | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/doc/build.scm b/doc/build.scm
index 44c185e5f9..c2d2d3939f 100644
--- a/doc/build.scm
+++ b/doc/build.scm
@@ -650,6 +650,23 @@ in SOURCE."
                         (href ,url))
                       ,label)))
 
+            (define* (navigation-bar menus #:key split-node?)
+              ;; Return the navigation bar showing all of MENUS.
+              `(header (@ (class "navbar"))
+                       (h1 (a (@ (class "branding")
+                                 (href ,(if split-node? ".." "#")))))
+                       (nav (@ (class "navbar-menu"))
+                            (input (@ (class "navbar-menu-hidden-input")
+                                      (type "radio")
+                                      (name "dropdown")
+                                      (id "all-dropdowns-hidden")))
+                            (ul ,@menus))
+
+                       ;; This is the button that shows up on small screen in
+                       ;; lieu of the drop-down button.
+                       (a (@ (class "navbar-menu-btn")
+                             (href ,(if split-node? "../.." ".."))))))
+
             (define* (base-language-url code manual
                                         #:key split-node?)
               ;; Return the base URL of MANUAL for language CODE.
@@ -682,6 +699,9 @@ in SOURCE."
             (define (stylized-html sxml file)
               ;; Return SXML, which was read from FILE, with additional
               ;; styling.
+              (define split-node?
+                (string-contains file "/html_node/"))
+
               (let loop ((sxml sxml))
                 (match sxml
                   (('*TOP* decl body ...)
@@ -695,15 +715,16 @@ in SOURCE."
                                    (href #$manual-css-url)))))
                   (('body ('@ attributes ...) elements ...)
                    `(body (@ ,@attributes)
-                          (nav (@ (class "navbar-menu"))
-                               (ul
-                                ;; TODO: Add "Contribute" menu, to report
-                                ;; errors, etc.
-                                ,(menu-dropdown #:label
-                                                `(img (@ (alt "Language")
-                                                         (src 
"/static/base/img/language-picker.svg")))
-                                                #:items
-                                                (language-menu-items file))))
+                          ,(navigation-bar
+                            ;; TODO: Add "Contribute" menu, to report
+                            ;; errors, etc.
+                            (list (menu-dropdown
+                                   #:label
+                                   `(img (@ (alt "Language")
+                                            (src 
"/static/base/img/language-picker.svg")))
+                                   #:items
+                                   (language-menu-items file)))
+                            #:split-node? split-node?)
                           ,@elements))
                   ((tag ('@ attributes ...) body ...)
                    `(,tag (@ ,@attributes) ,@(map loop body)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]