From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: #+INCLUDE: myfile.html html does not include /literally/; Org processes Date: Sat, 07 Jun 2014 15:53:34 +0200 Message-ID: <87oay4ygf5.fsf@nicolasgoaziou.fr> References: <538AA6B8.40604@gmail.com> <8761kl12w9.fsf@Rainer.invalid> <87bnudf2u4.fsf@gmail.com> <87wqd1yo84.fsf@Rainer.invalid> <8738fpeyov.fsf@gmail.com> <87sinpylly.fsf@Rainer.invalid> <87r438eujq.fsf@gmail.com> <87iookzsto.fsf@Rainer.invalid> <87fvjoenlt.fsf@gmail.com> <87egz8zowa.fsf@Rainer.invalid> <87egz5pw4g.fsf@gmail.com> <87bnu5t4fj.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtH3R-0000qn-AP for emacs-orgmode@gnu.org; Sat, 07 Jun 2014 09:53:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtH3K-0007y1-2e for emacs-orgmode@gnu.org; Sat, 07 Jun 2014 09:53:05 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:57824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtH3J-0007xi-PX for emacs-orgmode@gnu.org; Sat, 07 Jun 2014 09:52:58 -0400 In-Reply-To: <87bnu5t4fj.fsf@Rainer.invalid> (Achim Gratz's message of "Sat, 07 Jun 2014 12:11:28 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org Hello, Achim Gratz writes: > Here's the patch for this: Thank you. Some comments follow. > +If markup is requested, the included content will be placed within an > +appropriate block@footnote{While you can request paragraphs (@samp{verse}, > +@samp{quote}, @samp{center}), there are no checks ensure the result is valid > +Org syntax.}. For markup @samp{example} and @samp{src}, which is requesting > +a literal example, the content will be code-escaped before inclusion. In all > +other cases, the text will be assumed to be in Org mode format and will be > +processed normally. However, footnote labels (@pxref{Footnotes}) in the file > +will be made local to that file. I do not fully agree with the penultimate sentence. Indeed, text will be assumed to be in Org mode /only/ if no markup is provided . In all other cases, contents will be included as-is in the buffer, without assuming anything. In particular, no footnote transformation will happen. I think documentation should make it clear. > + (src-args (when (eq env 'literal) > + (match-string 1 value))) Nitpicking: I suggest (and (eq env 'literal) (match-string 1 value)) > + (block (when (string-match "\\<\\([a-zA-Z]+\\)\\>" value) > + (upcase (match-string 1 value))))) Special blocks are not limited to alphabetic range. According to `org-element-special-block-parser' any non-blank character ("\\S-+") is valid (e.g., "#+begin_equation*"). Also, there's no need for upcasing. (and (string-match "\\S-+" value) (match-string 1 value)) > + ;; Inclusion within an html export-block. > + (org-test-with-temp-text > + (format > + "#+INCLUDE: \"%s/examples/include.html\" html" > + org-test-dir) > + (org-export-expand-include-keyword) > + (should (equal (buffer-string) > + "#+BEGIN_HTML\n

HTML!

\n#+END_HTML\n"))) > + ;; Inclusion within an center paragraph > + (org-test-with-temp-text > + (format > + "#+INCLUDE: \"%s/examples/include2.org\" center" > + org-test-dir) > + (org-export-expand-include-keyword) > + (should (equal (buffer-string) > + "#+BEGIN_CENTER\nSuccess!\n#+END_CENTER\n"))) I suggest to move the `should' outside the test to make it a tad bit easier to debug. (should (equal "#+BEGIN_CENTER\nSuccess!\n#+END_CENTER\n" (org-test-with-temp-text ...))) Otherwise, it looks good. AFAIC, you can apply it whenever you want. Regards, -- Nicolas Goaziou