Hello,

Achim Gratz <strom...@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 via email to