Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added function for automatically exporting task-updates as blog posts
see the "publication" heading of development.org. The function creates a blog post for each dated task heading -- all task heading will be automatically dated from now on. These posts are dropped into a _posts directory for use by the jekyll blogging engine which is supported on github.
- Loading branch information
Eric Schulte
committed
Dec 22, 2009
1 parent
2f02b9d
commit cd25c37
Showing
5 changed files
with
116 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,6 +1,9 @@ | |||
|
|||
## automatically generated files | ## automatically generated files | ||
.Rhistory | .Rhistory | ||
blue.png | blue.png | ||
*.html | *.html | ||
|
|||
## ignore jekyll files | |||
_posts | |||
_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
auto: false | |||
server: false | |||
permalink: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,78 @@ | |||
#+TITLE: Code for publishing Org-babel development information | |||
#+OPTIONS: num:nil ^:nil | |||
#+LaTeX_CLASS: normal | |||
|
|||
This file contains the code to export this repo for publishing on github | |||
|
|||
* Index | |||
Export the index in a manner amenable to jekyll processing | |||
#+begin_src emacs-lisp | |||
(let ((index-file (expand-file-name | |||
"index.org" | |||
(file-name-directory (buffer-file-name)))) | |||
(yaml-front-matter '(("layout" . "default") ("title" . "Development"))) | |||
html) | |||
;; go to the top level tasks heading | |||
(find-file index-file) | |||
(setq html (org-export-as-html nil nil nil 'string t nil)) | |||
(with-temp-file "index.html" | |||
(when yaml-front-matter | |||
(insert "---\n") | |||
(mapc (lambda (pair) (insert (format "%s: %s\n" (car pair) (cdr pair)))) | |||
yaml-front-matter) | |||
(insert "---\n\n")) | |||
(insert html))) | |||
#+end_src | |||
|
|||
* Development Updates | |||
This code will be used to publish posts for all TODO items which have | |||
an associated date/time | |||
#+begin_src emacs-lisp :results silent :exports code | |||
(save-excursion | |||
;; map over all tasks entries | |||
(let ((dev-file (expand-file-name | |||
"development.org" | |||
(file-name-directory (buffer-file-name)))) | |||
(posts-dir (expand-file-name | |||
"_posts" | |||
(file-name-directory (buffer-file-name)))) | |||
(yaml-front-matter '(("layout" . "default")))) | |||
;; go to the top level tasks heading | |||
(find-file dev-file) | |||
(goto-char (point-min)) | |||
(outline-next-visible-heading 1) | |||
(org-map-tree | |||
(lambda () | |||
(let* ((props (org-entry-properties)) | |||
(todo (cdr (assoc "TODO" props))) | |||
(time (cdr (assoc "TIMESTAMP_IA" props)))) | |||
;; each task with a state and timestamp can be exported as a | |||
;; jekyll blog post | |||
(when (and todo time) | |||
(message "time=%s" time) | |||
(let* ((heading (org-get-heading)) | |||
(title (replace-regexp-in-string | |||
"[:=\(\)\?]" "" | |||
(replace-regexp-in-string | |||
"[ \t]" "-" heading))) | |||
(str-time (and (string-match "\\([[:digit:]\-]+\\) " time) | |||
(match-string 1 time))) | |||
(to-file (format "%s-%s.html" str-time title)) | |||
(org-buffer (current-buffer)) | |||
(yaml-front-matter (cons (cons "title" heading) yaml-front-matter)) | |||
html) | |||
(org-narrow-to-subtree) | |||
(setq html (org-export-as-html nil nil nil 'string t nil)) | |||
(set-buffer org-buffer) (widen) | |||
(with-temp-file (expand-file-name to-file posts-dir) | |||
(when yaml-front-matter | |||
(insert "---\n") | |||
(mapc (lambda (pair) (insert (format "%s: %s\n" (car pair) (cdr pair)))) | |||
yaml-front-matter) | |||
(insert "---\n\n")) | |||
(insert html)) | |||
(get-buffer org-buffer)))))))) | |||
#+end_src | |||
|
|||
|
|||
|