From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch, ox] #+INCLUDE resolves links Date: Tue, 30 Sep 2014 10:07:08 +0200 Message-ID: <87tx3po7kj.fsf@nicolasgoaziou.fr> References: <87k34x6bjd.fsf@gmx.us> <87lhpdurfh.fsf@gmx.us> <87bnq984hd.fsf@nicolasgoaziou.fr> <87bnq5zzp7.fsf@gmx.us> <87oau4ems5.fsf@nicolasgoaziou.fr> <87d2af1qyv.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYsSI-00019F-5Y for emacs-orgmode@gnu.org; Tue, 30 Sep 2014 04:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYsS6-0002Zk-OO for emacs-orgmode@gnu.org; Tue, 30 Sep 2014 04:06:42 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:47945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYsS6-0002Wl-DA for emacs-orgmode@gnu.org; Tue, 30 Sep 2014 04:06:30 -0400 In-Reply-To: <87d2af1qyv.fsf@gmx.us> (rasmus@gmx.us's message of "Sun, 28 Sep 2014 21:32:08 +0200") 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 Hello, Rasmus writes: > Thanks for the comments. I hope I addressed the previous comments and > did not introduce new reasons bugs. > I added tests. Great. > Just out of curiosity, what is an example of a element that can be > named and does not have a :contents-begin? #+name: empty-drawer :DRAWER: :END: > Okay, there's a lot of improvements in that suggestion. However, it > misses this case which created using only "official" shortcuts > > * head > SCHEDULED: <2014-09-28 sun> > :LOGBOOK: > - Note taken on [2014-09-28 sat 12:21] \\ > a drawer > :END: > :PROPERTIES: > :CUSTOM_ID: h > :END: This was done on purpose, anticipating a patch I'm working on. Anyway, it doesn't matter much. I'll revert it once my work is ready. > +elements.}. If the @code{:only-contents} property is non-nil, only the > +contents of the requested element will be included, omitting any > +property-drawers, planning-lines, attributes, captions etc. The properties (or property) drawer, planning line. Do you think it's worth specifying that captions and attributes will be ignored? It seems pretty obvious to me as they do not belong to contents (unlike to planning and properties drawers). > + (only-contents > + (and (string-match ":only-contents +\\([^: \r\t\n]\\S-*\\)" value) > + (prog1 (org-not-nil (match-string 1 value)) > + (setq value (replace-match "" nil nil value))))) Why do you need to remove match from VALUE? AFAICT, the only match that needs to be removed is the file name. Others are regular. > + ;; skip planning line and property-drawer. If a normal drawer > + ;; precedes a property-drawer both will be included. > + ;; Remaining property-drawers are removed as needed in > + ;; `org-export--prepare-file-contents' ;; Skip planning line and properties drawer. > + ;; If only-contents is non-nil only include contents of element > + (should > + (equal > + "body\n" > + (org-test-with-temp-text > + (format "#+INCLUDE: \"%s/examples/include.org::*Heading\" :only-contents t" org-test-dir) > + (org-export-expand-include-keyword) [...] > + ;; Properties should be dropped, drawers should not be > + (should > + (equal > + ":LOGBOOK:\ndrawer\n:END:\ncontent\n" > + (org-test-with-temp-text > + (format "#+INCLUDE: \"%s/examples/include.org::#dh\" :only-contents t" org-test-dir) > + (org-export-expand-include-keyword) > + (buffer-string))))) Mind the 80th column in your tests, and full stop at end of comments. Besides the minor issues above, it looks good. Feel free to push it whenever you want. Thank you for that work. Regards, -- Nicolas Goaziou