Skip to content

Commit

Permalink
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
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 27 deletions.
5 changes: 4 additions & 1 deletion .gitignore
@@ -1,6 +1,9 @@

## automatically generated files ## automatically generated files
.Rhistory .Rhistory
blue.png blue.png
*.html *.html
*.pdf *.pdf

## ignore jekyll files
_posts
_site
3 changes: 3 additions & 0 deletions _config.yml
@@ -0,0 +1,3 @@
auto: false
server: false
permalink: none
38 changes: 20 additions & 18 deletions development.org
@@ -1,14 +1,15 @@
#+TITLE: org-babel --- facilitating communication between programming languages and people #+TITLE: org-babel --- facilitating communication between programming languages and people
#+SEQ_TODO: PROPOSED TODO STARTED | DONE DEFERRED REJECTED #+TODO: PROPOSED(p!) TODO(t!) STARTED(s!) | DONE(d!) DEFERRED(f!) REJECTED(r!)
#+OPTIONS: H:3 num:nil toc:1 \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc #+OPTIONS: H:3 num:nil toc:1 \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:nil LaTeX:nil skip:nil d:(HIDE) tags:not-in-toc
#+STARTUP: oddeven hideblocks #+STARTUP: oddeven hideblocks


* Tasks [55/98] * Tasks [55/98]
** DONE indent noweb references to the level of the initial ref ** DONE indent noweb references to the level of the initial ref
- State "DONE" from "DONE" [2009-12-22 Tue 12:50]
augment `org-babel-expand-noweb-references' so that it rigidly indents augment `org-babel-expand-noweb-references' so that it rigidly indents
the body of the block to the depth of the original noweb reference. the body of the block to the depth of the original noweb reference.


#+begin_quote Sébastien #+begin_example
In fact, a better specification is: copy whatever (any character) is in front In fact, a better specification is: copy whatever (any character) is in front
of `<<<code here>>>' in front of every line of the referenced block (same of `<<<code here>>>' in front of every line of the referenced block (same
amount of characters, be it spaces or something else). amount of characters, be it spaces or something else).
Expand All @@ -32,33 +33,34 @@ Currently, the first line of the "condition" block is commented, the others
not, resulting in incorrect code being tangled. not, resulting in incorrect code being tangled.


With the above "spec", I guess all cases are covered. What do you think? With the above "spec", I guess all cases are covered. What do you think?
#+end_quote #+end_example


** PROPOSED :width and :height set dimensions in latex output? ** PROPOSED :width and :height set dimensions in latex output?
- State "PROPOSED" from "" [2009-12-22 Tue 12:39]
See email thread started by Graham Smith 12 Dec. See email thread started by Graham Smith 12 Dec.


Should we be setting ATTR_LaTeX in this situation? Should we be setting ATTR_LaTeX in this situation?


#+begin_src org #+begin_example
,#+options toc:nil ,#+options toc:nil
,#+title: R latex graphics ,#+title: R latex graphics
,
,Text before figure. Text before figure.
,#+CAPTION: Trial boxplots with babel ,#+CAPTION: Trial boxplots with babel
,#+LABEL: fig:trial boxplots ,#+LABEL: fig:trial boxplots
,#+ATTR_LaTeX: width=5cm ,#+ATTR_LaTeX: width=5cm
,#+srcname:Boxplots Summary ,#+srcname:Boxplots Summary
,#+begin_src R :session BirdData :file BoxplotSummary.pdf :exports both ,#+begin_src R :session BirdData :file BoxplotSummary.pdf :exports both
, Wingcrd <- rnorm(100, 20) ; Tarsus <- rnorm(100, 5) ; Wingcrd <- rnorm(100, 20) ; Tarsus <- rnorm(100, 5) ;
, Head <- rnorm(100, 3) ; Wt <- rnorm(100, 40) Head <- rnorm(100, 3) ; Wt <- rnorm(100, 40)
, boxplot(Wingcrd,Tarsus,Head,Wt,names=c("Wingcrd","Tarsus","Head","Wt")) boxplot(Wingcrd,Tarsus,Head,Wt,names=c("Wingcrd","Tarsus","Head","Wt"))
,#+end_src ,#+end_src


