emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Proposal: references from code to text.


From: ZHUO QL (KDr2)
Subject: Re: [O] Proposal: references from code to text.
Date: Tue, 15 May 2018 04:49:34 +0000 (UTC)

Well, it's a nice approach.

But it has a few cons:

1. Putting text in a source block is not a very natural way. It may disturb the fluidity, both for writing the Org source and reading the exported document(e.g. html);
2. The bug Eric just found while putting a <<...>> link within quotes, although, it may be easy to fix. 


Greetings.

ZHUO QL (KDr2, http://kdr2.com)



On Monday, May 14, 2018, 11:06:34 PM GMT+8, John Kitchin <address@hidden> wrote:


It seems like this is nearly all possible already (see below). It is a little wonky that you have to put text in a src txt block to achieve it, but otherwise what is missing?

* Main document

See [[id:BAD97113-3561-4A4A-BA07-0CD5BF6BA35F][There is a reason we only support two args]] (text to text) for notes about this function. The addition is done in line [[(add)]] (text to code).

#+NAME: DOC-OF-ADD
#+BEGIN_SRC txt
"We use the function add to calculate the sum of two numbers."
#+END_SRC

#+NAME: ADD
#+BEGIN_SRC emacs-lisp -n -r :noweb yes :tangle test.el
(defun add (x y)
  <<DOC-OF-ADD>> ;; code to code
  ;; [[id:BAD97113-3561-4A4A-BA07-0CD5BF6BA35F][There is a reason we only support two args]] code to text
  (+ x y) (ref:add)
  )
#+END_SRC

#+RESULTS: ADD
: add


** Notes

*** There is a reason we only support two args
    :PROPERTIES:
    :ID:       BAD97113-3561-4A4A-BA07-0CD5BF6BA35F
    :END:


John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803

reply via email to

[Prev in Thread] Current Thread [Next in Thread]