emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Achim Gratz <Stromeko@nexgo.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: #+INCLUDE: myfile.html html does not include /literally/; Org processes
Date: Sat, 07 Jun 2014 15:53:34 +0200	[thread overview]
Message-ID: <87oay4ygf5.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87bnu5t4fj.fsf@Rainer.invalid> (Achim Gratz's message of "Sat, 07 Jun 2014 12:11:28 +0200")

Hello,

Achim Gratz <Stromeko@nexgo.de> 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<p>HTML!</p>\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

  reply	other threads:[~2014-06-07 13:53 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
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 [this message]
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=87oay4ygf5.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=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).