emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ken Mankoff <mankoff@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [ANN] Export block syntax change
Date: Mon, 21 Dec 2015 06:09:09 -0500	[thread overview]
Message-ID: <m2si2whxd6.fsf@gmail.com> (raw)
In-Reply-To: <87vb7sakyj.fsf@nicolasgoaziou.fr>


Does this new syntax support that oft (or occasionally?) requested LaTeX header export?

I don't think so out of the box, because while LaTeX is a valid export word, LaTeX_preamble is not.

But, can the new syntax be used like this?

    \include{preamble}
    #+BEGIN_EXPORT LaTeX :file preamble.tex
    % preamble commands go here
    #+END_EXPORT

Thanks,

  -k.



On 2015-12-20 at 16:06, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> I just finalized the syntax change for export blocks. As a reminder, the
> new syntax is:
>
>   #+BEGIN_EXPORT backend
>   ...
>   #+END_EXPORT
>
> instead of
>
>   #+BEGIN_backend
>   ...
>   #+END_backend
>
> So, basically, "export" is a reserved block type, much like "src". As
> a consequence, INCLUDE keywords syntax is modified, e.g.,
>
>   #+INCLUDE: "file.org" HTML
>
> becomes
>
>   #+INCLUDE: "file.org" export html
>
> The following function, included in ORG-NEWS, updates any Org document
> to the new syntax. It is meant to be applied after applying the patch.
>
>   (defun org-repair-export-blocks ()
>     "Repair export blocks and INCLUDE keywords in current buffer."
>     (when (eq major-mode 'org-mode)
>       (let ((case-fold-search t)
>             (back-end-re (regexp-opt
>                           '("HTML" "ASCII" "LATEX" "ODT" "MARKDOWN" "MD" "ORG"
>                             "MAN" "BEAMER" "TEXINFO" "GROFF" "KOMA-LETTER")
>                           t)))
>         (org-with-wide-buffer
>          (goto-char (point-min))
>          (let ((block-re (concat "^[ \t]*#\\+BEGIN_" back-end-re)))
>            (save-excursion
>              (while (re-search-forward block-re nil t)
>                (let ((element (save-match-data (org-element-at-point))))
>                  (when (eq (org-element-type element) 'special-block)
>                    (save-excursion
>                      (goto-char (org-element-property :end element))
>                      (save-match-data (search-backward "_"))
>                      (forward-char)
>                      (insert "EXPORT")
>                      (delete-region (point) (line-end-position)))
>                    (replace-match "EXPORT \\1" nil nil nil 1))))))
>          (let ((include-re
>                 (format "^[ \t]*#\\+INCLUDE: .*?%s[ \t]*$" back-end-re)))
>            (while (re-search-forward include-re nil t)
>              (let ((element (save-match-data (org-element-at-point))))
>                (when (and (eq (org-element-type element) 'keyword)
>                           (string= (org-element-property :key element) "INCLUDE"))
>                  (replace-match "EXPORT \\1" nil nil nil 1)))))))))
>
>
> Regards,

  parent reply	other threads:[~2015-12-21 11:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-20 21:06 [ANN] Export block syntax change Nicolas Goaziou
2015-12-20 23:02 ` Rasmus
2015-12-21  8:21   ` Nicolas Goaziou
2015-12-21 11:09 ` Ken Mankoff [this message]
2015-12-21 12:40   ` Nicolas Goaziou
2016-01-02  7:54 ` Suvayu Ali
2016-01-02  8:18   ` John Hendy
2016-01-02 10:54   ` Nicolas Goaziou
2016-01-02 14:40     ` Suvayu Ali
2016-01-06 16:04       ` Kaushal Modi
2016-01-06 18:06         ` Nicolas Goaziou
2016-01-06 19:57           ` Kaushal Modi
2016-01-06 21:52             ` Nicolas Goaziou
2016-01-06 22:26               ` Kaushal Modi
2016-01-11  3:56                 ` Kaushal Modi
2016-01-11  9:20                   ` Nicolas Goaziou

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=m2si2whxd6.fsf@gmail.com \
    --to=mankoff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).