From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Olson Subject: Re: convert region to html? Date: Sat, 19 May 2007 22:27:35 -0400 Message-ID: <87odkgmdpk.fsf@hariken.mwolson.org> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1371458829==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HpbmV-0000TJ-0a for emacs-orgmode@gnu.org; Sat, 19 May 2007 23:08:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HpbmT-0000Sj-BN for emacs-orgmode@gnu.org; Sat, 19 May 2007 23:08:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HpbmT-0000Sg-3m for emacs-orgmode@gnu.org; Sat, 19 May 2007 23:08:25 -0400 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HpbmS-00031i-GW for emacs-orgmode@gnu.org; Sat, 19 May 2007 23:08:24 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HpbmO-0001b0-EV for emacs-orgmode@gnu.org; Sun, 20 May 2007 05:08:20 +0200 Received: from jpi-wlafyte-212-116.dmisinetworks.net ([66.253.212.116]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 20 May 2007 05:08:20 +0200 Received: from mwolson by jpi-wlafyte-212-116.dmisinetworks.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 20 May 2007 05:08:20 +0200 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: emacs-orgmode@gnu.org --===============1371458829== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable David O'Toole writes: > I am working on my blog extension for org-publish. I would like to > convert a region of text (say, between two markers) from org-mode > markup into html and then paste the resulting html into another buffer > where I am building a full page. I need to do this from a lisp > program. It says that org-export-as-html will export an active region > but I tried it and it doesn't work in a temp-buffer where > (buffer-file-name) is nil. Anyway, would it be hard to expose a > function like the following? > > (defun org-export-region-to-html (beg end) > "Convert region between BEG and END into HTML, placing the result > into a new buffer. The new buffer is returned." > ... > ... I did something similar for Muse recently. I'm including the code snippet in case it comes in handy. ;;;###autoload (defun muse-publish-region (beg end &optional title style) "Apply the given STYLE's markup rules to the given region. The result is placed in a new buffer that includes TITLE in its name." (interactive "r") (when (interactive-p) (unless title (setq title (read-string "Title: "))) (unless style (setq style (muse-publish-get-style)))) (let ((muse-publishing-current-style style) (muse-publishing-p t) (text (buffer-substring beg end)) (buf (generate-new-buffer (concat "*Muse: " title "*")))) (with-current-buffer buf (insert text) (muse-publish-markup-buffer title style) (goto-char (point-min)) (let ((inhibit-read-only t)) (remove-text-properties (point-min) (point-max) '(rear-nonsticky nil read-only nil)))) (pop-to-buffer buf))) =2D-=20 Michael Olson -- FSF Associate Member #652 | http://mwolson.org/ -- Jabber: mwolson_at_hcoop.net | /` |\ | | | Sysadmin -- Hobbies: Lisp, GP2X, HCoop | |_] | \| |_| Projects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner | --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGT7Ia+1Ho2POo0xkRAkz1AJ42Bw2FJ6tddiPHLiXinGxQI11Z0gCfaO3C ETO7WL+nKmChRG9vFuIYxQ0= =W9fH -----END PGP SIGNATURE----- --=-=-=-- --===============1371458829== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1371458829==--