,#+results: Boxplots ,#+results: Boxplots
,[[file:BoxplotSummary.pdf]] [[file:BoxplotSummary.pdf]]


,Text after figure. Text after figure.
#+end_src #+end_example


** PROPOSED Make some org-babel commands available from edit buffer? ** PROPOSED Make some org-babel commands available from edit buffer?
I'm not sure about this, but it's often occurred to me that it I'm not sure about this, but it's often occurred to me that it
Expand Down Expand Up @@ -86,21 +88,22 @@ With the above "spec", I guess all cases are covered. What do you think?
What would a general org-babel mechanism for remote sessions be? What would a general org-babel mechanism for remote sessions be?


** TODO byte-compile elisp on tangle ** TODO byte-compile elisp on tangle
- State "TODO" from "PROPOSED" [2009-12-22 Tue 12:50]
from mailing list from mailing list


#+begin_quote #+begin_example
1) When the org configuration file aren't changed, a way to automatically load 1) When the org configuration file aren't changed, a way to automatically load
their tangled version (bytecompiled ?) in order to improve the initialization their tangled version (bytecompiled ?) in order to improve the initialization
time of Emacs. time of Emacs.
#+end_quote #+end_example


- are there times when this wouldn't be desirable? - are there times when this wouldn't be desirable?
- maybe this should be controlled by *another* header argument - maybe this should be controlled by *another* header argument


also we need to address some =:tangle= header argument related bugs in also we need to address some =:tangle= header argument related bugs in
`org-babel-load-file' `org-babel-load-file'


#+begin_quote #+begin_example
2) If I include a source code block without a :tangle argument, then the .el file is truncated in odd 2) If I include a source code block without a :tangle argument, then the .el file is truncated in odd
ways. For instance, if the last source code block doesn't have a tangle argument but all the source code ways. For instance, if the last source code block doesn't have a tangle argument but all the source code
blocks above it have either :tangle yes or :tangle no, then the .el file only contains the tangled source blocks above it have either :tangle yes or :tangle no, then the .el file only contains the tangled source
Expand All @@ -110,7 +113,7 @@ I've had other permutations of 2)
where only source code blocks after a :tangle no source code block get tangled. where only source code blocks after a :tangle no source code block get tangled.


If all of the source code blocks have :tangle arguments, then all seems to be well. If all of the source code blocks have :tangle arguments, then all seems to be well.
#+end_quote #+end_example


** TODO documentation odds and ends ** TODO documentation odds and ends
this is just a place to hold random notes for items that should make this is just a place to hold random notes for items that should make
Expand Down Expand Up @@ -5657,4 +5660,3 @@ var
#+resname: hello-clojure-output #+resname: hello-clojure-output
: hello clojure : hello clojure



19 changes: 11 additions & 8 deletions index.org
Expand Up @@ -27,11 +27,14 @@ to the github development repo.
- the Org-babel functional test suite, which is implemented as a large - the Org-babel functional test suite, which is implemented as a large
table and is run using Org-babel's spreadsheet functionality. table and is run using Org-babel's spreadsheet functionality.


** In the pipeline ** Recent Activity
Support for Clojure has recently been contributed, and support for #+begin_html
[[http://www.mozart-oz.org/][Oz]] is being planned. <ul>

{% for post in site.posts limit:5 %}
** Requirements Documentation <li>
The original requirements documentation is available at [{{ post.date | date_to_string }}] <a href=".{{ post.url }}">{{ post.title }}</a>
[[file:requirements.org][requirements]]. Because the project has evolved since this </li>
documentation was written, it is here mainly for historical reasons. {% endfor %}
</ul>
#+end_html

78 changes: 78 additions & 0 deletions publish.org
@@ -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



0 comments on commit cd25c37

Please sign in to comment.