emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Include files on export
@ 2008-07-02 18:21 Richard G Riley
  2008-07-02 18:48 ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Richard G Riley @ 2008-07-02 18:21 UTC (permalink / raw)
  To: org-mode


How can I include text into a sub level e.g an unordered list? I really
dont want to inclide the list delimiter in the text file itself since
this text can be included elsewhere too.

+ Title
  + list item 1
#+INCLUDE: "~/docs/cv/references/cpd.org"

here I want the include to be list item 2.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Include files on export
  2008-07-02 18:21 Include files on export Richard G Riley
@ 2008-07-02 18:48 ` Carsten Dominik
  2008-07-02 19:10   ` Richard G Riley
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2008-07-02 18:48 UTC (permalink / raw)
  To: Richard G Riley; +Cc: org-mode


On Jul 2, 2008, at 11:21 AM, Richard G Riley wrote:

>
> How can I include text into a sub level e.g an unordered list? I  
> really
> dont want to inclide the list delimiter in the text file itself since
> this text can be included elsewhere too.
>
> + Title
>  + list item 1
> #+INCLUDE: "~/docs/cv/references/cpd.org"
>
> here I want the include to be list item 2.

This is untested.

In .emacs

(require 'org-eval)
(defun org-include-as-list-item (file ind bullet)
   "Include FILE with indentation IND and BULLET into the current file"
   (let ((i1 (concat (make-string ind ?\ ) bullet " "))
	(i2 (concat "\n" (make-string (+ 2 ind) ?\ )))
	(text (with-temp-buffer
		(insert-file-contents file)
		(buffer-string))))
     (concat "\n" i1 (mapconcat 'identity (org-split-string text "\n")  
i2)
	    "\n")))

In the Org file:



* test

+ Title
  + list item 1
    <lisp>(org-include-as-list-item "inc.ttt" 10 "+")</lisp>


HTH

- Carsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Include files on export
  2008-07-02 18:48 ` Carsten Dominik
@ 2008-07-02 19:10   ` Richard G Riley
  2008-07-02 20:35     ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Richard G Riley @ 2008-07-02 19:10 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: org-mode, Richard G Riley

Carsten Dominik <dominik@uva.nl> writes:

> On Jul 2, 2008, at 11:21 AM, Richard G Riley wrote:
>
>>
>> How can I include text into a sub level e.g an unordered list? I
>> really
>> dont want to inclide the list delimiter in the text file itself since
>> this text can be included elsewhere too.
>>
>> + Title
>>  + list item 1
>> #+INCLUDE: "~/docs/cv/references/cpd.org"
>>
>> here I want the include to be list item 2.
>
> This is untested.
>
> In .emacs
>
> (require 'org-eval)
> (defun org-include-as-list-item (file ind bullet)
>   "Include FILE with indentation IND and BULLET into the current file"
>   (let ((i1 (concat (make-string ind ?\ ) bullet " "))
> 	(i2 (concat "\n" (make-string (+ 2 ind) ?\ )))
> 	(text (with-temp-buffer
> 		(insert-file-contents file)
> 		(buffer-string))))
>     (concat "\n" i1 (mapconcat 'identity (org-split-string text "\n")
> i2)
> 	    "\n")))
>
> In the Org file:
>
>
>
> * test
>
> + Title
>  + list item 1
>    <lisp>(org-include-as-list-item "inc.ttt" 10 "+")</lisp>
>
>
> HTH
>
> - Carsten

Could I suggest a different approach?

Possibly have a parameter which is a prefix text on the include line?

e.g

#+INCLUDE: "~/docs/cv/references/cpd.org" :prefix " + "

The you dont need to hard code bullets and indentation. There is
probably a more suitable syntax than above.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Include files on export
  2008-07-02 19:10   ` Richard G Riley
@ 2008-07-02 20:35     ` Carsten Dominik
  2008-07-02 21:06       ` Richard G Riley
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2008-07-02 20:35 UTC (permalink / raw)
  To: Richard G Riley; +Cc: org-mode


On Jul 2, 2008, at 12:10 PM, Richard G Riley wrote:
>
> Could I suggest a different approach?
>
> Possibly have a parameter which is a prefix text on the include line?
>
> e.g
>
> #+INCLUDE: "~/docs/cv/references/cpd.org" :prefix " + "

Yes, this is the better solution, but you need two different prefixes,  
one for the first line and one for the others in order to make items  
work.

I don't think it is perfect yet, because the indentation has to be  
specified by hand and will fail if you promote or demote the list.   
Still, useful, thanks a lot.

Its up in the git repo.

- Carsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Include files on export
  2008-07-02 20:35     ` Carsten Dominik
@ 2008-07-02 21:06       ` Richard G Riley
  2008-07-02 21:10         ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Richard G Riley @ 2008-07-02 21:06 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: org-mode, Richard G Riley

Carsten Dominik <dominik@uva.nl> writes:

> On Jul 2, 2008, at 12:10 PM, Richard G Riley wrote:
>>
>> Could I suggest a different approach?
>>
>> Possibly have a parameter which is a prefix text on the include line?
>>
>> e.g
>>
>> #+INCLUDE: "~/docs/cv/references/cpd.org" :prefix " + "
>
> Yes, this is the better solution, but you need two different prefixes,
> one for the first line and one for the others in order to make items
> work.
>
> I don't think it is perfect yet, because the indentation has to be
> specified by hand and will fail if you promote or demote the list.
> Still, useful, thanks a lot.
>
> Its up in the git repo.
>
> - Carsten

Is there no way to just to allow #+include anywhere on a line?

(also, I solved the link query from another psot by using C-u C-c C-l -
possibly the links section of the info file could be clearer). I missed
the need to use the file: specifier.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Include files on export
  2008-07-02 21:06       ` Richard G Riley
@ 2008-07-02 21:10         ` Carsten Dominik
  0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2008-07-02 21:10 UTC (permalink / raw)
  To: Richard G Riley; +Cc: org-mode


[-- Attachment #1.1: Type: text/plain, Size: 1487 bytes --]


On Jul 2, 2008, at 2:06 PM, Richard G Riley wrote:

> Carsten Dominik <dominik@uva.nl> writes:
>
>> On Jul 2, 2008, at 12:10 PM, Richard G Riley wrote:
>>>
>>> Could I suggest a different approach?
>>>
>>> Possibly have a parameter which is a prefix text on the include  
>>> line?
>>>
>>> e.g
>>>
>>> #+INCLUDE: "~/docs/cv/references/cpd.org" :prefix " + "
>>
>> Yes, this is the better solution, but you need two different  
>> prefixes,
>> one for the first line and one for the others in order to make items
>> work.
>>
>> I don't think it is perfect yet, because the indentation has to be
>> specified by hand and will fail if you promote or demote the list.
>> Still, useful, thanks a lot.
>>
>> Its up in the git repo.
>>
>> - Carsten
>
> Is there no way to just to allow #+include anywhere on a line?

How would that help with creating a bullet with correct indentation?

> (also, I solved the link query from another psot by using C-u C-c C- 
> l -
> possibly the links section of the info file could be clearer). I  
> missed
> the need to use the file: specifier.

Links that do not look like a URL are interpreted as internal link.
So you need to write

    + [[file:./references/cpd.org][Reference]]


Or use the latest version - absolute file names, and relative file
names starting with "./" or "../" are now an exception to the above
rule (implemented a week ago), see

http://repo.or.cz/w/org-mode.git?a=commit;h=9b084b22f54f361ad2f17b80c9c67c5d9a850a9a

- Carsten

>


[-- Attachment #1.2: Type: text/html, Size: 3244 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-07-02 21:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-02 18:21 Include files on export Richard G Riley
2008-07-02 18:48 ` Carsten Dominik
2008-07-02 19:10   ` Richard G Riley
2008-07-02 20:35     ` Carsten Dominik
2008-07-02 21:06       ` Richard G Riley
2008-07-02 21:10         ` Carsten Dominik

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).