From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: Exporting to single LaTeX file and multiple HTML files Date: Fri, 07 May 2010 20:55:44 +0200 Message-ID: <87hbmjwngv.wl%dmaus@ictsoc.de> References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============0515078857==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OASvb-0002IQ-Bd for emacs-orgmode@gnu.org; Fri, 07 May 2010 15:09:39 -0400 Received: from [140.186.70.92] (port=36635 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OASvW-0000mY-89 for emacs-orgmode@gnu.org; Fri, 07 May 2010 15:09:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OASib-0002J2-8n for emacs-orgmode@gnu.org; Fri, 07 May 2010 14:56:17 -0400 Received: from mysql1.xlhost.de ([213.202.242.106]:34857) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OASia-0002IV-W2 for emacs-orgmode@gnu.org; Fri, 07 May 2010 14:56:13 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ulf Stegemann Cc: emacs-orgmode@gnu.org --===============0515078857== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Fri_May__7_20:55:43_2010-1"; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Fri_May__7_20:55:43_2010-1 Content-Type: text/plain; charset=US-ASCII 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 --pgp-sign-Multipart_Fri_May__7_20:55:43_2010-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAkvkYi8ACgkQma24O1pEeOaf+QEAtgBv2UJO0iGCcIn8UoBtTb4q cYz1btDoXOfHMkWQLR4A/iTk09eO4jSOQVC6A1dA0EWogQKjwgqDAUWtrcmh5mDt =zjyQ -----END PGP SIGNATURE----- --pgp-sign-Multipart_Fri_May__7_20:55:43_2010-1-- --===============0515078857== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0515078857==--