From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [bug, patch, ox] INCLUDE and footnotes Date: Sun, 21 Dec 2014 22:04:41 +0100 Message-ID: <87d27cyas6.fsf@nicolasgoaziou.fr> References: <87h9x5hwso.fsf@gmx.us> <87oarcbppe.fsf@nicolasgoaziou.fr> <87fvcozfhf.fsf@gmx.us> <87h9x4bj33.fsf@nicolasgoaziou.fr> <87iohks4ne.fsf@gmx.us> <87d27rbvio.fsf@nicolasgoaziou.fr> <87bnnbhg2x.fsf@gmx.us> <878uifbjc7.fsf@nicolasgoaziou.fr> <87388j9qbv.fsf@gmx.us> <87y4q57t2i.fsf@nicolasgoaziou.fr> <87lhm4n9ky.fsf@pank.eu> <87y4q3a8tc.fsf@pank.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2nfN-0002kH-Ef for emacs-orgmode@gnu.org; Sun, 21 Dec 2014 16:04:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2nfF-0006at-Bv for emacs-orgmode@gnu.org; Sun, 21 Dec 2014 16:03:53 -0500 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]:33882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2nfF-0006ab-4w for emacs-orgmode@gnu.org; Sun, 21 Dec 2014 16:03:45 -0500 In-Reply-To: <87y4q3a8tc.fsf@pank.eu> (rasmus@gmx.us's message of "Fri, 19 Dec 2014 17:44:15 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org Rasmus writes: > Here's a new version of the second patch with tests. Thanks. Some comments follow. > The recognition regexp is still not great, but the idea of the regexp > is to only act on includes where there's no :minlevel already and no > plain words (most obviously src and example, but any block really) > when disregarding ":key=C2=A0value" pairs. This is not necessary. Even if :minlevel is used on these include keywords, its value is ignored when inserting contents of the file. > * ox.el (org-export-expand-include-keyword): Guess :minlevel if > missing and relevant. > * test-ox.el: Tests for automatic :minlevel. Pleas name test modified. > + ;; Add :minlevel to all include words that no explicitly have one. > + (save-excursion No need for that. > + (while (re-search-forward > + (concat include-re "[ \t]*" "\\(?:\".+?\"\\|[^ \t]+\\)[ \t]*" "\\= (.*\\)$") > + nil t) (re-search-forward include-re nil t) is enough. > + (let ((matched (match-string 1))) > + (unless (or (string-match-p ":minlevel" matched) > + ;; matched a normal word > + (string-match "\\(?:^\\|[ \t]+\\)\\(\\w\\)" > + (replace-regexp-in-string "\\(^\\|[ t]+\\):\\w+[ \t]+\\w+" "" > + matched))) (unless (search-forward ":minlevel" (line-end-position) t) ...) > + (goto-char (line-end-position)) aka (end-of-line) > + (insert (format " :minlevel %d" > + (1+ (org-with-wide-buffer > + (if (search-backward-regexp org-heading-regexp nil t) > + (length (match-string 1)) > + 0))))))))) (insert (format " :minlevel %d" (1+ (org-outline-level)))) Regards,