File: colortbl.hlx

package info (click to toggle)
hyperlatex 2.5-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 480 kB
  • ctags: 288
  • sloc: lisp: 2,291; sh: 180; makefile: 86; awk: 21
file content (67 lines) | stat: -rw-r--r-- 2,073 bytes parent folder | download | duplicates (6)
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
%%
%% Support for `colortbl' package in Hyperlatex
%%
%% (C) 1997, Eric Delaunay <delaunay@lix.polytechnique.fr>

\HlxEval{
  ;; define the commands columncolor & rowcolor
  (put 'columncolor 'hyperlatex 'hyperlatex-format-columncolor)
  (put 'rowcolor 'hyperlatex 'hyperlatex-format-rowcolor)

  (defvar hyperlatex-colortbl-rowcl nil)

  (defun hyperlatex-format-columncolor ()
    (let ((model (hyperlatex-parse-optional-argument))
		  (value (hyperlatex-parse-required-argument))
		  (left (hyperlatex-parse-optional-argument))
		  (right (hyperlatex-parse-optional-argument)))
	  (hyperlatex-colortbl-setcolor (hyperlatex-color-translate model value))
	)
  )

  (defun hyperlatex-format-rowcolor ()
    (let ((model (hyperlatex-parse-optional-argument))
		  (value (hyperlatex-parse-required-argument)))
	  (setq hyperlatex-colortbl-rowcl (hyperlatex-color-translate model value))
	  (hyperlatex-colortbl-setcolor hyperlatex-colortbl-rowcl)
	)
  )

  (defun hyperlatex-colortbl-setcolor (color)
	(if (<= hyperlatex-html-level 20)
	  ()
;	 else
	  (let* ((here (point))
			(start (progn (search-backward (concat hyperlatex-meta-< "TD")) (point)))
			(stop (progn (search-forward hyperlatex-meta-> here t) (point))))
		  (if (re-search-backward (concat " BGCOLOR=" hyperlatex-meta-dq "#\\w+" hyperlatex-meta-dq) start t)
			(replace-match (concat " BGCOLOR=" hyperlatex-meta-dq color hyperlatex-meta-dq))
  ;		 else
			(backward-char)
			(insert (concat " BGCOLOR=" hyperlatex-meta-dq color hyperlatex-meta-dq))
		  )
		(goto-char here)
	  )
	)
  )

(if (fboundp 'hyperlatex-colortbl-tab)
  ()
  (fset 'hyperlatex-colortbl-tab (symbol-function 'hyperlatex-format-tab))
  (defun hyperlatex-format-tab ()
	(hyperlatex-colortbl-tab)
	(if hyperlatex-colortbl-rowcl
	  (hyperlatex-colortbl-setcolor hyperlatex-colortbl-rowcl))
  )
)

(if (fboundp 'hyperlatex-colortbl-tab-\\)
  ()
  (fset 'hyperlatex-colortbl-tab-\\ (symbol-function 'hyperlatex-format-tab-\\))
  (defun hyperlatex-format-tab-\\ ()
	(setq hyperlatex-colortbl-rowcl nil)
	(hyperlatex-colortbl-tab-\\)
  )
)
}