From mboxrd@z Thu Jan 1 00:00:00 1970 From: flammable project Subject: How to automatic list org files via Elisp and then, import them for an HTML export Date: Fri, 26 Oct 2012 15:09:33 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d044786f3edb1d404ccf60790 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRjfT-0000Ir-Jx for emacs-orgmode@gnu.org; Fri, 26 Oct 2012 09:09:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRjfL-0005B1-0l for emacs-orgmode@gnu.org; Fri, 26 Oct 2012 09:09:43 -0400 Received: from mail-ie0-f169.google.com ([209.85.223.169]:34973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRjfK-0005Al-Q5 for emacs-orgmode@gnu.org; Fri, 26 Oct 2012 09:09:34 -0400 Received: by mail-ie0-f169.google.com with SMTP id 10so4659316ied.0 for ; Fri, 26 Oct 2012 06:09:34 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --f46d044786f3edb1d404ccf60790 Content-Type: text/plain; charset=ISO-8859-1 Hi All, Since I use Orgmode 7.9.2, I tri to do this: - parsing a directory in which several Org files are located. Basically, each files is a blog post. So one org file pear day. - import or include them in a main ORG file (index.org) - export the main Org file to HTML to create a website. To be more clear, this is the directory structure I build. /website/ ########+- index.org ########| ########+/blog-posts/ ####################+ 2012_10_12.org ####################+ 2012_10_09.org Here is a typical "post" org file: 8<-----------------------------------CUT HERE *Post title blala c'est la crise.... 8<----------------------------------- CUT HERE Here is the index.org 8<-----------------------------------CUT HERE #+SETUPFILE: ../templates/level-0.org #+INCLUDE: ../templates/level-0.org #+TITLE: Home #+OPTIONS: toc:nil H:3 num:nil # <> * Home Welcome in ...................... ....... ....... * Latest Articles 1 #+BEGIN_SRC emacs-lisp :exports results (let ((default-directory "~/path/to/the/directory/posts/")) (file-expand-wildcards "?org")) #+END_SRC #+BEGIN_SRC emacs-lisp :exports results (directory-files "~/path/to/the/directory/posts/" nil "\\.org\\'") #+END_SRC * Latest Articles 2 ** Test 1 #+INCLUDE: "./posts/2012_10_12.org" #+INCLUDE: "./posts/2012_10_09.org" ** Test 2 #+INCLUDE: "./posts/2012_10_12.org" :minlevel 2 #+INCLUDE: "./posts/2012_10_09.org" :minlevel 2 ** Test 3 #+INCLUDE: "./posts/2012_10_12.org" :prefix1 "* " #+INCLUDE: "./posts/2012_10_09.org" :prefix1 "* " * Latest Articles 3 #+BEGIN_EXAMPLE #+INCLUDE ~/Dropbox/Private/The_Flammable_project/wx-fp/posts/2012_10_09.org #+END_EXAMPLE * Latest Articles 4 #+BEGIN_SRC :exports results :results output cat ./posts/2012_10_12.org #+END_SRC 8<----------------------------------- CUT HERE Here is the status of my trial after doing "org-publish-project": - Latest trials 1 : this elisp code parses the right directory but I don't know how to import the result the elisp function and them use "#+INCLUDE:" them as org files. If someone can help me on that? I really like to do what I want with elisp, more powerfull solution. - Latest trials 2 : the "#+INCLUDE" command includes the content of each files but in the 3 sub-tests the hierarchy is completely meesed up, like this "* Latest Articles 2" "** 2012_10_12 Post title " " blablabla from post 2012_10_12.org file" "*** 2012_10_09 Post tile" " blabla from post 2012_10_09.org file" the second "included" files is put under another level of hierarchy even if the command ":minlevel X" or ":prefix1" are used. Gentleman's any suggestion? - Latest Articles 3 & 4 : Not working at all..... Here we are! The HTML export is working very well. So it's not a problem of export. If someone can help me to do this I will really appreciate! Thanks --f46d044786f3edb1d404ccf60790 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi All,

Since I use O= rgmode 7.9.2, I tri to do this:
- parsing a directory in which several Org files are located. B= asically, each files is a blog post. So one org file pear day.
- import or include them in a main ORG file (index.org)
- export the main Org fil= e to HTML to create a website.

To be more clear, this is the dire= ctory structure I build.
/website/
########+- index.org
########|
########+/blog-posts/<= /div>
####################+ 2012_10= _12.org
####################+ 2012_10_09.org
=A0 =A0 =A0 =A0=A0
Here is a typical &q= uot;post" org file:

8<-----------------------------= ------CUT HERE
*Post title=A0

blala c'est la crise....

8<-----------------------------= ------ CUT HERE

Here is the index.org=A0
8<-----------------------------------CUT HERE
#+SETUPFILE: ../templates/lev= el-0.org
#+INCLUDE: ../templates/level-0.= org

#+TITLE: Home

<= /div>
#+OPTIONS: toc:nil H:3 num:nil

# <<home>>
* Home
Welcome in .....................= .
.......
.......

*=A0Latest=A0Articl= es 1=A0

<= /div>
#+BEGIN_SRC emacs-lisp :exp= orts results
(let ((default-directory "~= /path/to/the/directory/posts/"))
=A0 =A0 (file-expand-wildcards "?org"))<= /div>
#+END_SRC

#+BEGIN_SRC emacs-lisp :exports results
= (directory-files "~/path/to/the/director= y/posts/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0nil =A0 =A0 =A0 =A0
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"\\.org\\'")
#+END_SRC


*=A0Latest=A0Articles 2
** Test 1
=
#+INCLUDE: "./posts/2012_10_12.org"
#+INCLUDE: "./posts/2012_10_09.org"
=

** Test 2

#+INCLUDE: "./posts/2012_10_12.org" :minlevel 2
#+INCLUDE: "./posts/2012_10_09.org" :minlevel 2

** Test 3

#+INCLUDE: "./posts/20= 12_10_12.org" :prefix1 "* "
#+INCLUDE: "./posts/2012_10_09.org" :prefix1 "* "=

*=A0Latest=A0Articles 3

#+BEGIN_EXAMPLE
#+INCLUDE ~/Dropbox/Pri= vate/The_Flammable_project/wx-fp/posts/20= 12_10_09.org
#+END_EXAMPLE
<= font face=3D"courier new, monospace">
*=A0Latest=A0Art= icles 4=A0

#+BEGIN_SRC =A0:exports results :results output=
cat ./posts/2012_10_12.org
#+END_SRC

8<-------------------------------= ---- CUT HERE

Here is the status of my tri= al after doing "org-publish-project":

- Latest trials 1 : this elisp cod= e parses the right directory but I don't know how to import the result = the elisp function and =A0them use "#+INCLUDE:" them as org files= . If someone can help me on that? I really like to do what I want with elis= p, more powerfull solution.

- Latest trials 2 : the "#+IN= CLUDE" command includes the content of each files but in the 3 sub-tes= ts the hierarchy is completely meesed up, like this
"* Latest Articles 2"<= /font>
"** 2012_10_12 Post = title "
" blablabla=A0from post 2012_10_12.org= file&qu= ot;
"*** 2012_10_09 Post tile&q= uot;
" blabla from post 2012_10_09.org file"

the second= "included" files is put under another level of hierarchy even if= the command ":minlevel X" or ":prefix1" are used.
Gentleman's=A0any suggestion= ?

<= div>- Latest Articles 3 & 4 : Not= working at all.....

Here we are! The HTML export is working very well. So it's not= a problem of export.=A0
If someone can help me to do thi= s I will really appreciate!

Thanks= =A0


--f46d044786f3edb1d404ccf60790--