#+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline author:t c:nil
#+OPTIONS: creator:nil d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t
#+OPTIONS: num:nil p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t timestamp:t
#+OPTIONS: title:t toc:nil todo:t |:t
#+TITLE: Configuration
#+DATE: <2016-12-06 Tue>
#+AUTHOR: Julien Chastang
#+EMAIL: julien dot c dot chastang at gmail
#+LANGUAGE: en
#+SELECT_TAGS: export
#+EXCLUDE_TAGS: noexport
#+CREATOR: Emacs 25.1.2 (Org mode 8.3.6)

#+SETUPFILE: ../templates/level-0.org
#+INCLUDE: ../templates/level-0.org

#+PROPERTY: header-args :noweb no

This website heavily borrows from the work of Kunal Bhalla and can be found on github here and here. 

* Org Export Set up (Internal Only)                                :noexport:

# org-mode stuff. Don't want confirmation for babel exec, nor should babel block be evaluated during export.

#+BEGIN_SRC emacs-lisp :results silent :exports none 
  (setq org-confirm-babel-evaluate nil)
  (setq org-export-babel-evaluate nil)
#+END_SRC

* Imports
#+BEGIN_SRC emacs-lisp :results none
  (require 'ob-css)
  (require 'ox-publish)
#+END_SRC

* Style
#+NAME: style
#+BEGIN_SRC css :results none
  body {
    color: #111;
    font-family: 'Gentium Book Basic', serif;
    font-size: 16px;
    line-height: 24px;
    margin: 0 auto;
    max-width: 672px;
    padding: 0 32px;
  }

  a:link,
  a:visited {
    background-color: #eee;
    border-bottom: solid #333 1px;
    color: #111;
    padding: 0 .2em;
    text-decoration: none;
  }

  a:hover {
    background-color: #333;
    color: #eee;
  }

  a:active {
    border-bottom: solid #f00 1px;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: 'helvetica neue', 'arial', sans-serif;
    font-weight: normal;
    line-height: 1.2em;
  }

  h1.title {
    border-bottom: solid #d4d4d4 1px;
    padding-bottom: .2em;
    text-align: left;
  }

  .figure p {
    text-align: left;
  }

  #postamble {
    border-top: solid #d4d4d4 1px;
    color: #999;
    font-style: italic;
    text-align: right;
    margin-top: 1em;
  }

  #postamble a.source-link:link,
  #postamble a.source-link:visited {
    color: #000;
    float: left;
    font-family: monospace;
    font-style: normal;
    text-transform: lowercase;
  }

  #postamble a.source-link:hover,
  #postamble a.source-link:active {
    background-color: #000;
    color: #fff;
  }

  #postamble a:link, #postamble a:visited {
    background-color: transparent;
    border-bottom: none;
    color: #999;
  }

  #postamble a:hover {
    background-color: #777;
    color: #fff;
  }

  #postamble a:active {
   border-bottom: solid 1px #f00;
  }

  code {
    background-color: #eee;
    border-top: solid #d4d4d4 1px;
    border-bottom: solid #d4d4d4 1px;
    padding: 0 .2em;
  }

  pre.src, pre.example {
    background-color: #eee;
    border-top: solid #d4d4d4 1px;
    border-bottom: solid #d4d4d4 1px;
    border-left: none;
    border-right: none;
    box-shadow: none;
    font-size: 14px;
    line-height: 20px;
    padding: 1em;
    margin: 0;
    overflow: auto;
    max-width: 100%;
  }

  pre.src:before {
    background-color: transparent;
    border: none;
    top: 0;
    right: 0;
  }

  sup {
    line-height: 0;
  }

  hr {
    border-top: solid 1px #d4d4d4;
    border-bottom: none;
  }

  li p {
    margin: 0;
  }

  .footpara {
    margin: 0;
  }

  .footnotes {
    margin-top: 1em;
  }

  table, td, th {
    border: 1px solid black;
  } 
#+END_SRC

* Header
#+NAME: header
#+BEGIN_SRC css :results none
  <link href='https://fonts.googleapis.com/css?family=Gentium+Book+Basic:400,400i,700' rel='stylesheet' />
  <style type='text/css'>
    <<style>>
  </style>
#+END_SRC

* Publishing configuration
#+BEGIN_SRC emacs-lisp :results none
  (defun create-source-link (filename)
    (concat "./" (file-name-nondirectory filename) ".html"))

  (defun create-postamble (options)
    (let ((input-file (plist-get options :input-file)))
      (concat
       "<a class='source-link' href='"
       (create-source-link input-file)
       "'>Source</a>"
       "Last updated on "
       (current-time-string)
       " &bullet; <a href='http://julienchastang.com'>julienchastang.com</a>"
       " by <a href='http://julienchastang.com'>Julien Chastang</a>")))

  (defun create-project-configuration (title base-dir publishing-dir)
    `((,(concat title "-source")
       :base-directory ,base-dir
       :publishing-directory ,publishing-dir
       :base-extension "org"
       :recursive t
       :htmlized-source t
       :publishing-function org-org-publish-to-org)
      (,title
       :base-directory ,base-dir
       :publishing-directory ,publishing-dir
       :base-extension "org"
       :recursive t
       :section-numbers nil
       :publishing-function org-html-publish-to-html
       :with-author nil
       :with-toc nil
       :html-head-include-scripts nil
       :html-head-extra "
      <<header>>
              "
       :html-validation-link nil
       :html-footnotes-section "<div class=\"footnotes\" title=\"%s\">%s</div>"
       :html-postamble ,'create-postamble)))

  (setq
   org-publish-project-alist
   `(,@(create-project-configuration
        "jc-notes"
        "/home/python/work/julienchastang/src/org"
        "/home/python/work/julienchastang/publish/julienchastang.github.io/")
     ("jc-static"
      :base-directory "/home/python/work/julienchastang/src/static/"
      :publishing-directory "/home/python/work/julienchastang/publish/julienchastang.github.io/static/"
      :base-extension any
      :recursive t
      :publishing-function org-publish-attachment)
     ("jc"
      :components ("jc-notes"
                   "jc-notes-source"
                   "jc-static"))))
#+END_SRC

* Publish
#+BEGIN_SRC emacs-lisp :eval no
  (org-publish "jc" nil)
  (global-set-key
   (kbd "C-c c")
   (lambda ()
     (interactive)
     (org-babel-load-file "/home/python/work/julienchastang/src/org/configuration.org")))
  ; (org-babel-execute-buffer)
#+END_SRC