From 0d5abf4a2e214a03606ca4b43adec5be3066f363 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Mon, 29 Jan 2024 12:24:20 +0100 Subject: Comment out `obe-meta-to-json'. It is not usable * lisp/org-bibtex-extras.el (obe-meta-to-json): Comment out the function and add FIXME. It cannot run. --- lisp/org-bibtex-extras.el | 73 ++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/lisp/org-bibtex-extras.el b/lisp/org-bibtex-extras.el index 6e98c7f..8e027fa 100644 --- a/lisp/org-bibtex-extras.el +++ b/lisp/org-bibtex-extras.el @@ -104,42 +104,43 @@ For example, to point to your `obe-bibtex-file' use the following. (mapcar #'org-trim (split-string (match-string 1) ",")) ", ")))))) -(defun obe-meta-to-json (meta &optional fields) - "Turn a list of META data from citations into a string of json." - (let ((counter 1) nodes links) - (cl-flet ((id (it) (cl-position it nodes :test #'string= :key #'car)) - (col (k) (mapcar (lambda (r) (cdr (assoc k r))) meta)) - (add (lst) - (dolist (el lst) (push (cons el counter) nodes)) - (cl-incf counter))) - ;; build the nodes of the graph - (add (col :title)) - (add (cl-remove-if (lambda (author) (string-match "others" author)) - (cl-remove-duplicates (apply #'append (col :authors)) - :test #'string=))) - (dolist (field fields) - (add (cl-remove-duplicates (col field) :test #'string=))) - ;; build the links in the graph - (dolist (citation meta) - (let ((dest (id (cdr (assq :title citation))))) - (dolist (author (mapcar #'id (cdr (assq :authors citation)))) - (when author (push (cons author dest) links))) - (let ((jid (id (cdr (assq :journal citation))))) - (when jid (push (cons jid dest) links))) - (let ((cid (id (cdr (assq :category citation))))) - (when cid (push (cons cid dest) links))))) - ;; build the json string - (format "{\"nodes\":[%s],\"links\":[%s]}" - (mapconcat - (lambda (pair) - (format "{\"name\":%S,\"group\":%d}" - (car pair) (cdr pair))) - nodes ",") - (mapconcat - (lambda (link) - (format "{\"source\":%d,\"target\":%d,\"value\":1}" - (car link) (cdr link))) - (meta-to-links meta nodes) ","))))) +;; FIXME: `meta-to-links' is not a known function. +;; (defun obe-meta-to-json (meta &optional fields) +;; "Turn a list of META data from citations into a string of json." +;; (let ((counter 1) nodes links) +;; (cl-flet ((id (it) (cl-position it nodes :test #'string= :key #'car)) +;; (col (k) (mapcar (lambda (r) (cdr (assoc k r))) meta)) +;; (add (lst) +;; (dolist (el lst) (push (cons el counter) nodes)) +;; (cl-incf counter))) +;; ;; build the nodes of the graph +;; (add (col :title)) +;; (add (cl-remove-if (lambda (author) (string-match "others" author)) +;; (cl-remove-duplicates (apply #'append (col :authors)) +;; :test #'string=))) +;; (dolist (field fields) +;; (add (cl-remove-duplicates (col field) :test #'string=))) +;; ;; build the links in the graph +;; (dolist (citation meta) +;; (let ((dest (id (cdr (assq :title citation))))) +;; (dolist (author (mapcar #'id (cdr (assq :authors citation)))) +;; (when author (push (cons author dest) links))) +;; (let ((jid (id (cdr (assq :journal citation))))) +;; (when jid (push (cons jid dest) links))) +;; (let ((cid (id (cdr (assq :category citation))))) +;; (when cid (push (cons cid dest) links))))) +;; ;; build the json string +;; (format "{\"nodes\":[%s],\"links\":[%s]}" +;; (mapconcat +;; (lambda (pair) +;; (format "{\"name\":%S,\"group\":%d}" +;; (car pair) (cdr pair))) +;; nodes ",") +;; (mapconcat +;; (lambda (link) +;; (format "{\"source\":%d,\"target\":%d,\"value\":1}" +;; (car link) (cdr link))) +;; (meta-to-links meta nodes) ","))))) (provide 'org-bibtex-extras) ;;; org-bibtex-extras ends here -- cgit v1.2.3-70-g09d2