Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional filter function to citar-org-roam-template-fields #43

Open
bdarcus opened this issue Apr 6, 2023 · 1 comment
Open

Add optional filter function to citar-org-roam-template-fields #43

bdarcus opened this issue Apr 6, 2023 · 1 comment

Comments

@bdarcus
Copy link
Contributor

bdarcus commented Apr 6, 2023

This is an example that suggests perhaps it might be worth enhancing citar-org-roam-template-fields to allow an optional filter function to be associated with a template field, as we do already in the citar template language. Here, we'd just want to pre-filter it.

In this case, the example filter might be ex-latex-to-org.

So maybe:

 (:citar-note   ("note")   'ex-latex-to-org)

Or, alternately, somehow hook this up to citar-display-transform-functions?


This says Better BibTeX exports these as LaTeX notes.

Here's an (untested) example adapted from org-roam/org-roam-bibtex#178 (comment) that should work, to convert those notes to org.

(defun ex/latex-note-to-org (citekey)
  "Convert Better BibTeX exported LaTeX notes to org." ; Zotero annotations
  (let* ((note (citar-get-value "note" citekey))
         (pandoc-command "pandoc --from latex --to org")
         result)
    (with-temp-buffer
      (shell-command (format "echo \"%s\" | %s" note pandoc-command)
                     (current-buffer))
      (setq result (buffer-substring-no-properties (point-min) (point-max))))))

Just need to figure out how to hook it up with some specific output (insert into buffer, integrate into capture template, etc.).

Effectively, this is a sort of filter run on some content. It may be possible to adapt something like this to the new citar-org-roam capture template support.

Originally posted by @bdarcus in emacs-citar/citar#774 (reply in thread)

@bdarcus bdarcus changed the title [This](https://org-roam.discourse.group/t/new-zotero-pdf-reader-and-org-roam-org-roam-bibtex-workflow/1364) says Better BibTeX exports these as LaTeX notes. Add optional filter function to citar-org-roam-template-fields Apr 6, 2023
bdarcus added a commit that referenced this issue Apr 7, 2023
* citar-org-roam-template-fields: convert from cons to list

Close: #43
@bdarcus
Copy link
Contributor Author

bdarcus commented Sep 13, 2023

Just need to hook this up to core citar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant