emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Obscure Bug with HTML Export if Directory Starts with an Underscore
@ 2009-12-02 11:44 Ian Barton
  2009-12-16 23:17 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Barton @ 2009-12-02 11:44 UTC (permalink / raw)
  To: Org Mode List

As part of my attempt to get org to play nicely with Jekyll, I think I 
have found a problem with html export.

My org directory structure looks like:

org|

------|mountaineering
------|cycling
------|_posts

Basically org files for blog posts go into posts. My org files look like:

#+STARTUP: showall indent
#+STARTUP: hidestars
#+OPTIONS: H:2 num:nil tags:nil toc:1 timestamps:t
#+BEGIN_HTML
---
layout: post
title: ADSL Connection Problems.
tags: [gadgets, linux, test]
excerpt: Problems, problems!
---
#+END_HTML
Main text of post goes here.

I am just exporting the body text (see below for my config). Carsten 
recently updated org to remove leading line feeds at the top of the 
exported file. So my exported file looks like:

---
layout: post
title: ADSL Connection Problems.
tags: [gadgets, linux, test]
excerpt: Problems, problems!
---

However, if the directory the file is exported from starts with an 
underscore e.g. _posts, The exporter removes the first ---. I have a 
workaround - put two lines with --- at the top of the file.


I am using the current git checkout of org. My project a list looks like:

(setq org-publish-project-alist
       '(

   ("org-ianbarton"
           ;; Path to your org files.
           :base-directory "~/devel/ianbarton/org/"
           :base-extension "org"

           ;; Path to your Jekyll project.
           :publishing-directory "~/devel/ianbarton/jekyll/"
           :recursive t
           :publishing-function org-publish-org-to-html
           :headline-levels 4
           :html-extension "html"
           :body-only t ;; Only export section between <body> </body>
     )


     ("org-static-ian"
           :base-directory "~/devel/ianbarton/org/"
           :base-extension 
"css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|php"
           :publishing-directory "~/devel/ianbarton/"
           :recursive t
           :publishing-function org-publish-attachment)

     ("ian" :components ("org-ianbarton" "org-static-ian"))

))

Ian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Obscure Bug with HTML Export if Directory Starts with an Underscore
  2009-12-02 11:44 Obscure Bug with HTML Export if Directory Starts with an Underscore Ian Barton
@ 2009-12-16 23:17 ` Carsten Dominik
  2009-12-17  8:30   ` Ian Barton
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2009-12-16 23:17 UTC (permalink / raw)
  To: lists; +Cc: Org Mode List

Hi Ian,

thank you for your report.

This has nothing to do with the directory starting with an underscore.
What is happening here is that Org-mode uses the first line in the  
buffer,
"-----" in your case as the title of the document since no other title
is defined.  Of course, the body-only export then discards the "title",
and you end up without your first line.

You could fix this with a dummy #+TITLE: line, or by putting anything  
at all
in a earlier line, even above #+STARTUP, or by setting the :title option
in your publishing setup.

Another way would be

------------------------------------------------------------------------
#+STARTUP: showall indent
#+STARTUP: hidestars
#+OPTIONS: H:2 num:nil tags:nil toc:1 timestamps:t
#+TITLE: ADSL Connection Problems.
#+BEGIN_HTML
---
layout: post
title: {{{title}}}
tags: [gadgets, linux, test]
excerpt: Problems, problems!
---
#+END_HTML
Main text of post goes here.
------------------------------------------------------------------------

i.e using the {{{title}}} macro to insert the title into the right
place while having #+TITLE around to stop Org from grabbing
the first line.

One could also question if it makes sense to grab the title from
the buffer if body-only is set, and I have now changed it so
that in this case it will *not* take the title from buffer text.

Hope something here will help you - these are murky waters.

- Carsten


On Dec 2, 2009, at 12:44 PM, Ian Barton wrote:

