]> git.donarmstrong.com Git - org-ref.git/commitdiff
add markdown export with pandoc citations
authorJohn Kitchin <jkitchin@andrew.cmu.edu>
Wed, 28 Jan 2015 22:02:16 +0000 (17:02 -0500)
committerJohn Kitchin <jkitchin@andrew.cmu.edu>
Wed, 28 Jan 2015 22:02:16 +0000 (17:02 -0500)
org-ref.org

index 4b814f43499dfe4435fa1cf387f76ff8322feab6..b874625a3200d57284a3c1e94654ee8af78e33e4 100644 (file)
@@ -1944,7 +1944,25 @@ We will want to generate formatting functions for each citation type. The reason
         ;; bibtex format
        (concat "\\" ,type (when desc (org-ref-format-citation-description desc)) "{"
               (mapconcat (lambda (key) key) (org-ref-split-and-strip-string keyword) ",")
-              "}"))))))
+              "}")))
+      ;; for markdown we generate pandoc citations
+      ((eq format 'md)
+       (cond
+       (desc  ;; pre and or post text
+        (let* ((text (split-string desc "::"))
+               (pre (car text))
+               (post (cadr text)))
+          (concat
+           (format "[@%s," keyword)
+           (when pre (format " %s" pre))
+           (when post (format ", %s" post))
+           "]")))
+       (t
+        (format "[%s]"
+                (mapconcat
+                 (lambda (key) (concat "@" key))
+                 (org-ref-split-and-strip-string keyword) ","
+                 "; "))))))))
 #+END_SRC