Previous Next

Installation

Unpack the archive in any directory. Set environment variables correctly. They are:

SGML_HOME
should point to TEItools directory. For example, if you've unpacked archive in /usr/local/lib, then SGML_HOME should be set to /usr/local/lib/TEItools.

LANG
should contain your locale name. Make sure there is corresponding locale file in $SGML_HOME/lib. If there is not, create one by making a link to an existing one or by writing your own by example in case TEItools does not support your language yet.

TEITOOLS_DEBUG
don't set this unless you are debugging TEItools.

TEITOOLS_USE_XML
if set, nsgmls is not used, internal XML parser is used instead.

nsgmls, costsh and $SGML_HOME/bin should be in your PATH. Go to src directory, and issue make install to compile xpm2rtf.

If you operate WWW server, you can serve TEI Lite documents without explicit conversion to HTML. I've included sample CGI shell script, tei2html.cgi, which should be configured to run when user requests TEI files. For the Apache web server, add the following to srm.conf:

AddType application/x-tei .tei
Action  application/x-tei /cgi-bin/tei2html.cgi

and put tei2html.cgi in the appropriate cgi-bin directory.

Psgml tuning

Add the following to your ~/.emacs:

(load-library "psgml")

(setq sgml-catalog-files 
  (append sgml-catalog-files 
          (list (concat (getenv "SGML_HOME") "/dtd/catalog")))
  sgml-custom-dtd
      '(
	("TEI Tools" 
         "<!doctype tei.2 public '-//TEI//DTD TEI Tools 0.1//EN'>" 
	 "/tmp/teilite.ced")))

If you use 8-bit characters, and don't want them to be represented as ISO 8859-1 entities, like if you're writing in Russian charset, then your ~/.emacs should contain this, too:

(add-hook 'sgml-mode-hook 
          '(lambda ()
             (setq write-file-hooks (delete 'fix-iso2sgml write-file-hooks)
                   find-file-hooks (delete 'fix-iso2sgml find-file-hooks)
                   )
             )
          )

If you don't like to wait while psgml parses DTD, do the following:

(add-hook 'sgml-mode-hook
          '(lambda ()
	     (let ((ced-file-name 
		    (concat (file-name-sans-extension (buffer-file-name)) 
		            ".ced"))
		   )
	       (if (file-readable-p ced-file-name)
		   (sgml-load-dtd ced-file-name)
		 (sgml-parse-prolog)
		 (sgml-save-dtd ced-file-name)
		 )
	       )
           ) 
        )

If you like to see TEI markup colorized in psgml, do the following:

