I am trying to derive mode based on Sample Mode. Reduced contents here:
;;; pandoc-template.el --- Pandoc-Template major mode
;; Copyright (C) 2017
;; Author: VaclavHaisman
;; Keywords: extensions
(defvar pandoc-template-mode-syntax-table
(let ((st (make-syntax-table)))
;(modify-syntax-entry ?# "<" st)
;(modify-syntax-entry ?\n ">" st)
st)
"Syntax table for `pandoc-template-mode'.")
(defvar pandoc-template-font-lock-keywords
'(("\\(\\$\\)\\(if\\)(\\([^)]+\\))\\(\\$\\)"
. font-lock-preprocessor-face)
;(1 font-lock-preprocessor-face)
;(2 font-lock-keyword-face)
;(3 font-lock-variable-face)
;(4 font-lock-preprocessor-face))
("\\$endif\\$" . font-lock-keyword-face)
)
"Keyword highlighting specification for `pandoc-template-mode'.")
;;;###autoload
(define-derived-mode pandoc-template-mode fundamental-mode "Pandoc-Template"
"A major mode for editing Pandoc-Template files."
:syntax-table nil ;pandoc-template-mode-syntax-table
;(setq-local comment-start "# ")
;(setq-local comment-start-skip "#+\\s-*")
(setq-local font-lock-defaults
'(pandoc-template-font-lock-keywords))
)
(provide 'pandoc-template-mode)
;;; pandoc-template.el ends here
It does nothing. I cannot tell why it does not highlight anything. Sample text of the Pandoc template:
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
$if(colorlinks)$
\PassOptionsToPackage{usenames,dvipsnames}{color}
$endif$
%
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$paper,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
$if(beamerarticle)$
\usepackage{beamerarticle} % needs to be loaded first
$endif$
$if(fontfamily)$
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$
\usepackage{lmodern}
$endif$