campaign: Update the video of the day to Hernani.
[gnupg-doc.git] / web / share / gpgweb.el
index d992d55..e350294 100644 (file)
@@ -33,7 +33,7 @@
 
    (aput 'org-publish-project-alist "gpgweb-other"
    `(:base-directory ,gpgweb-root-dir
 
    (aput 'org-publish-project-alist "gpgweb-other"
    `(:base-directory ,gpgweb-root-dir
-     :base-extension "jpg\\|png\\|css\\|txt\\|rss\\|lst\\|sig"
+     :base-extension "jpg\\|png\\|css\\|txt\\|rss\\|lst\\|sig\\|js\\|map\\|eot\\|ttf\\|woff\\|woff2\\|svg"
      :recursive t
      :publishing-directory ,gpgweb-stage-dir
      :publishing-function org-publish-attachment
      :recursive t
      :publishing-directory ,gpgweb-stage-dir
      :publishing-function org-publish-attachment
                                  'noerror)))))
 
 
                                  'noerror)))))
 
 
-(defun gpgweb-insert-header (title committed-at)
+(defun gpgweb-insert-header (title committed-at custom)
   "Insert the header.
 
 COMMITTED-AT is the commit date string of the source file or nil
   "Insert the header.
 
 COMMITTED-AT is the commit date string of the source file or nil
-if not available."
+if not available.  If CUSTOM is true only a minimal header is set."
   (goto-char (point-min))
   (insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>
 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
   (goto-char (point-min))
   (insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>
 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
@@ -69,7 +69,8 @@ if not available."
 <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">
 <head>
 <title>" title "</title>
 <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">
 <head>
 <title>" title "</title>
-<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n")
+<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />
+")
   (when (and committed-at (>= (length committed-at) 10))
       (insert "<meta name=\"DC.Date\" content=\""
               (substring committed-at 0 10) "\" />\n"))
   (when (and committed-at (>= (length committed-at) 10))
       (insert "<meta name=\"DC.Date\" content=\""
               (substring committed-at 0 10) "\" />\n"))
@@ -81,10 +82,13 @@ if not available."
 <meta name=\"DC.Publisher\" content=\"The GnuPG Project\" />
 <meta name=\"DC.Identifier\" content=\"https://gnupg.org/\" />
 <meta name=\"DC.Rights\" content=\"https://gnupg.org/copying.html\" />
 <meta name=\"DC.Publisher\" content=\"The GnuPG Project\" />
 <meta name=\"DC.Identifier\" content=\"https://gnupg.org/\" />
 <meta name=\"DC.Rights\" content=\"https://gnupg.org/copying.html\" />
-<link rel=\"stylesheet\" href=\"/share/site.css\" type=\"text/css\" />
+<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />
+")
+(unless custom
+ (insert "<link rel=\"stylesheet\" href=\"/share/site.css\" type=\"text/css\" />
 </head>
 <body>
 </head>
 <body>
-"))
+")))
 
 (defconst gpgweb-gnupg-menu-alist
   '(("/index.html"
 
 (defconst gpgweb-gnupg-menu-alist
   '(("/index.html"
@@ -333,7 +337,7 @@ string of the source file or nil if not available."
       (insert "  <div id=\"cpyright\">
     <a rel=\"license\" href=\"https://creativecommons.org/licenses/by-sa/3.0/\"
       ><img alt=\"CC-BY-SA 3.0\" style=\"border: 0\"
       (insert "  <div id=\"cpyright\">
     <a rel=\"license\" href=\"https://creativecommons.org/licenses/by-sa/3.0/\"
       ><img alt=\"CC-BY-SA 3.0\" style=\"border: 0\"
-            src=\"/share/cc-by-sa-3.0_80x15.png\"/></a>&nbsp;
+            src=\"/share/cc-by-sa_80x15.png\"/></a>&nbsp;
     These web pages are
     Copyright 1998--2017 The GnuPG Project and licensed under a
     <a rel=\"license\" href=\"https://creativecommons.org/licenses/by-sa/3.0/\"
     These web pages are
     Copyright 1998--2017 The GnuPG Project and licensed under a
     <a rel=\"license\" href=\"https://creativecommons.org/licenses/by-sa/3.0/\"
@@ -375,6 +379,17 @@ buffer into read-write mode so that it works with read-only files."
         title)))))
 
 
         title)))))
 
 
+(defun gpgweb-want-custom-page-p ()
+  "Return true if the current buffer indicated that it wants to
+be a custom page."
+  (let ((savepoint (point))
+        (result))
+    (goto-char (point-min))
+    (setq result (not (not (search-forward "<!--custom-page-->" nil t))))
+    (goto-char savepoint)
+    result))
+
+
 (defun gpgweb-postprocess-html (plist orgfile htmlfile blogmode)
   "Post-process the generated HTML file
 
 (defun gpgweb-postprocess-html (plist orgfile htmlfile blogmode)
   "Post-process the generated HTML file
 
@@ -396,15 +411,19 @@ to create the previous and Next links for an entry."
                    (fname-2 (replace-regexp-in-string
                              ".*/gnupg-doc-stage/web/\\(.*\\)$" "\\1"
                              htmlfile t))
                    (fname-2 (replace-regexp-in-string
                              ".*/gnupg-doc-stage/web/\\(.*\\)$" "\\1"
                              htmlfile t))
-                   (title (gpgweb-publish-find-title orgfile)))
+                   (title (gpgweb-publish-find-title orgfile))
+                   (custom (gpgweb-want-custom-page-p)))
                ;; Insert header, menu, and footer.
                ;; Insert header, menu, and footer.
-               (gpgweb-insert-header title committed-at)
-               (gpgweb-insert-menu fname-2)
-               (if blogmode
-                   (gpgweb-fixup-blog plist
-                                      (file-name-nondirectory orgfile)
-                                      blogmode))
-               (gpgweb-insert-footer fname-2 committed-at blogmode)
+               (gpgweb-insert-header title committed-at custom)
+               (unless custom
+                 (goto-char (point-min))
+                 (unless (search-forward "<!--disable-menu-->" nil t)
+                   (gpgweb-insert-menu fname-2))
+                 (if blogmode
+                     (gpgweb-fixup-blog plist
+                                        (file-name-nondirectory orgfile)
+                                        blogmode))
+                 (gpgweb-insert-footer fname-2 committed-at blogmode))
 
                ; Fixup the sitemap
                (when (string-equal fname "sitemap.html")
 
                ; Fixup the sitemap
                (when (string-equal fname "sitemap.html")