> As part of my attempt to get org to play nicely with Jekyll, I think  
> I have found a problem with html export.
>
> My org directory structure looks like:
>
> org|
>
> ------|mountaineering
> ------|cycling
> ------|_posts
>
> Basically org files for blog posts go into posts. My org files look  
> like:
>
> #+STARTUP: showall indent
> #+STARTUP: hidestars
> #+OPTIONS: H:2 num:nil tags:nil toc:1 timestamps:t
> #+BEGIN_HTML
> ---
> layout: post
> title: ADSL Connection Problems.
> tags: [gadgets, linux, test]
> excerpt: Problems, problems!
> ---
> #+END_HTML
> Main text of post goes here.
>
> I am just exporting the body text (see below for my config). Carsten  
> recently updated org to remove leading line feeds at the top of the  
> exported file. So my exported file looks like:
>
> ---
> layout: post
> title: ADSL Connection Problems.
> tags: [gadgets, linux, test]
> excerpt: Problems, problems!
> ---
>
> However, if the directory the file is exported from starts with an  
> underscore e.g. _posts, The exporter removes the first ---. I have a  
> workaround - put two lines with --- at the top of the file.
>
>
> I am using the current git checkout of org. My project a list looks  
> like:
>
> (setq org-publish-project-alist
>      '(
>
>  ("org-ianbarton"
>          ;; Path to your org files.
>          :base-directory "~/devel/ianbarton/org/"
>          :base-extension "org"
>
>          ;; Path to your Jekyll project.
>          :publishing-directory "~/devel/ianbarton/jekyll/"
>          :recursive t
>          :publishing-function org-publish-org-to-html
>          :headline-levels 4
>          :html-extension "html"
>          :body-only t ;; Only export section between <body> </body>
>    )
>
>
>    ("org-static-ian"
>          :base-directory "~/devel/ianbarton/org/"
>          :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\| 
> ogg\\|swf\\|php"
>          :publishing-directory "~/devel/ianbarton/"
>          :recursive t
>          :publishing-function org-publish-attachment)
>
>    ("ian" :components ("org-ianbarton" "org-static-ian"))
>
> ))
>
> Ian.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Obscure Bug with HTML Export if Directory Starts with an Underscore
  2009-12-16 23:17 ` Carsten Dominik
@ 2009-12-17  8:30   ` Ian Barton
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Barton @ 2009-12-17  8:30 UTC (permalink / raw)
  To: Org Mode List

Carsten Dominik wrote:
> Hi Ian,
> 
> thank you for your report.
> 
> This has nothing to do with the directory starting with an underscore.
> What is happening here is that Org-mode uses the first line in the buffer,
> "-----" in your case as the title of the document since no other title
> is defined.  Of course, the body-only export then discards the "title",
> and you end up without your first line.
> 
> You could fix this with a dummy #+TITLE: line, or by putting anything at 
> all
> in a earlier line, even above #+STARTUP, or by setting the :title option
> in your publishing setup.
> 
> Another way would be
> 
> ------------------------------------------------------------------------
> #+STARTUP: showall indent
> #+STARTUP: hidestars
> #+OPTIONS: H:2 num:nil tags:nil toc:1 timestamps:t
> #+TITLE: ADSL Connection Problems.
> #+BEGIN_HTML
> ---
> layout: post
> title: {{{title}}}
> tags: [gadgets, linux, test]
> excerpt: Problems, problems!
> ---
> #+END_HTML
> Main text of post goes here.
> ------------------------------------------------------------------------
> 
> i.e using the {{{title}}} macro to insert the title into the right
> place while having #+TITLE around to stop Org from grabbing
> the first line.
> 
> One could also question if it makes sense to grab the title from
> the buffer if body-only is set, and I have now changed it so
> that in this case it will *not* take the title from buffer text.
> 
Thanks for the explanation and list of fixes.

> Hope something here will help you - these are murky waters.
> 
It's a good job that you have X-ray vision:)

Ian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-17  8:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-02 11:44 Obscure Bug with HTML Export if Directory Starts with an Underscore Ian Barton
2009-12-16 23:17 ` Carsten Dominik
2009-12-17  8:30   ` Ian Barton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).