From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Zeller Subject: Re: Include mechanism for web publishing Date: Tue, 28 Jul 2009 17:38:22 -0700 Message-ID: <87hbwwgw75.fsf@zeller.michaelzeller.com> References: <1248818656-sup-1415@elly> 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 1MVxCc-0003Df-QL for emacs-orgmode@gnu.org; Tue, 28 Jul 2009 20:39:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MVxCX-0003DJ-Bx for emacs-orgmode@gnu.org; Tue, 28 Jul 2009 20:39:29 -0400 Received: from [199.232.76.173] (port=36142 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MVxCX-0003DG-6d for emacs-orgmode@gnu.org; Tue, 28 Jul 2009 20:39:25 -0400 Received: from wa-out-1112.google.com ([209.85.146.176]:32068) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MVxCW-0003kh-Lt for emacs-orgmode@gnu.org; Tue, 28 Jul 2009 20:39:24 -0400 Received: by wa-out-1112.google.com with SMTP id n7so63296wag.26 for ; Tue, 28 Jul 2009 17:39:23 -0700 (PDT) In-Reply-To: <1248818656-sup-1415@elly> (Israel Herraiz's message of "Wed, 29 Jul 2009 00:38:04 +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: Israel Herraiz Cc: emacs-orgmode@gnu.org Israel Herraiz writes: > Hi all, > > I use org-mode for web publishing. My web contains four pages that > share a common (HTML) header, with some links to the different > sections of the web and other stuff. > > At some point, I decided to include a common raw HTML in every > page. This raw HTML is Javascript stuff for visits counting using > Google Analytics. > > That file is included in every page right after the title, using > #+INCLUDE header/header.org. > > Everything was working fine when I had just links, but now that I have > included the #+BEGIN_HTML stuff, it is escaped when exporting > everything to HTML, and instead of my raw HTML in the output files I > get a line starting by ",#+BEGIN..." (properly written and escaped in > HTML; notice the initial comma). I had the exact same issue last night, and oddly enough, it used to work in 6.21b, which is what comes with CVS emacs! Anyways, here is what I changed so that you can do an #+INCLUDE header/header.org org to include as raw Org. Personally, I'd like the default to be Org, but I see why it was changed. diff --git a/doc/org.texi b/doc/org.texi index e28b185..43cd2ab 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -8262,13 +8262,15 @@ include your @file{.emacs} file, you could use: @end example @noindent The optional second and third parameter are the markup (@samp{quote}, -@samp{example}, or @samp{src}), and, if the markup is @samp{src}, the -language for formatting the contents. The markup is optional, if it is not -given, the text will be assumed to be in Org mode format and will be -processed normally. The include line will also allow additional keyword -parameters @code{:prefix1} and @code{:prefix} to specify prefixes for the -first line and for each following line, as well as any options accepted by -the selected markup. For example, to include a file as an item, use +@samp{example}, @samp{org}, or @samp{src}), and, if the markup is @samp{src}, +the language for formatting the contents. If the markup is @samp{org}, the +text will be assumed to be in Org mode format and will be processed +normally. The markup is optional, if it is not given, the text will be +included as is and any Org markup will be escaped. The include line will +also allow additional keyword parameters @code{:prefix1} and @code{:prefix} +to specify prefixes for the first line and for each following line, as well +as any options accepted by the selected markup. For example, to include a +file as an item, use @example #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " " diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 280b1f4..83f9b74 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2085,13 +2085,14 @@ TYPE must be a string, any of: (not (file-readable-p file))) (insert (format "CANNOT INCLUDE FILE %s" file)) (when markup - (if (equal (downcase markup) "src") - (setq start (format "#+begin_src %s %s\n" - (or lang "fundamental") - (or switches "")) - end "#+end_src") - (setq start (format "#+begin_%s %s\n" markup switches) - end (format "#+end_%s" markup)))) - (cond ((equal (downcase markup) "src") - (setq start (format "#+begin_src %s %s\n" - (or lang "fundamental") - (or switches "")) - end "#+end_src")) - ((equal (downcase markup) "org") nil) - (t (setq start (format "#+begin_%s %s\n" markup switches) - end (format "#+end_%s" markup))))) (insert (or start "")) (insert (org-get-file-contents (expand-file-name file) prefix prefix1 markup)) (or (bolp) (newline)) I hope that helps! ~Michael Zeller