(make-face 'tei-head-1-face)
(set-face-foreground 'tei-head-1-face "dark green")
(set-face-font 'tei-head-1-face  
	"-*-courier-bold-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-head-2-face)
(set-face-foreground 'tei-head-2-face "dark blue")
(set-face-font 'tei-head-2-face  
	"-*-courier-bold-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-head-3-face)
(set-face-foreground 'tei-head-3-face "dark green")
(set-face-font 'tei-head-3-face  
	"-*-courier-normal-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-head-4-face)
(set-face-foreground 'tei-head-4-face "dark blue")
(set-face-font 'tei-head-4-face  
	"-*-courier-normal-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-head-5-face)
(set-face-foreground 'tei-head-5-face "brown")
(set-face-font 'tei-head-5-face  
	"-*-courier-bold-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-emph-face)
(set-face-font 'tei-emph-face  
	"-adobe-helvetica-medium-o-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-title-face)
(set-face-font 'tei-title-face  
	"-adobe-helvetica-bold-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-eg-face)
(set-face-font 'tei-eg-face  
	"-adobe-helvetica-medium-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-label-face)
(set-face-foreground 'tei-label-face "dark cyan")
(set-face-font 'tei-label-face  
	"-adobe-courier-medium-o-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-item-face)
(set-face-foreground 'tei-item-face "dark cyan")
(set-face-font 'tei-item-face  
	"-adobe-courier-bold-r-*-*-*-180-*-*-*-*-koi8-*")
(make-face 'tei-note-face)
(set-face-font 'tei-note-face  
	"-adobe-courier-medium-r-*-*-*-140-*-*-*-*-koi8-*")
(make-face 'tei-quote-face)
(set-face-font 'tei-quote-face 
	"-adobe-courier-medium-o-*-*-*-180-*-*-*-*-koi8-*")

(add-hook 'tei-mode-hook
 '(lambda ()
  (interactive)
  (sgml-mode)
  (setq 
   font-lock-keywords
   '(
     ("<div1[^>]*><head/[^/]*/"	. tei-head-1-face)
     ("<div1[^>]*><head[^>]*>[^<]*</>"	. tei-head-1-face)
     ("<div1[^>]*><head[^>]*>[^<]*</head>"	. tei-head-1-face)
     ("<div2[^>]*><head/[^/]*/"	. tei-head-2-face)
     ("<div2[^>]*><head[^>]*>[^<]*</>"	. tei-head-2-face)
     ("<div2[^>]*><head[^>]*>[^<]*</head>"	. tei-head-2-face)
     ("<div3[^>]*><head/[^/]*/"	. tei-head-3-face)
     ("<div3[^>]*><head[^>]*>[^<]*</>"	. tei-head-3-face)
     ("<div3[^>]*><head[^>]*>[^<]*</head>"	. tei-head-3-face)
     ("<div4[^>]*><head/[^/]*/"	. tei-head-4-face)
     ("<div4[^>]*><head[^>]*>[^<]*</>"	. tei-head-4-face)
     ("<div4[^>]*><head[^>]*>[^<]*</head>"	. tei-head-4-face)
     ("<div5[^>]*><head/[^/]*/"	. tei-head-5-face)
     ("<div5[^>]*><head[^>]*>[^<]*</>"	. tei-head-5-face)
     ("<div5[^>]*><head[^>]*>[^<]*</head>"	. tei-head-5-face)
     ("<emph/[^/]*/" . tei-emph-face)
     ("<emph[^>]*>[^<]*</emph>" . tei-emph-face)
     ("<emph[^>]*>[^<]*</>" . tei-emph-face)
     ("<hi/[^/]*/" . tei-emph-face)
     ("<hi[^>]*>[^<]*</title>" . tei-emph-face)
     ("<hi[^>]*>[^<]*</>" . tei-emph-face)
     ("<title/[^/]*/" . tei-title-face)
     ("<title[^>]*>[^<]*</title>" . tei-title-face)
     ("<title[^>]*>[^<]*</>" . tei-title-face)
     ("<eg[^>]*>[^<]*</>" . tei-eg-face)
     ("<eg[^>]*>[^<]*</eg>" . tei-eg-face)
     ("<code/[^/]*/" . tei-eg-face)
     ("<code[^>]*>[^<]*</>" . tei-eg-face)
     ("<code[^>]*>[^<]*</code>" . tei-eg-face)
     ("<kw/[^/]*/" . tei-eg-face)
     ("<kw[^>]*>[^<]*</>" . tei-eg-face)
     ("<kw[^>]*>[^<]*</kw>" . tei-eg-face)
     ("<label/[^/]*/" . tei-label-face)
     ("<label[^>]*>[^<]*</>" . tei-label-face)
     ("<label[^>]*>[^<]*</label>" . tei-label-face)
     ("<note/[^/]*/" . tei-note-face)
     ("<note[^>]*>[^<]*</>" . tei-note-face)
     ("<note[^>]*>[^<]*</note>" . tei-note-face)
     ("<item/" . tei-item-face)
     ("<item[^>]*>" . tei-item-face)
     ("<q/[^/]*/" . tei-quote-face)
     ("<q>[^<]*</>" . tei-quote-face)
     ("<q>[^<]*</q>" . tei-quote-face)
     ("<socalled/[^/]*/" . tei-quote-face)
     ("<socalled>[^<]*</>" . tei-quote-face)
     ("<socalled[^>]*>[^<]*</socalled>" . tei-quote-face)
     ("<term/[^/]*/" . tei-eg-face)
     ("<term[^>]*>[^<]*</>" . tei-eg-face)
     ("<term[^>]*>[^<]*</term>" . tei-eg-face)
     )
   )
  )
 )
		       
(defun tei-mode ()
  (interactive)
  (sgml-mode)
  (run-hooks 'tei-mode-hook)
  (font-lock-mode 1))

(defun docbook-mode ()
  (sgml-mode)
  )

(setq auto-mode-alist
      (append
       (list
        '("\\.tei$" . tei-mode))
       auto-mode-alist))
	      

Of course, choose fonts and colors according to your taste.


Previous Next

Last modified: 19 18:09:48 MSK 2004
Produced by TEItools