From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Wittern Subject: Re: [org-ref] how to tweak display of links and entries Date: Fri, 13 Jan 2017 08:57:29 +0900 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRpFS-00047F-CQ for emacs-orgmode@gnu.org; Thu, 12 Jan 2017 18:57:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRpFP-0004d0-6f for emacs-orgmode@gnu.org; Thu, 12 Jan 2017 18:57:38 -0500 Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]:34362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cRpFO-0004cf-Ur for emacs-orgmode@gnu.org; Thu, 12 Jan 2017 18:57:35 -0500 Received: by mail-pf0-x234.google.com with SMTP id 127so20443048pfg.1 for ; Thu, 12 Jan 2017 15:57:34 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: Org Mode Mailing List Dear John, This is great. I will tweak this as needed. Thanks a lot, Christian On 01/13/2017 01:04 AM, John Kitchin wrote: > #+BEGIN_SRC emacs-lisp > (defun format--cjk-authors (orig-fun &rest args) > "Format authors my way." > (cl-loop for a in (s-split " and " value t) > collect > (let ((fields (mapcar (lambda (x) > (let* ((f (split-string x "=")) > (prop (s-trim (nth 0 f))) > (val (s-trim (nth 1 f)))) > (cons prop val))) > (s-split "," a t)))) > (s-format "${given} ${family} (${cjk})" 'aget fields)) > into authors > finally return > (let ((l (length authors))) > (cond > ((= l 1) (car authors)) > ((= l 2) (s-join " & " authors)) > ((< l 8) (concat (s-join ", " (-butlast authors)) > ", & " (-last-item authors))) > (t (concat (s-join ", " authors) ", ...")))))) > > (advice-add 'bibtex-completion-apa-format-authors :around > #'format--cjk-authors) > > ; remove advice like this. > ;(advice-remove 'bibtex-completion-apa-format-authors #'format--cjk-authors) > > #+END_SRC > > That generates Ailong Fang (方愛龍) & Another Fang (方愛龍), Super > interesting report, J. Interesting Reports, 1(), (2007). for the > tooltips and messages. > > for this entry > > @article{fang-2007-super, > title = {Super interesting report}, > author = {family=Fang, given=Ailong, cjk=方愛龍 and family=Fang, given=Another, cjk=方愛龍}, > journal = {J. Interesting Reports}, > keywords = {test, word}, > volume = 1, > year = 2007, > } > > It is not very robust, e.g. it assumes there will be family, given and > cjk for all authors, that authors are split by and, and prop=val is > split by commas, etc... Yes, but its a great start. This proves that this is a viable road for this kind of material. There is still no established and robust way to do this kind of thing in any format, so I am great to see this is possible. All the best, Christian -- Christian Wittern, Kyoto