emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exporting to single LaTeX file and multiple HTML files
@ 2010-04-22 14:32 Ulf Stegemann
  2010-04-22 15:17 ` Sebastian Rose
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ulf Stegemann @ 2010-04-22 14:32 UTC (permalink / raw)
  To: emacs-orgmode

I'm wondering what's the best way to export a single org file to a
/single/ LaTeX file but also to /multiple/ HTML files. Think of lengthy
manuals and things like that where such a strategy may be sensible. What
came to my mind were include commands or publishing functions that
post-process the export but this seems all rather cumbersome. Has anyone
a better idea?

Ulf

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

* Re: Exporting to single LaTeX file and multiple HTML files
  2010-04-22 14:32 Exporting to single LaTeX file and multiple HTML files Ulf Stegemann
@ 2010-04-22 15:17 ` Sebastian Rose
  2010-04-22 15:44   ` Ulf Stegemann
  2010-05-07 18:55 ` David Maus
  2010-05-07 19:25 ` Eric Schulte
  2 siblings, 1 reply; 6+ messages in thread
From: Sebastian Rose @ 2010-04-22 15:17 UTC (permalink / raw)
  To: Ulf Stegemann; +Cc: emacs-orgmode

Ulf Stegemann <ulf-news@zeitform.de> writes:
> I'm wondering what's the best way to export a single org file to a
> /single/ LaTeX file but also to /multiple/ HTML files. Think of lengthy
> manuals and things like that where such a strategy may be sensible. What
> came to my mind were include commands or publishing functions that
> post-process the export but this seems all rather cumbersome. Has anyone
> a better idea?


 - http://orgmode.org/worg/code/org-info-js/
 - pdftohtml

??

  Sebastian

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

* Re: Exporting to single LaTeX file and multiple HTML files
  2010-04-22 15:17 ` Sebastian Rose
@ 2010-04-22 15:44   ` Ulf Stegemann
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Stegemann @ 2010-04-22 15:44 UTC (permalink / raw)
  To: emacs-orgmode

Hi Sebastian,

Sebastian Rose <sebastian_rose@gmx.de> wrote:

> Ulf Stegemann <ulf-news@zeitform.de> writes:
>> I'm wondering what's the best way to export a single org file to a
>> /single/ LaTeX file but also to /multiple/ HTML files. Think of lengthy
>> manuals and things like that where such a strategy may be sensible. What
>> came to my mind were include commands or publishing functions that
>> post-process the export but this seems all rather cumbersome. Has anyone
>> a better idea?
>
>  - http://orgmode.org/worg/code/org-info-js/

yes, this is a nice one but sometimes separate files are really needed.

>  - pdftohtml

Ah, a clever one, too ;)
Sure, it's possible to create a PDF and convert it to HTML later on but
this still seems a bit cumbersome and I'm not quite sure about the
reliability of the tool. When I used it last (some time ago) it
desperately failed on some PDFs.

Originally, I thought I could somehow achieve some sort of `split'
behaviour (e.g. like in texi2html) where you can specify to create a
separate file on export for every first (second, third ...) level
headline. But that's probably a bit tricky.

Ulf

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

* Re: Exporting to single LaTeX file and multiple HTML files
  2010-04-22 14:32 Exporting to single LaTeX file and multiple HTML files Ulf Stegemann
  2010-04-22 15:17 ` Sebastian Rose
@ 2010-05-07 18:55 ` David Maus
  2010-05-10  8:21   ` Ulf Stegemann
  2010-05-07 19:25 ` Eric Schulte
  2 siblings, 1 reply; 6+ messages in thread
From: David Maus @ 2010-05-07 18:55 UTC (permalink / raw)
  To: Ulf Stegemann; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2592 bytes --]

Ulf Stegemann wrote:
>I'm wondering what's the best way to export a single org file to a
>/single/ LaTeX file but also to /multiple/ HTML files. Think of lengthy
>manuals and things like that where such a strategy may be sensible. What
>came to my mind were include commands or publishing functions that
>post-process the export but this seems all rather cumbersome. Has anyone
>a better idea?

The function below could be a starting point of a more general
functionality: It takes a file and splits copys all headlines with a
certain level to a separate output file.

The more general functionality I am thinking of would be: Create
multiple output files for one or more input files that contain
headlines that match a certain criteria.

E.g.: Create output file "TODO.org" with all headlines with todo
keyword TODO or put all files with the tag "tag" into a output file
"tag.org" etc.

