git.iko.soy/typeable/pandoc
on issue7219 help sign in
typeable/pandoc/tools/pandoc-template-mode.el
64 lines 2.2 kB history raw
1 ;;; pandoc-template-mode.el --- Pandoc-Template major mode
3;; Copyright (C) 2017
5;; Author: Václav Haisman
6;; Keywords: extensions
8;; This file is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 2, or (at your option)
11;; any later version.
13;; This file is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
18;; You should have received a copy of the GNU General Public License
19;; along with GNU Emacs; see the file COPYING. If not, write to
20;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21;; Boston, MA 02111-1307, USA.
23 ;;; Commentary:
25;;
27 ;;; Code:
29(defvar pandoc-template-font-lock-keywords
30 '(("\\(\\$--.*\\)$"
31 (1 font-lock-comment-face))
32 ("\\(\\$\\)\\(if\\|for\\)(\\([^)]+\\))\\(\\$\\)"
33 (1 font-lock-preprocessor-face)
34 (2 font-lock-keyword-face)
35 (3 font-lock-variable-name-face)
36 (4 font-lock-preprocessor-face))
37 ("\\(\\$\\)\\(endif\\|endfor\\|else\\)\\(\\$\\)"
38 (1 font-lock-preprocessor-face)
39 (2 font-lock-keyword-face)
40 (3 font-lock-preprocessor-face))
41 ("\\(\\$\\)\\(sep\\)\\(\\$\\)"
42 (1 font-lock-preprocessor-face)
43 (2 font-lock-builtin-face)
44 (3 font-lock-preprocessor-face))
45 ("\\(\\$\\)\\([^$]+\\)\\(\\$\\)"
46 (1 font-lock-preprocessor-face)
47 (2 font-lock-variable-name-face)
48 (3 font-lock-preprocessor-face))
49 )
50 "Keyword highlighting specification for `pandoc-template-mode'.")
52 ;;;###autoload
53(define-derived-mode pandoc-template-mode fundamental-mode "Pandoc-Template"
54 "A major mode for editing Pandoc-Template files."
55 :syntax-table text-mode-syntax-table
56 (setq-local font-lock-defaults
57 '(pandoc-template-font-lock-keywords))
58 (setq-local comment-start "$--")
59 (setq-local comment-start-skip "\\$--[ \t]*")
60 (setq-local comment-end "")
61 (setq-local comment-end-skip "[ \t]*$"))
63(provide 'pandoc-template-mode)
64 ;;; pandoc-template.el ends here