[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 19/39: Markdown support added.
From: |
Phillip Lord |
Subject: |
[elpa] 19/39: Markdown support added. |
Date: |
Mon, 20 Oct 2014 08:22:37 +0000 |
phillord pushed a commit to branch externals/pabbrev
in repository elpa.
commit c2cf0bf853199b76ed8e29112c6ab21a438d9512
Author: Phillip Lord <address@hidden>
Date: Mon Sep 23 20:56:44 2013 +0100
Markdown support added.
---
greycite.el | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 51 insertions(+), 9 deletions(-)
diff --git a/greycite.el b/greycite.el
index 01a5996..588b00f 100644
--- a/greycite.el
+++ b/greycite.el
@@ -47,7 +47,7 @@
;; `greycite-bibtex-doi-update' do similar jobs for DOIs.
;;
;; Reftex support is added automatically to adoc-mode. If you prefer to use
-;; someother mode than adoc, `greycite-asciidoc-reftex-support' will turn this
+;; some other mode than adoc, `greycite-asciidoc-reftex-support' will turn this
;; on.
;;
@@ -61,6 +61,10 @@
(add-hook 'adoc-mode-hook
'greycite-asciidoc-reftex-support)
+(add-hook 'markdown-mode-hook
+ 'greycite-markdown-reftex-support)
+
+
(defvar greycite-reftex-citation-override nil)
(defvar greycite-adoc-kblog-cite-format
'(
@@ -70,31 +74,60 @@
(?j . "http:[]"))
)
+(defvar greycite-markdown-cite-format
+ '(
+ (?\C-m . "[?](http://)")))
+
+
(defvar greycite-default-bibliographies
'("~/documents/bibtex/phil_lord_refs.bib"
- "~/documents/bibtex/phil_lord/journal_papers.bib"
- "~/documents/bibtex/phil_lord/conference_papers.bib"
+ "~/documents/bibtex/phil_lord/phil_lord_all.bib"
"~/documents/bibtex/urls.bib"
"~/documents/bibtex/russet.bib"
+ "~/documents/bibtex/kblog.bib"
))
(defun greycite-asciidoc-reftex-support()
(interactive)
+ (greycite-alien-reftex-support greycite-adoc-kblog-cite-format))
+
+(defun greycite-markdown-reftex-support ()
+ (interactive)
+ (greycite-alien-reftex-support greycite-markdown-cite-format)
+ (make-local-variable 'reftex-cite-cleanup-optional-args)
+ (setq reftex-cite-cleanup-optional-args nil)
+ (add-hook 'greycite-pre-insert-hook
+ 'greycite-markdown-pre-hook))
+
+(defun greycite-markdown-pre-hook ()
+ (insert "]")
+ (save-excursion
+ (forward-word -1)
+ (insert "[")))
+
+
+(defvar greycite-pre-insert-hook nil)
+
+(defun greycite-alien-reftex-support(cite-format)
+ (interactive)
(reftex-mode 1)
(make-local-variable 'greycite-reftex-citation-override)
(setq greycite-reftex-citation-override t)
(make-local-variable 'reftex-default-bibliography)
(make-local-variable 'reftex-cite-format)
(setq reftex-cite-format
- greycite-adoc-kblog-cite-format)
+ cite-format)
(setq reftex-default-bibliography greycite-default-bibliographies))
+
(defadvice reftex-format-citation (around greycite-asciidoc-around activate)
- "Alter citation style for kcite"
- (if greycite-reftex-citation-override
+ "Alter citation stylue for kcite"
+ (if (and greycite-reftex-citation-override
+ (not (string= "%2a %y, %T, %B, %j %v:%P, %s %<" format)))
(progn
- (setq ad-return-value (greycite-reftex-format-citation entry format)))
+ (setq ad-return-value (greycite-reftex-format-citation entry format))
+ (run-hooks 'greycite-pre-insert-hook))
ad-do-it))
;; we can't just use reftex-format-citation -- it has will template with most
@@ -117,7 +150,10 @@
(reftex-get-bib-field "url" entry))
((string= format "http:[]")
(concat (reftex-get-bib-field "url" entry) "[]"))
- ))
+ ;; markdown
+ ((string= format "[?](http://)")
+ (concat "?(" (reftex-get-bib-field "url" entry) ")"))
+ (t (error "Format not recognised"))))
(defun greycite-reftex-or-false(entry field prefix &optional transform)
@@ -274,4 +310,10 @@
(greycite-bibtex-region-from-greycite
(point-min) (point-max)))
-(provide 'greycite)
\ No newline at end of file
+(defun greycite-buffer ()
+ (interactive)
+ (while (< -1 (forward-line -1))
+ (greycite-bibtex-url)
+ (sit-for 2)))
+
+(provide 'greycite)
- [elpa] 06/39: Prepared for Marmalade, (continued)
- [elpa] 06/39: Prepared for Marmalade, Phillip Lord, 2014/10/20
- [elpa] 11/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 12/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 16/39: Clojure mode support added., Phillip Lord, 2014/10/20
- [elpa] 15/39: Documentation Updates., Phillip Lord, 2014/10/20
- [elpa] 13/39: Initial Checkin, Phillip Lord, 2014/10/20
- [elpa] 17/39: Version number added. Documentation fix. Indentation fix., Phillip Lord, 2014/10/20
- [elpa] 05/39: Ported from generic.el to define-derived-mode. Comment-character is now "#" rather than fudged "# " Delimited URIs now recognised as strings Electric indentation added. Indentation engine improved., Phillip Lord, 2014/10/20
- [elpa] 20/39: New keywords added., Phillip Lord, 2014/10/20
- [elpa] 18/39: Copes better with missing repos. Improved output., Phillip Lord, 2014/10/20
- [elpa] 19/39: Markdown support added.,
Phillip Lord <=
- [elpa] 21/39: Exclude nrepl mode., Phillip Lord, 2014/10/20
- [elpa] 14/39: Initial checkin., Phillip Lord, 2014/10/20
- [elpa] 23/39: Some code re-organisation. Checks whether pulse.el can cope with foreground pulse., Phillip Lord, 2014/10/20
- [elpa] 25/39: pabbrev-mode now sets inhibit-modification-hooks, Phillip Lord, 2014/10/20
- [elpa] 26/39: Improved keyboard handling., Phillip Lord, 2014/10/20
- [elpa] 22/39: Initial checkin, Phillip Lord, 2014/10/20
- [elpa] 27/39: Add cider-nrepl mode to ignored., Phillip Lord, 2014/10/20
- [elpa] 24/39: Keywords, Status added., Phillip Lord, 2014/10/20
- [elpa] 32/39: README.md added., Phillip Lord, 2014/10/20
- [elpa] 34/39: Version 4.0, Phillip Lord, 2014/10/20