Things to consider:

  - escape sequences for output file names
    ("%number" -> counter, "%tag" -> tag etc.)

  - functions to move headline from here to there
    (copy, cut, cut and insert link)

  - maybe provide template for the output file's in file options
    (e.g. #+TITLE etc.)

For the splitting-by-level there is one caveat: The numbering of the
headlines is lost.

Definitively something that should be cooked up a little more.

,----
| (defun org-split-file (file level outfmt)
|   "Split FILE into multiple files.
| FILE is Org file to split.
| LEVEL is outline level of headlines.
| OUTFMT is a template for output files."
|   (let ((visiting (find-buffer-visiting file))
|         (cnt 1)
|         cand hl out)
|     (with-current-buffer (or visiting (find-file-noselect file))
|       (save-excursion
|         (save-restriction
|           (setq cand (org-map-entries 'point
|                                       (format "LEVEL=%s" level)
|                                       'file))
|           (while (setq hl (pop cand))
|             (goto-char hl)
|             (setq out (concat
|                        (org-replace-escapes outfmt
|                                             `(("%n" . ,(format "%s" cnt))))
|                        ".org"))
|             (org-copy-subtree)
|             (with-current-buffer (find-file-noselect out)
|               (erase-buffer)
|               (org-paste-subtree level)
|               (save-buffer))
|             (kill-buffer (find-buffer-visiting out))
|             (setq cnt (1+ cnt))
|             (print out)))))))
`----

HTH
 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Exporting to single LaTeX file and multiple HTML files
  2010-04-22 14:32 Exporting to single LaTeX file and multiple HTML files Ulf Stegemann
  2010-04-22 15:17 ` Sebastian Rose
  2010-05-07 18:55 ` David Maus
@ 2010-05-07 19:25 ` Eric Schulte
  2 siblings, 0 replies; 6+ messages in thread
From: Eric Schulte @ 2010-05-07 19:25 UTC (permalink / raw)
  To: Ulf Stegemann; +Cc: emacs-orgmode

Possibly one of these...
- http://eschulte.github.com/babel-dev/publish.html
- http://orgmode.org/worg/org-tutorials/org-jekyll.php

Ulf Stegemann <ulf-news@zeitform.de> writes:

> I'm wondering what's the best way to export a single org file to a
> /single/ LaTeX file but also to /multiple/ HTML files. Think of lengthy
> manuals and things like that where such a strategy may be sensible. What
> came to my mind were include commands or publishing functions that
> post-process the export but this seems all rather cumbersome. Has anyone
> a better idea?
>
> Ulf
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Exporting to single LaTeX file and multiple HTML files
  2010-05-07 18:55 ` David Maus
@ 2010-05-10  8:21   ` Ulf Stegemann
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Stegemann @ 2010-05-10  8:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi David, Eric, all,

David Maus <dmaus@ictsoc.de> wrote:

> The function below could be a starting point of a more general
> functionality: It takes a file and splits copys all headlines with a
> certain level to a separate output file.

Eric Schulte <schulte.eric@gmail.com> wrote:

> Possibly one of these...
> - http://eschulte.github.com/babel-dev/publish.html
> - http://orgmode.org/worg/org-tutorials/org-jekyll.php

thank you both for the pointers, they all look interesting and I'll have
a closer look at it soon.

Originally, I've asked the question because of a forthcoming project
with a rather large documentation where I'd like to advocate org as
documentation system. However, since the whole thing has been postponed,
the matter is less pressing.

Nevertheless, I think that having a functionality to split files on
export would be a nice improvement of org mode. If I would really need
this some day, I'd probably write something to achieve it but certainly
not in elisp as it would take me far too long due to lack of skill. I'd
rather go for a ruby, perl or even shell script for post-processing the
export.

However, such post-processing would certainly not be the very best
solution, an implementation in elisp would be much better.

Regarding the split criteria, I'd say that splitting by section level is
probably the most common case, although keeping track of the section
numbering may pose a problem as David has already mentioned. Splitting
by tag may be also useful. Ideally, section level or tag could be
defined as export option.

As said, the topic has been currently put on hold for me, but I'd
nevertheless appreciate any hints and pointers regarding it.

Ulf

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

end of thread, other threads:[~2010-05-10  8:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-22 14:32 Exporting to single LaTeX file and multiple HTML files Ulf Stegemann
2010-04-22 15:17 ` Sebastian Rose
2010-04-22 15:44   ` Ulf Stegemann
2010-05-07 18:55 ` David Maus
2010-05-10  8:21   ` Ulf Stegemann
2010-05-07 19:25 ` Eric Schulte

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