emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] #+INCLUDE: myfile.html html does not include /literally/; Org pr


From: Nicolas Goaziou
Subject: Re: [O] #+INCLUDE: myfile.html html does not include /literally/; Org processes
Date: Sat, 07 Jun 2014 15:53:34 +0200

Hello,

Achim Gratz <address@hidden> 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 address@hidden you can request paragraphs (@samp{verse},
> address@hidden, @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 via email to

[Prev in Thread] Current Thread [Next in Thread]