renard / o-blog

Standalone orgmode blog exporter. DEPECATED, NOT MAINTAINED
http://renard.github.com/o-blog-v2
260 stars 58 forks source link

INCLUDING Blog Posts #52

Closed geekinthesticks closed 4 years ago

geekinthesticks commented 12 years ago

I want to port my Jekyll powered bog to o-blog. I have a lot of posts, one file for post. I would like to avoid placing them in one big file, as I think it would probably end up growing too big to be manageable.

I was hoping to INCLUDE each file:

+INCLUDE: "./posts/2012-09-06-sea-to-summit-xmug.org"

File contains:

\ DONE Sea to Summit X-Mug. :o@blog: CLOSED: [2012-10-18 Thu]

I managed to crack my plastic mug and was about to buy another one when I decided to investigate the alternatives. I don't like metal mugs of any sort. I end up burning my finger and lips whenever I use

However, it appears that the TODO header doesn't get processed. If I do it like this in the sample.org file:

\ DONE Sea to Summit X-Mug. :o@blog: CLOSED: [2012-10-18 Thu]

+INCLUDE: "./posts/2012-09-06-sea-to-summit-xmug.org"

Where the include just contains the body text it works. I guess I can live with having all the headers and just including the body text, but is it possible to get o-blog to process the DONE section in an included file?

renard commented 12 years ago

Currently the #+include: file does not work. But writing a piece of code to include the raw content of file could be easily done.

A quick look shows up the org-export-expand-include-keyword would help.

I leave the post open since I won't be available for a couple of weeks.

renard commented 12 years ago

Can you please try to apply that patch:

diff --git a/o-blog.el b/o-blog.el
index 54eebcb..6791e61 100644
--- a/o-blog.el
+++ b/o-blog.el
@@ -664,6 +664,7 @@ headers and body."
        (insert text)
        (goto-char (point-min))
        (org-mode)
+       (org-export-expand-include-keyword)
        (while (<= 2 (save-match-data (funcall outline-level)))
          (org-promote-subtree))
        (run-hooks 'o-blog-html-plugins-hook)
geekinthesticks commented 12 years ago

Thanks that doesn't work. I have had a look at org-exp.el and it looks as though using org-export-handle-include-files should work, but it doesn't. My elisp skills are very basic, so I am not sure why it isn't working.

renard commented 12 years ago

Ok I do not have any free time this week. I would be able to have a look at beginning of November to fix this.

Cheers.

geekinthesticks commented 12 years ago

Thank you, meanwhile I'll see if I can fix it myself.

geekinthesticks commented 12 years ago

A bit of progress - the following:

(defun org-publish-blog-sync (file) "Publish FILE synchronously." (with-current-buffer (or (get-file-buffer file) (find-file file)) (org-export-handle-include-files)

(run-hooks 'o-blog-before-publish-hook)

does correctly include all INCLUDE files, but the full included text ends up in sample.org. I guess I need to try and modify it so it creates a temp file, with all the inclusions then uses the temp file for the export.

tonyday567 commented 11 years ago

Any progress? I have asked the question in the org mailing list about this. It doesn't feel like the intended behaviour.

Message copy/pasted below:

In the current buffer, org-export-handle-include-file overwrites:

+INCLUDE: "./some-other-file.org"

with contents of the other file. For example,

+BEGIN_EXAMPLE

Contents of the other file.

+END_EXAMPLE

Is this the intended behaviour? Is there a method where you can use #+INCLUDE without overwriting the current buffer?

tony

ifree commented 11 years ago

Can this solve in o-blog v2 ?

renard commented 11 years ago

The aim of V2 is to allow user to organize their files as they want. Thus this might be possible. For the moment V2 is in a big early stage.

jave commented 9 years ago

isnt this fixed now? I use #INCLUDE all the time!