emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* using first heading as <h1> in batch export to html
@ 2012-01-24 13:39 Detlef Steuer
  2012-01-24 14:57 ` Bastien
  2012-01-25 12:42 ` SOLVED " Detlef Steuer
  0 siblings, 2 replies; 4+ messages in thread
From: Detlef Steuer @ 2012-01-24 13:39 UTC (permalink / raw)
  To: emacs-orgmode

If I batch export a test.org looking like this

-- test.org --------
* heading1
  some text
--------------------

to html I get a <h1 class="title">test</h1> as result.

If I open the file and do C-c @ on the first heading the
result contains <h1 class="title">heading1</h1> 

How do I achieve the latter in batch export?

Btw: Reading the manual I get the impression the latter is what should
happen anyway? 

http://orgmode.org/manual/Document-title.html#Document-title
says
--------------------------
Document title

The title of the exported document is taken from the special line

     #+TITLE: This is the title of the document

If this line does not exist, the title is derived from the first
non-empty, non-comment line in the buffer. If no such line exists, or
if you have turned off exporting of the text before the first headline
(see below), the title will be the file name without extension.

If you are exporting only a subtree by marking is as the region, the
heading of the subtree will become the title of the document. If the
subtree has a property EXPORT_TITLE, that will take precedence. 
----------------------------

So, no TITLE here, first non-empty line is 
* heading1 , nothing was prevented from being exported. 
I would expect heading1 as title from reading this.

thx
Detlef

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

* Re: using first heading as <h1> in batch export to html
  2012-01-24 13:39 using first heading as <h1> in batch export to html Detlef Steuer
@ 2012-01-24 14:57 ` Bastien
  2012-01-24 15:12   ` Detlef Steuer
  2012-01-25 12:42 ` SOLVED " Detlef Steuer
  1 sibling, 1 reply; 4+ messages in thread
From: Bastien @ 2012-01-24 14:57 UTC (permalink / raw)
  To: Detlef Steuer; +Cc: emacs-orgmode

Hi Detlef,

Detlef Steuer <detlef.steuer@gmx.de> writes:

> -- test.org --------
> * heading1
>   some text
> --------------------
>
> to html I get a <h1 class="title">test</h1> as result.
>
> If I open the file and do C-c @ on the first heading the
> result contains <h1 class="title">heading1</h1> 
>
> How do I achieve the latter in batch export?

Please try to use 

#+OPTIONS: skip:t

and let us know what title is used in the batch export.

HTH,

-- 
 Bastien

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

* Re: using first heading as <h1> in batch export to html
  2012-01-24 14:57 ` Bastien
@ 2012-01-24 15:12   ` Detlef Steuer
  0 siblings, 0 replies; 4+ messages in thread
From: Detlef Steuer @ 2012-01-24 15:12 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bastien


Hi Bastien!

> Detlef Steuer <detlef.steuer@gmx.de> writes:
> 
> > -- test.org --------
> > * heading1
> >   some text
> > --------------------
> >
> > to html I get a <h1 class="title">test</h1> as result.
> >
> > If I open the file and do C-c @ on the first heading the
> > result contains <h1 class="title">heading1</h1> 
> >
> > How do I achieve the latter in batch export?
> 
> Please try to use 
> 
> #+OPTIONS: skip:t
> 
> and let us know what title is used in the batch export.
> 
> HTH,

No, it doesn't ...

test.org:
--------------------
#+OPTIONS: skip:t

* heading1
  some text
--------------------

Result contains:
<h1 class="title">test</h1>


Detlef

> 
> -- 
>  Bastien
> 
> 

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

* SOLVED Re: using first heading as <h1> in batch export to html
  2012-01-24 13:39 using first heading as <h1> in batch export to html Detlef Steuer
  2012-01-24 14:57 ` Bastien
@ 2012-01-25 12:42 ` Detlef Steuer
  1 sibling, 0 replies; 4+ messages in thread
From: Detlef Steuer @ 2012-01-25 12:42 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, 24 Jan 2012 14:39:55 +0100
Detlef Steuer <detlef.steuer@gmx.de> wrote:

> If I batch export a test.org looking like this
> 
> -- test.org --------
> * heading1
>   some text
> --------------------
> 
> to html I get a <h1 class="title">test</h1> as result.
> 
> If I open the file and do C-c @ on the first heading the
> result contains <h1 class="title">heading1</h1> 
> 
> How do I achieve the latter in batch export?

May be it was as obvious as it can get to anybody who has emacs-fu ...
To help others who have none, just like me, here is a solution:

To do automatically, what I did by hand before ,I wrote my first ever
elisp "program": 

org-export-with-h1-as-title.el
--------------------
(goto-line 3)              ;; I know my document. It's always line 3
(org-mark-subtree)         ;; C-c @
(org-export-as-html-batch) ;; C-c C-e h but as batch
--------------------

and  invoke emacs in my Makefile as
emacs --batch \
      -eval "(add-to-list 'load-path \"${HOME}/GIT/org-mode/lisp/\")"\
      --load ${HOME}/GIT/org-mode/lisp/org.el \
      --visit steuer.org \
      -l ./org-export-with-h1-as-title.el

Yeah. Works. Nice!

Still think the first headline should be chosen as title automatically
according to the manual?! 

Detlef

> 
> Btw: Reading the manual I get the impression the latter is what should
> happen anyway? 
> 
> http://orgmode.org/manual/Document-title.html#Document-title
> says
> --------------------------
> Document title
> 
> The title of the exported document is taken from the special line
> 
>      #+TITLE: This is the title of the document
> 
> If this line does not exist, the title is derived from the first
> non-empty, non-comment line in the buffer. If no such line exists, or
> if you have turned off exporting of the text before the first headline
> (see below), the title will be the file name without extension.
> 
> If you are exporting only a subtree by marking is as the region, the
> heading of the subtree will become the title of the document. If the
> subtree has a property EXPORT_TITLE, that will take precedence. 
> ----------------------------
> 
> So, no TITLE here, first non-empty line is 
> * heading1 , nothing was prevented from being exported. 
> I would expect heading1 as title from reading this.
> 
> thx
> Detlef
> 
> 
> 

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

end of thread, other threads:[~2012-01-25 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-24 13:39 using first heading as <h1> in batch export to html Detlef Steuer
2012-01-24 14:57 ` Bastien
2012-01-24 15:12   ` Detlef Steuer
2012-01-25 12:42 ` SOLVED " Detlef Steuer

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).