]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
configure ox-publish
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 26 Jan 2018 18:27:05 +0000 (19:27 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 26 Jan 2018 18:27:05 +0000 (19:27 +0100)
Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
bba.org

diff --git a/bba.org b/bba.org
index 6900b695da3f253946847c98f773cd2f0d0710f9..7e931d433acd483d81c56032fd670e7e5f2f52f6 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -967,6 +967,104 @@ never heard of orgmode.
     )
 #+END_SRC
 
+** ox-publish
+[2018-01-24 Wed 20:29]
+
+  #+BEGIN_SRC emacs-lisp :tangle yes
+    (require 'ox-html)
+    (require 'ox-publish)
+    (require 'ox-rss)
+    (require 'htmlize)
+  #+END_SRC
+
+#+BEGIN_SRC emacs-lisp :tangle yes
+  (setq org-mode-websrc-directory (concat (getenv "HOME") "/git/website"))
+  (setq org-mode-publishing-directory (concat (getenv "HOME") "/Sites/"))
+
+  (setq org-publish-project-alist
+        `(("all"
+           :components ("blog-content" "blog-static" "blog-rss"))
+
+          ("blog-content"
+           :base-directory       ,org-mode-websrc-directory
+           :base-extension       "org"
+           :publishing-directory ,org-mode-publishing-directory
+           :recursive            t
+           :publishing-function  org-html-publish-to-html
+  ;         :preparation-function org-mode-blog-prepare
+           :export-with-tags     nil
+           :headline-levels      4
+           :auto-preamble        t
+           :auto-postamble       nil
+           :auto-sitemap         t
+           :sitemap-title        "Bundesbrandschatzamt"
+           :section-numbers      nil
+           :table-of-contents    nil
+           :with-toc             nil
+           :with-author          nil
+           :with-creator         nil
+           :with-tags            t
+           :with-smart-quotes    t
+
+           :html-doctype         "html5"
+           :html-html5-fancy     t
+           :html-preamble        org-mode-blog-preamble
+           :html-postamble       org-mode-blog-postamble
+           :html-head  "<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
+              <link href='http://fonts.googleapis.com/css?family=Source+Serif+Pro:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
+              <link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,700' rel='stylesheet' type='text/css'>
+              <link rel=\"stylesheet\" href=\"/~baron/css/styles.css\" type=\"text/css\"/>\n"
+           :html-head-extra "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>
+              <script src=\"/~baron/js/magic.js\"></script>
+              <link rel=\"icon\" href=\"/~baron/img/dragon.svg\">
+              <link rel=\"shortcut icon\" href=\"~baron/img/dragon-head.png\">
+              <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />"
+           :html-head-include-default-style nil
+           )
+
+          ("blog-static"
+           :base-directory       ,org-mode-websrc-directory
+           :base-extension       "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|svg"
+           :publishing-directory ,org-mode-publishing-directory
+           :recursive            t
+           :publishing-function  org-publish-attachment
+           )
+
+          ("blog-rss"
+           :base-directory        ,org-mode-websrc-directory
+           :base-extension        "org"
+           :rss-image-url         "http://www.bundesbrandschatzamt.de/~baron/img/dragon-head.png"
+           :publishing-directory  ,org-mode-publishing-directory
+           :publishing-function   (org-rss-publish-to-rss)
+           :html-link-home        "http://www.bundesbrandschatzamt.de/~baron/"
+           :html-link-use-abs-url t
+           :with-toc              nil
+           :exclude               ".*"
+           :include               ("index.org"))))
+
+  (defun org-mode-blog-preamble (options)
+    "The function that creates the preamble top section for the blog.
+  OPTIONS contains the property list from the org-mode export."
+    (let ((base-directory (plist-get options :base-directory)))
+      (org-babel-with-temp-filebuffer (expand-file-name "top-bar.html" base-directory) (buffer-string))))
+
+  (defun org-mode-blog-postamble (options)
+    "The function that creates the postamble, or bottom section for the blog.
+  OPTIONS contains the property list from the org-mode export."
+    (let ((base-directory (plist-get options :base-directory)))
+      (org-babel-with-temp-filebuffer (expand-file-name "bottom.html" base-directory) (buffer-string))))
+
+  (defun org-mode-blog-prepare ()
+    "`index.org' should always be exported so touch the file before publishing."
+    (let* ((base-directory (plist-get project-plist :base-directory))
+           (buffer (find-file-noselect (expand-file-name "index.org" base-directory) t)))
+      (with-current-buffer buffer
+        (set-buffer-modified-p t)
+        (save-buffer 0))
+      (kill-buffer buffer)))
+#+END_SRC
+
+
 ** bba-ox-clip-formatted-copy
 [2016-12-13 Tue 15:29]