4

I often create short articles for myself, which are mostly extracts from other articles on the Web. For such articles I usually add a source link simply like this:

[[http://example.com/article][Source]]

Is there an “official” way to do this, like a property or #+ keyword? If it reflects in exported files (I use HTML and rarely Markdown), the better.

  • what are you looking for the link you use doesn't provide? It would show in exported files as a hyperlink. – John Kitchin Apr 24 '17 at 15:56
  • It does, it actually works, too. I'm just curious if there is a more sophisticated way to do this (like bibliography entries in a research paper, just for one link) – GergelyPolonkai Apr 24 '17 at 19:27
1

I have been using the code below to set a SOURCE property on captures. If you add :source t to the template then the SOURCE property will set to the captures :annotation (the same as the %a template parameter). A nice accidental features is that C-c C-o will find this link in the org file or the agenda.

(defvar org-source-property "SOURCE"
  "The property used to store the source of the capture.")

(defvar org-capture-default-source :annotation
  "The default org-capture property to get the source from.")

(defun org-capture-source-process-source (source)
  "Process the input SOURCE into a string.

This is called by `org-capture-set-source' just before passing
the result into `org-set-property'.  It must return a string."
  (format "%s" source))

(defun org-capture-set-source (&optional source global)
  "Set the source of a captured item.

If the input argument SOURCE is provided and non-nil, set the
source to that. Otherwise look at the :source property of
`org-capture-plist' are parse it as follows.

    If :source is nil do nothing.
    If :source is a string take that as the source.
    If :source is a form evaluate it and take that as the source.
    If :source is just t, use the default property (`org-capture-default-source')
    Otherwise assume it is property and look it up in `org-capture-plist'.

This function is intended to be called from
`org-capture-before-finalize-hook' where
`org-capture-current-plist' is still valid. To use the global
capture date instead, set GLOBAL to t."

  (let* ((local (not global))
         (source (or source (org-capture-get :source local)))
         )
    (when source
      (org-set-property org-source-property
                        (org-capture-source-process-source
                         (cond ((stringp source) source)
                               ((listp source) (eval source))
                               ((eq source t) (org-capture-get
                                               org-capture-default-source
                                               local))
                               (t (org-capture-get source local))
                               ))))
    ))

(add-hook 'org-capture-before-finalize-hook #'org-capture-set-source)
4

If citations and bibliographies are what you want, see org-ref: https://www.youtube.com/watch?v=2t925KRBbFc and https://melpa.org/#/org-ref. You can make bibtex entries for the articles you want to cite, and use org-ref to insert nice links to them.

  • It’s definitely not citations. It is somewhat bibliography, except there is only one source, as my whole headline content is an excerpt from an article. I’ll take a look at org-ref tomorrow, thanks! – GergelyPolonkai Apr 24 '17 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.