emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adonay Felipe Nogueira <adfeno@openmailbox.org>
To: emacs-orgmode@gnu.org
Subject: Re: How do you store web pages for reference?
Date: Tue, 14 Mar 2017 09:17:19 -0300	[thread overview]
Message-ID: <87k27scasw.fsf@openmailbox.org> (raw)
In-Reply-To: CAE+_6TxSg7jutQKH=1Wx7C1dYQ8LmwWJ-Z=1_LfqHWk=iiRj1Q@mail.gmail.com

Note 1: You might need to load "org-bibtex".

Note 2: "org-bibtex" only accepts some properties to be exposed to
org-capture, it's not an exact parser like "bibtex" package. As a future
suggestion: I would like to suggest "org-bibtex" to be improved so as to
take all fields parsed by the "bibtex" package, but I don't know how to
do that yet. This would allow non-default BibTeX entries and fields such
as the "url" field (which is already supported), and other ones such as
"urlaccessdate" (this one is used by ABNTeX) and "note" to be made
available transparently through org-capture templates.

Note 3: Each time a reference entry is found in a refere file, such
entry should be removed from the references list, so as to avoid such
reference key being matched twice, even if there is a repeated reference
file. This is currently the only control mechanism that exists for this
hack.

Note 4: As an improvement, I still have to find a way to use an
org-capture template without being required to bind such template to a
key, as this can conflict with other templates or keys. I'm accepting
suggestions for such as long as I can figure out how it exactly works.

Note 5: I'm not a programmer, so I'm slow on picking up programming
concepts or languages' syntax.

Note 6: You must evaluate the first source code block once for the first
time the file is openned and everytime you adapt/change/modify the
source code block (for both cases: unless you preset the
"org-capture-templates" to reflect the same behavior in your overall
Emacs setup. For the last case: you must also make sure that there are
no old duplicates of such items in "org-capture-templates" otherwise
they might cause obsolete results or always raise an error).

Note 7: You must evaluate the second source code block
(import-references) once before exporting if either the "Reference" headline is
empty, if the references inside "References" headline is outdated, and
if the overall document contains a broken link (this one will already
cause an error that will stop exporting if broken-links #+OPTION is set
to nil).

Having read the notes above, I do the following:

# Begin of Org file
#+OPTIONS: d:(not "BibTeX_Importer")

:BibTeX_Importer:
#+BEGIN_SRC emacs-lisp :results silent
  (add-to-list 'org-capture-templates
	       '("B" "BibTeX references"
		 item (file+headline
		       reference-parent-file
		       "References")
		 "<<%:key>> %:author. *%:title*. %:year. %:annote. _[[%:url][Source]]_."
		 :immediate-finish t))
#+END_SRC

#+NAME: reference-files
- /home/adfeno/Publico/Referencias_BibTeX.bib

#+NAME: references
- Stallman-2015-Free_Software_and_Your_Freedom

#+NAME: import-references
#+BEGIN_SRC emacs-lisp :var reference-parent-file=(buffer-file-name) :var reference-files=reference-files :var referenced-entries=references
  (dolist (current-reference-file reference-files)
    (find-file (car current-reference-file))
    (let ((reference-file-buffer (buffer-name)))
      (dolist (current-entry referenced-entries)
	(set-buffer reference-file-buffer)
	(when (bibtex-find-entry (car current-entry))
	  (org-capture nil "B")
	  (setq referenced-entries (delete current-entry referenced-entries))))))
#+END_SRC
:END:

* References
# End of Org file

Respectfully, Adonay.
-- 
* https://libreplanet.org/wiki/User:Adfeno
* Palestrante e consultor sobre software livre (não confundir com
  gratis).
* "WhatsApp"? Ele não é livre, por isso não uso. Iguais a ele prefiro
  Ring, ou Tox. Quer outras formas de contato? Adicione o vCard que
  está no endereço acima aos teus contatos.
* Pretende me enviar arquivos .doc, .ppt, .cdr, ou .mp3? OK, eu
  aceito, mas não repasso. Entrego apenas em formatos favoráveis ao
  software livre. Favor entrar em contato em caso de dúvida.
* "People said I should accept the world. Bullshit! I don't accept the
  world."
                                                 --- Richard Stallman

  reply	other threads:[~2017-03-14 12:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16  8:48 How do you store web pages for reference? Alan Schmitt
2017-01-16  9:22 ` Michael Welle
2017-01-16  9:57   ` Alan Schmitt
2017-01-16 10:03     ` Michael Welle
2017-01-16 15:58     ` William Denton
2017-01-16 18:09       ` Alan Schmitt
2017-01-16 10:38 ` Charles A. Roelli
2017-01-16 13:06   ` Alan Schmitt
2017-01-16 14:43 ` Karl Voit
2017-01-16 15:41   ` Alan Schmitt
2017-01-16 16:35     ` Karl Voit
2017-01-16 16:52       ` Robert Horn
2017-01-16 17:40         ` Scott Otterson
2017-03-16 19:04           ` Bob Newell
2017-03-17  8:05             ` Alan Schmitt
2017-03-23  0:01             ` Adam Porter
2017-03-13 17:43 ` Peter Salazar
2017-03-14 12:17   ` Adonay Felipe Nogueira [this message]
2017-03-15  7:08   ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k27scasw.fsf@openmailbox.org \
    --to=adfeno@openmailbox.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).