[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Need help exporting subtrees to html
From: |
Eric Schulte |
Subject: |
Re: [Orgmode] Need help exporting subtrees to html |
Date: |
Thu, 31 Dec 2009 12:51:37 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) |
Juan Reyero <address@hidden> writes:
> On Thu, Dec 31, 2009 at 6:15 PM, Eric Schulte <address@hidden> wrote:
>> Juan Reyero <address@hidden> writes:
>>
>>> On Thu, Dec 31, 2009 at 9:15 AM, Carsten Dominik
>>> <address@hidden> wrote:
>>>> On Dec 27, 2009, at 8:31 PM, Juan Reyero wrote:
>>>>> On Sun, Dec 27, 2009 at 7:35 PM, Carsten Dominik
>>>>> <address@hidden> wrote:
>>>>>> On Dec 27, 2009, at 5:34 PM, Juan Reyero wrote:
>>>>>>> I have written a function to export org-mode subtrees as jekyll posts,
>>>>>>> http://juanreyero.com/open/org-jekyll/ The idea is that any entry in
>>>>>>> an org-publish project that has a :blog: keyword and an :on: property
>>>>>>> with a timestamp should be exported to a _posts directory with the
>>>>>>> year-month-day-title.html that jekyll expects, with the properties as
>>>>>>> front-matter.
>> If it helps, I've been doing something similar to support publishing
>> updates on the org-babel development -- using the code shown here [1]
>> under the "Development Updates" section. This generates a files in
>> _posts for each subtree of of the "tasks" and "bugs" sections which have
>> a time-stamp in their properties. It should be fairly straightforward
>> to adapt this code to export all properties as YAML frontmatter.
>
> It is exactly what I did :-). I found your code here [1], and adapted
> it so that it would use files in an org-publish project and would
> export properties.
Ah, I should have read the thread more carefully :)
> So thank you very much for making it available. It does, however,
> have the same problem I find: the header level with which the piece is
> exported (h1, h2, etc) depends on the outline level on which the item
> you export happened to be. I was hoping to export the chunks
> independently of where they were written.
>
So this turned out to be somewhat tricky. I was able to adjust my
previous code so that every subtree will be promoted to a top-level
heading before export by adding the following (this change can also be
seen in my published code here [1]).
--8<---------------cut here---------------start------------->8---
(org-narrow-to-subtree)
(let ((level (- (org-outline-level) 1))
(contents (buffer-substring (point-min) (point-max))))
(dotimes (n level nil) (org-promote-subtree))
(setq html (org-export-as-html nil nil nil 'string t nil))
(set-buffer org-buffer)
(delete-region (point-min) (point-max))
(insert contents)
(save-buffer))
(widen)
--8<---------------cut here---------------end--------------->8---
Hope this helps. Cheers -- Eric
>
> I will share it with Worg as soon as I manage to make it work.
>
> Best,
>
> Juan
>
> Footnotes:
> [1] http://orgmode.org/worg/org-tutorials/org-jekyll.php (end of document).
>
>>
>> Best -- Eric
>>
>> Footnotes:
>> [1] http://eschulte.github.com/babel-dev/publish.html
>>
>>
Footnotes:
[1] http://eschulte.github.com/babel-dev/publish.html
- [Orgmode] Need help exporting subtrees to html, Juan Reyero, 2009/12/27
- Re: [Orgmode] Need help exporting subtrees to html, Carsten Dominik, 2009/12/27
- Re: [Orgmode] Need help exporting subtrees to html, Juan Reyero, 2009/12/27
- Re: [Orgmode] Need help exporting subtrees to html, Carsten Dominik, 2009/12/31
- Re: [Orgmode] Need help exporting subtrees to html, Juan Reyero, 2009/12/31
- Re: [Orgmode] Need help exporting subtrees to html, Eric Schulte, 2009/12/31
- Re: [Orgmode] Need help exporting subtrees to html, Eric Schulte, 2009/12/31
- Re: [Orgmode] Need help exporting subtrees to html, Juan Reyero, 2009/12/31
- Re: [Orgmode] Need help exporting subtrees to html,
Eric Schulte <=