emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How do you store web pages for reference?


From: Adonay Felipe Nogueira
Subject: Re: [O] How do you store web pages for reference?
Date: Tue, 14 Mar 2017 09:17:19 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

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 via email to

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