emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-orgmode@gnu.org
Subject: Re: #+INCLUDE: myfile.html html does not include /literally/; Org processes
Date: Sun, 01 Jun 2014 09:53:58 +0200	[thread overview]
Message-ID: <8761kl12w9.fsf@Rainer.invalid> (raw)
In-Reply-To: 538AA6B8.40604@gmail.com

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

Omid writes:
> I am trying to include an HTML file (say myfile.html, which has only
> the <body>) in an Org file so that upon export the contents of
> myfile.html are /literally/ inserted in the appropriate section of the
> exported HTML file.

That's not yet possible.  The following patch would implement it, but I
guess there are a few things that need to be discussed before this gets
official, if at all.  I haven't given it much testing either.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-implement-wrap-for-INCLUDE.patch --]
[-- Type: text/x-patch, Size: 2355 bytes --]

From 425b53146b99b1dd9b9b5d9b96e950dfea81835c Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sun, 1 Jun 2014 09:49:48 +0200
Subject: [PATCH] ox: implement "wrap" for #+INCLUDE

* lisp/ox.el (org-export-expand-include-keyword): Implement additional
  "wrap" parameter for including files literally, wrapped in an
  appropriate block (usually an export block).  The contents of the
  file gets included literally.

This is experimental, the documentation and testing for this feature
is missing!
---
 lisp/ox.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index be843e6..26d2a9e 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3305,9 +3305,10 @@ (defun org-export-expand-include-keyword (&optional included dir)
 			value)
 		       (prog1 (match-string 1 value)
 			 (setq value (replace-match "" nil nil value)))))
-		 (env (cond ((string-match "\\<example\\>" value) 'example)
-			    ((string-match "\\<src\\(?: +\\(.*\\)\\)?" value)
-			     (match-string 1 value))))
+		 (env (cond ((string-match "\\(\\<example\\)\\>" value) 'example)
+			    ((string-match "\\<wrap\\(?: +\\(.*\\)\\)?" value) 'wrap)
+			    ((string-match "\\<src\\(?: +\\(.*\\)\\)?" value) 'src)))
+		 (lang (when env (match-string 1 value)))
 		 ;; Minimal level of included file defaults to the child
 		 ;; level of the current headline, if any, or one.  It
 		 ;; only applies is the file is meant to be included as
@@ -3340,14 +3341,21 @@ (defun org-export-expand-include-keyword (&optional included dir)
 			 (org-export--prepare-file-contents file lines))))
 		   (format "%s#+BEGIN_EXAMPLE\n%s%s#+END_EXAMPLE\n"
 			   ind-str contents ind-str))))
-	       ((stringp env)
+	       ((eq env 'src)
 		(insert
 		 (let ((ind-str (make-string ind ? ))
 		       (contents
 			(org-escape-code-in-string
 			 (org-export--prepare-file-contents file lines))))
 		   (format "%s#+BEGIN_SRC %s\n%s%s#+END_SRC\n"
-			   ind-str env contents ind-str))))
+			   ind-str lang contents ind-str))))
+	       ((eq env 'wrap)
+		(insert
+		 (let ((ind-str (make-string ind ? ))
+		       (contents
+			 (org-export--prepare-file-contents file lines)))
+		   (format "%s#+BEGIN_%s\n%s%s#+END_%s\n"
+			   ind-str lang contents ind-str lang))))
 	       (t
 		(insert
 		 (with-temp-buffer
-- 
1.9.3


[-- Attachment #3: Type: text/plain, Size: 199 bytes --]



Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

  parent reply	other threads:[~2014-06-01  7:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01  4:06 #+INCLUDE: myfile.html html does not include /literally/; Org processes Omid
2014-06-01  4:42 ` Nick Dokos
2014-06-01  4:51   ` Omid
2014-06-01  6:18     ` Nick Dokos
2014-06-01  5:05   ` Omid
2014-06-01  7:53 ` Achim Gratz [this message]
2014-06-01  8:31   ` Nicolas Goaziou
2014-06-01  9:26     ` Achim Gratz
2014-06-01 10:01       ` Nicolas Goaziou
2014-06-01 10:23         ` Achim Gratz
2014-06-01 11:30           ` Nicolas Goaziou
2014-06-01 13:02             ` Achim Gratz
2014-06-01 14:00               ` Nicolas Goaziou
2014-06-01 14:27                 ` Achim Gratz
2014-06-03 20:37                   ` Nicolas Goaziou
2014-06-04 21:50                     ` Achim Gratz
2014-06-05  9:28                       ` Nicolas Goaziou
2014-06-07 10:11                     ` Achim Gratz
2014-06-07 13:53                       ` Nicolas Goaziou
2014-06-01 10:01       ` Omid
2014-06-01 11:24         ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2014-09-25 22:36 Omid
2014-09-26  9:07 ` Nicolas Goaziou
2014-09-26 18:53 ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761kl12w9.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).