From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: publish regression: body-only (with patch) Date: Sun, 24 May 2009 16:05:37 -0700 Message-ID: References: <8763fq1m45.fsf@gmail.com> <87r5yeywta.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M8MlG-0002Od-IO for emacs-orgmode@gnu.org; Sun, 24 May 2009 19:05:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M8MlC-0002JA-3n for emacs-orgmode@gnu.org; Sun, 24 May 2009 19:05:46 -0400 Received: from [199.232.76.173] (port=33831 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M8MlB-0002J1-Un for emacs-orgmode@gnu.org; Sun, 24 May 2009 19:05:41 -0400 Received: from mail-px0-f179.google.com ([209.85.216.179]:64102) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M8MlB-0007x0-Cs for emacs-orgmode@gnu.org; Sun, 24 May 2009 19:05:41 -0400 Received: by pxi9 with SMTP id 9so3152924pxi.14 for ; Sun, 24 May 2009 16:05:40 -0700 (PDT) In-Reply-To: <87r5yeywta.fsf@gmail.com> (Richard KLINDA's message of "Mon, 25 May 2009 00:12:49 +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: Richard KLINDA Cc: emacs-orgmode@gnu.org Richard KLINDA writes: >>>>>> Regarding 'Re: [Orgmode] publish regression: body-only (with patch)'; Carsten Dominik adds: > > > > Hi Richard, this feature has never existed as something usable from > > publishing. Can you provide a realistic case when something like > > this would be useful? > > Oh, then my patch did not make it into org back then.:) I am going to > use org just to render the "content" part of my site, the menus, comment > section, tag cloud, interlinking (by date, topic etc) will be generated > by a CMS. > > As I think about it, it seems fairly trivial just to rip out the > (...) part of the generated HTML, so I'm ready to accept if > you don't want this into org. I also find the need to extract just the body portion of exported html pages. This is done in blorgit[1], if you don't mind using ruby for your extraction the following may prove useful (extracts body optionally including the title and postamble). #+begin_src ruby def to_html(h_path, options = {}) html = File.read(h_path) return html if options[:full_html] # extract the body portion start_body = (html =~ //) + 6 end_body = (html =~ /<\/body>/) - 1 body = html[(start_body..end_body)] body = options[:postamble] ? body : body[(0..(body.index("
") - 1))] options[:title] ? body : body.sub(//i,'') end #+end_src Cheers -- Eric [1] http://orgmode.org/worg/blorgit.php