[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Feature request: #+INCLUDE: with anchors
From: |
Rasmus |
Subject: |
Re: [O] Feature request: #+INCLUDE: with anchors |
Date: |
Thu, 11 Jan 2018 11:39:29 +0100 |
User-agent: |
Emacs Gnus |
address@hidden writes:
> Hello,
>
> I have seen this syntax in markdown (one of the many versions):
>
> !listing
> path/to/file.ext
> start=ini_keyword end=end_keyword
>
> Here, ~file.ext~ is a source file, and both ~ini_keyword~ and
> ~end_keyword~ are text strings in the text delimiting what should be
> included (responsibility of the writer to make sure they are
> unique). I think that having something like this in Org would be
> nice. I am aware of the ~:lines~ option, but having something like
> this would not require an update of the numeric reference every time
> the referenced file changes.
What would happen if one of the keywords aren’t unique?
Something similar can already be done in Org. See this part of the
manual:
Inclusions may specify a file-link to extract an object matched by
org-link-search (see Search options).
To extract only the contents of the matched object, set :only-contents
property to non-nil. This will omit any planning lines or property drawers. The
ranges for :lines keyword are relative to the requested element. Some examples:
#+INCLUDE: "./paper.org::#theory" :only-contents t
Include the body of the heading with the custom id ‘theory’
#+INCLUDE: "./paper.org::mytable" Include named element.
#+INCLUDE: "./paper.org::*conclusion" :lines 1-20
Include the first 20 lines of the headline named ‘conclusion’.
Rasmus
--
Tack, ni svenska vakttorn. Med plutonium tvingar vi dansken på knä!