aboutsummaryrefslogtreecommitdiff
path: root/dot_emacs.d/lisp/dictem/dictem-lingvo-dsl.el
blob: 35f92d54ea0e3b6bfdf0d2e7728a37d9a97acd6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;; -*- coding: utf-8; -*- 

(require 'dictem)

(defun dictem-lingvo-dsl-highlight ()
  ; trn/ex/com/*
  (goto-char (point-min))
  (while (search-forward-regexp "\\[/?trn\\]\\|\\[/?p\\]\\|\\[/?c\\]\\|\\[/?com\\]\\|\\[/?[*]\\]\\|\\[/?b\\]\\|\\[/?i\\]\\|\\[/?m[0-9]?\\]\\|\\[/?ex\\]" nil t)
    (replace-match "" t t))

  ; [ex] [/ex]
;  (goto-char (point-min))
;  (while (search-forward-regexp "\\[ex\\]\\([][]*\\)\\[/ex\\]" nil t)
;    (add-text-properties (match-beginning 0) (match-end 0)
;			 '(face dictem-lingvo-dsl-example-face))
;    (let* ((beg (match-beginning 1))
;	   (end (match-end 1))
;	   (repl (buffer-substring beg end)))
;      (replace-match repl 1 1)))

  ; <<>>
  (goto-char (point-min))
  (while (search-forward-regexp "\\(<<\\|\\[ref\\]\\)\\([^\n]*\\)\\(>>\\|\\[/ref\\]\\)" nil t)
    (let* ((beg (match-beginning 2))
	   (end (match-end 2))
	   (repl (buffer-substring beg end)))
      (replace-match (concat "{" repl "}") t t)))

  ; hyperlinks
  (dictem-postprocess-definition-hyperlinks)
  )

(progn
  (set-buffer "*dsl-buffer*")
  (dictem-lingvo-dsl-highlight))

(defface dictem-lingvo-dsl-italic-face
  '((((background light)) (:italic true))
    (((background dark))  (:italic true)))
  "Face for italic"
  )

(defface dictem-lingvo-dsl-color-face
  '((((background light)) (:italic true))
    (((background dark))  (:italic true)))
  "Face for color"
  )

(defface dictem-lingvo-dsl-example-face
  '((((background light)) (:italic true))
    (((background dark))  (:italic true)))
  "Face for color"
  )

(defface dictem-lingvo-dsl-bold-face
  '((((background light)) (:bold true))
    (((background dark))  (:bold true)))
  "Face for bold"
  )

(defface dictem-lingvo-dsl-trn-face
  '((((background light)) (:bold true :italic true))
    (((background dark))  (:bold true :italic true)))
  "Face for trn"
  )

(provide 'dictem-lingvo-dsl)