2019-07-08 21:16:48 +00:00
|
|
|
#+TITLE: Welcome!
|
2019-07-07 16:11:45 +00:00
|
|
|
#+DATE: 2019-07-04
|
2019-07-05 15:09:14 +00:00
|
|
|
#+KEYWORDS: programming
|
2019-07-08 21:16:48 +00:00
|
|
|
#+AUTHOR: Yann Esposito
|
|
|
|
#+EMAIL: yann.esposito@gmail.com
|
2019-07-05 15:09:14 +00:00
|
|
|
#+DESCRIPTION:
|
|
|
|
#+LANGUAGE: en
|
|
|
|
#+LANG: en
|
2019-07-09 12:03:32 +00:00
|
|
|
#+OPTIONS: H:5
|
2019-07-08 21:16:48 +00:00
|
|
|
|
|
|
|
This is a new take on my personal blog.
|
|
|
|
With a lot more minimalism in mind.
|
|
|
|
|
2019-07-09 12:03:32 +00:00
|
|
|
I know light is more usual, but I prefer to use a dark background as it will
|
|
|
|
tend to consume slightly less energy for some screen technologies.
|
|
|
|
|
2019-07-08 21:16:48 +00:00
|
|
|
With [[http://orgmode.org][org-mode]]
|
|
|
|
|
|
|
|
* Code magic :noexport:
|
2019-07-05 15:09:14 +00:00
|
|
|
#+begin_src elisp :results none
|
2019-07-07 16:11:45 +00:00
|
|
|
(require 'org)
|
|
|
|
(require 'ox-publish)
|
|
|
|
(require 'ox-html)
|
|
|
|
(require 'org-element)
|
|
|
|
(require 'ox-rss)
|
|
|
|
|
|
|
|
(defun org-blog-prepare (project-plist)
|
|
|
|
"With help from `https://github.com/howardabrams/dot-files'.
|
2019-07-07 21:39:18 +00:00
|
|
|
Touch `index.org' to rebuilt it.
|
|
|
|
Argument `PROJECT-PLIST' contains information about the current project."
|
2019-07-07 16:11:45 +00:00
|
|
|
(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)
|
2019-07-07 21:39:18 +00:00
|
|
|
(save-buffer 0))))
|
2019-07-07 16:11:45 +00:00
|
|
|
|
|
|
|
(defvar org-blog-head
|
2019-07-07 21:39:18 +00:00
|
|
|
(concat
|
|
|
|
"<link rel=\"stylesheet\" type=\"text/css\" href=\"/assets/css/minimalist.css\"/>"
|
|
|
|
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
|
|
|
|
"<link rel=\"alternative\" type=\"application/rss+xml\" title=\"Subscribe to articles\" href=\"/archives.xml\" />"
|
|
|
|
"<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/favicon.ico\">"))
|
2019-07-07 16:11:45 +00:00
|
|
|
|
2019-07-08 21:16:48 +00:00
|
|
|
(defun org-blog-preamble (info)
|
2019-07-07 16:11:45 +00:00
|
|
|
"Pre-amble for whole blog."
|
2019-07-08 21:16:48 +00:00
|
|
|
(concat
|
|
|
|
"<strong><code>Her.esy.fun"
|
|
|
|
(when-let ((date (get-from-info info :date)))
|
|
|
|
(format " - <span class=\"article-date\">%s</span>" date))
|
|
|
|
"</code></strong>"))
|
2019-07-07 16:11:45 +00:00
|
|
|
|
|
|
|
(defun menu ()
|
|
|
|
"Blog menu"
|
2019-07-07 21:39:18 +00:00
|
|
|
(concat
|
|
|
|
"<navigation>"
|
|
|
|
"<a href=\"/\">Home</a>"
|
|
|
|
"<a href=\"/archive.html\">Posts</a>"
|
|
|
|
"</navigation>"))
|
2019-07-07 16:11:45 +00:00
|
|
|
|
|
|
|
(defun get-from-info (info k)
|
|
|
|
(let ((i (car (plist-get info k))))
|
|
|
|
(when (and i (stringp i))
|
|
|
|
i)))
|
|
|
|
|
|
|
|
(defun org-blog-postamble (info)
|
|
|
|
"Post-amble for whole blog."
|
|
|
|
(concat "<footer>"
|
|
|
|
(when-let ((author (get-from-info info :author)))
|
|
|
|
(if-let ((email (plist-get info :email)))
|
2019-07-08 21:16:48 +00:00
|
|
|
(format "<div class=\"author\">Author: <a href=\"mailto:%s\">%s</a></div>" email author)
|
|
|
|
(format "<div class=\"author\">Author: %s</div>" author)))
|
2019-07-07 16:11:45 +00:00
|
|
|
(when-let ((date (get-from-info info :date)))
|
2019-07-08 21:16:48 +00:00
|
|
|
(format "<div class=\"date\">Created: %s</div>" date))
|
2019-07-07 21:39:18 +00:00
|
|
|
(when-let ((keywords (plist-get info :keywords)))
|
2019-07-08 21:16:48 +00:00
|
|
|
(format "<div class=\"keywords\">Keywords: <code>%s</code></div>" keywords))
|
|
|
|
(format "<div class=\"date\">Generated: %s</div>"
|
2019-07-07 21:39:18 +00:00
|
|
|
(format-time-string "%Y-%m-%d %H:%M:%S"))
|
2019-07-08 21:16:48 +00:00
|
|
|
(format (concat "<div class=\"creator\"> Generated with "
|
2019-07-07 16:11:45 +00:00
|
|
|
"<a href=\"https://www.gnu.org/software/emacs/\" target=\"_blank\" rel=\"noopener noreferrer\">Emacs %s</a>, "
|
|
|
|
"<a href=\"http://spacemacs.org\" target=\"_blank\" rel=\"noopener noreferrer\">Spacemacs %s</a>, "
|
2019-07-08 21:16:48 +00:00
|
|
|
"<a href=\"http://orgmode.org\" target=\"_blank\" rel=\"noopener noreferrer\">Org Mode %s</a>"
|
|
|
|
"</div>")
|
2019-07-07 16:11:45 +00:00
|
|
|
emacs-version spacemacs-version org-version)
|
2019-07-07 21:39:18 +00:00
|
|
|
"</footer>"
|
|
|
|
"<hr/>"
|
|
|
|
(menu)))
|
2019-07-07 16:11:45 +00:00
|
|
|
|
|
|
|
(defun org-blog-sitemap-format-entry (entry _style project)
|
|
|
|
"Return string for each ENTRY in PROJECT."
|
|
|
|
(when (s-starts-with-p "posts/" entry)
|
2019-07-07 21:39:18 +00:00
|
|
|
(format "@@html:<span class=\"archive-item\"><span class=\"archive-date\">@@ %s: @@html:</span>@@ [[file:%s][%s]] @@html:</span>@@"
|
|
|
|
(format-time-string "%Y-%m-%d"
|
2019-07-07 16:11:45 +00:00
|
|
|
(org-publish-find-date entry project))
|
|
|
|
entry
|
|
|
|
(org-publish-find-title entry project))))
|
|
|
|
|
|
|
|
(defun org-blog-sitemap-function (title list)
|
|
|
|
"Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
|
2019-07-07 21:39:18 +00:00
|
|
|
(concat "#+TITLE: " title "\n"
|
|
|
|
"#+AUTHOR: Yann Esposito\n"
|
|
|
|
"#+EMAIL: yann.esposito@gmail.com\n"
|
2019-07-07 16:11:45 +00:00
|
|
|
"\n#+begin_archive\n"
|
|
|
|
(mapconcat (lambda (li)
|
|
|
|
(format "@@html:<li>@@ %s @@html:</li>@@" (car li)))
|
|
|
|
(seq-filter #'car (cdr list))
|
|
|
|
"\n")
|
|
|
|
"\n#+end_archive\n"))
|
|
|
|
|
|
|
|
(setq base-dir (concat (projectile-project-root) "src"))
|
|
|
|
(setq publish-dir (concat (projectile-project-root) "_site"))
|
|
|
|
(setq assets-dir (concat base-dir "/assets"))
|
|
|
|
(setq publish-assets-dir (concat publish-dir "/assets"))
|
|
|
|
(setq rss-dir base-dir)
|
|
|
|
(setq publish-rss-dir publish-dir)
|
|
|
|
(setq domainname "https://her.esy.fun")
|
|
|
|
(setq org-publish-project-alist
|
|
|
|
`(("orgfiles"
|
|
|
|
:base-directory ,base-dir
|
|
|
|
:exclude ".*drafts/.*"
|
|
|
|
:base-extension "org"
|
|
|
|
|
|
|
|
:publishing-directory ,publish-dir
|
|
|
|
|
|
|
|
:recursive t
|
|
|
|
:preparation-function org-blog-prepare
|
|
|
|
:publishing-function org-html-publish-to-html
|
|
|
|
|
|
|
|
:with-toc nil
|
|
|
|
:with-title t
|
|
|
|
:with-date t
|
|
|
|
:section-numbers nil
|
|
|
|
:html-doctype "html5"
|
|
|
|
:html-html5-fancy t
|
|
|
|
:html-head-include-default-style nil
|
|
|
|
:html-head-include-scripts nil
|
|
|
|
:htmlized-source t
|
|
|
|
:html-head-extra ,org-blog-head
|
|
|
|
:html-preamble org-blog-preamble
|
|
|
|
:html-postamble org-blog-postamble
|
|
|
|
|
|
|
|
:auto-sitemap t
|
|
|
|
:sitemap-filename "archive.org"
|
|
|
|
:sitemap-title "Blog Posts"
|
|
|
|
:sitemap-style list
|
|
|
|
:sitemap-sort-files anti-chronologically
|
|
|
|
:sitemap-format-entry org-blog-sitemap-format-entry
|
|
|
|
:sitemap-function org-blog-sitemap-function)
|
|
|
|
|
|
|
|
("assets"
|
|
|
|
:base-directory ,assets-dir
|
|
|
|
:base-extension ".*"
|
|
|
|
:publishing-directory ,publish-assets-dir
|
|
|
|
:publishing-function org-publish-attachment
|
|
|
|
:recursive t)
|
|
|
|
|
|
|
|
("rss"
|
|
|
|
:base-directory ,rss-dir
|
|
|
|
:base-extension "org"
|
|
|
|
:html-link-home ,domainname
|
|
|
|
:html-link-use-abs-url t
|
|
|
|
:rss-extension "xml"
|
|
|
|
:publishing-directory ,publish-rss-dir
|
|
|
|
:publishing-function (org-rss-publish-to-rss)
|
|
|
|
:exclude ".*"
|
|
|
|
:include ("archive.org")
|
|
|
|
:section-numbers nil
|
|
|
|
:table-of-contents nil)
|
|
|
|
|
|
|
|
("blog" :components ("orgfiles" "assets" "rss"))))
|
|
|
|
|
|
|
|
;; add target=_blank and rel="noopener noreferrer" to all links by default
|
2019-07-06 15:18:13 +00:00
|
|
|
(defun my-org-export-add-target-blank-to-http-links (text backend info)
|
|
|
|
"Add target=\"_blank\" to external links."
|
|
|
|
(when (and
|
|
|
|
(org-export-derived-backend-p backend 'html)
|
|
|
|
(string-match "href=\"http[^\"]+" text)
|
|
|
|
(not (string-match "target=\"" text))
|
|
|
|
(not (string-match (concat "href=\"" domainname "[^\"]*") text)))
|
|
|
|
(string-match "<a " text)
|
|
|
|
(replace-match "<a target=\"_blank\" rel=\"noopener noreferrer\" " nil nil text)))
|
|
|
|
|
|
|
|
(add-to-list 'org-export-filter-link-functions
|
|
|
|
'my-org-export-add-target-blank-to-http-links)
|
|
|
|
|
2019-07-05 15:09:14 +00:00
|
|
|
#+end_src
|
|
|
|
|
2019-07-08 21:16:48 +00:00
|
|
|
* Template Testing
|
2019-07-05 15:09:14 +00:00
|
|
|
|
2019-07-08 21:16:48 +00:00
|
|
|
Text can be *bold*, /italic/, +strikethrough+ or =keyword=.
|
2019-07-05 15:09:14 +00:00
|
|
|
|
2019-07-08 21:16:48 +00:00
|
|
|
[[/index.html][Link to another page]].
|
2019-07-05 15:09:14 +00:00
|
|
|
|
2019-07-08 21:16:48 +00:00
|
|
|
There should be whitespace between paragraphs.
|
|
|
|
|
2019-07-09 12:03:32 +00:00
|
|
|
** Level 2
|
|
|
|
|
|
|
|
There should be whitespace between paragraphs.
|
|
|
|
GitHub is a code hosting platform for version control and collaboration.
|
|
|
|
It lets you and others work together on projects from anywhere.
|
|
|
|
|
|
|
|
*** Level 3
|
|
|
|
|
|
|
|
#+begin_quote
|
|
|
|
This is a blockquote folling a header.
|
|
|
|
|
|
|
|
When something is important enough, you do it even if the odds are not in your
|
|
|
|
favor.
|
|
|
|
#+end_quote
|
|
|
|
|
|
|
|
**** Level 4
|
|
|
|
|
|
|
|
#+begin_src javascript
|
|
|
|
// Javascript code with syntax highlighting.
|
|
|
|
var fun = function lang(l) {
|
|
|
|
dateformat.i18n = require('./lang/' + l)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+begin_src ruby
|
|
|
|
# Ruby code with syntax highlighting
|
|
|
|
GitHubPages::Dependencies.gems.each do |gem, version|
|
|
|
|
s.add_dependency(gem, "= #{version}")
|
|
|
|
end
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+begin_src clojure
|
|
|
|
(defn clj-fn
|
|
|
|
"A clojure function with syntax highlighting"
|
|
|
|
[arg]
|
|
|
|
(clojure.pprint/pprint arg))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+begin_src haskell
|
|
|
|
-- main hello world
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
|
|
|
putStrLn "What is your name?"
|
|
|
|
name <- getLine
|
|
|
|
putStrLn $ "Hello " <> name <> "!"
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
***** Level 5
|
|
|
|
|
|
|
|
- this is an unordered list following a header.
|
|
|
|
- this is an unordered list following a header.
|
|
|
|
- this is an unordered list following a header.
|
|
|
|
|
|
|
|
1. this is an ordered list following a header.
|
|
|
|
2. this is an ordered list following a header.
|
|
|
|
- sub unordered
|
|
|
|
- sub sub unordered
|
|
|
|
- xxx
|
|
|
|
- unordered
|
|
|
|
1. ordered again
|
|
|
|
2. yep :)
|
|
|
|
3. this is an ordered list following a header.
|
|
|
|
1. sub ordered
|
|
|
|
2. second
|
|
|
|
1. sub sub ordered
|
|
|
|
2. still
|
|
|
|
3. here
|
|
|
|
4. this is an ordered list following a header.
|
|
|
|
|
|
|
|
| head1 | head two |
|
|
|
|
|--------------+-------------------|
|
|
|
|
| ok | good swedish fish |
|
|
|
|
| out of stock | good and plenty |
|
|
|
|
| ok | good =oreos= |
|
|
|
|
| ok | good =zoute= drop |
|
|
|
|
|
|
|
|
There's a horizontal rule below this
|
|
|
|
|
|
|
|
------
|
|
|
|
|
|
|
|
*** Here is an unordered list:
|
|
|
|
|
|
|
|
- level 1 item
|
|
|
|
- level 2 item
|
|
|
|
- level 2 item
|
|
|
|
- level 2 item
|
|
|
|
- level 3 item
|
|
|
|
- level 3 item
|
|
|
|
- level 1 item
|
|
|
|
- level 2 item
|
|
|
|
- level 3 item
|
|
|
|
- level 3 item
|
|
|
|
- level 2 item
|
|
|
|
- level 2 item
|
|
|
|
- level 1 item
|
|
|
|
- level 2 item
|
|
|
|
- level 2 item
|
|
|
|
- level 2 item
|
|
|
|
|
|
|
|
***** TODO todo
|
|
|
|
****** IN-PROGRESS in-progress
|
|
|
|
******* IN-REVIEW in-review
|
|
|
|
****** HOLD on hold state
|
|
|
|
- State "HOLD" from "IN-REVIEW" [2019-07-09 Tue 13:44] \\
|
|
|
|
some reason
|
|
|
|
****** WAITING waiting status
|
|
|
|
- State "WAITING" from [2019-07-09 Tue 13:44] \\
|
|
|
|
waitin for someone
|
|
|
|
****** DONE done status
|
|
|
|
****** CANCELED canceled status
|
|
|
|
CLOSED: [2019-07-09 Tue 13:45]
|
|
|
|
- State "CANCELED" from [2019-07-09 Tue 13:45] \\
|
|
|
|
cancel reason
|